EDIT: I needed this too
Code:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Why do I always notice these things seconds after I post.
Mods: I won't be saddened if you delete/merge this thread.
*******************
eth1 is connected to a hub, eth0 to my DLink router through which it accesses the internet. No problems there as I can browse everything from the gateway machine (which I'm on right now).
I can connect a laptop to the hub and it gets an IP address 10.0.0.20, router 10.0.0.1 and subnet 255.255.255.0.
I can connect to 10.0.0.1's httpd but can't route to
anything past the gateway like google.com or even 192.168.0.1 (DLink config page). `lynx 10.0.0.20` from the gateway also works.
Given what follows, why the fudge not? I've been racking my brain about this for days and I can't for the life of me figure out why it doesn't work properly. (The dhcp lease time was reduced to 5 seconds for debugging purposes).
Code:
root@gateway:/# cat /proc/sys/net/ipv4/ip_forward
1
Code:
root@gateway:/# ifconfig
eth0 Link encap:Ethernet HWaddr 00:11:09:E9:61:E0
inet addr:192.168.0.50 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3088 errors:0 dropped:0 overruns:0 frame:0
TX packets:2015 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1293423 (1.2 Mb) TX bytes:318924 (311.4 Kb)
Interrupt:10 Base address:0x4000
eth1 Link encap:Ethernet HWaddr 00:11:09:E9:61:E1
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:411 errors:0 dropped:0 overruns:0 frame:0
TX packets:170 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:58204 (56.8 Kb) TX bytes:40497 (39.5 Kb)
Interrupt:3 Base address:0xe000
Code:
root@gateway:/# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 * 255.255.255.0 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
default 192.168.0.1 0.0.0.0 UG 1 0 0 eth0
Code:
root@gateway:/# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Code:
root@gateway:/etc# cat dhcpd.conf
ddns-update-style none;
default-lease-time 5;
max-lease-time 5;
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.1;
# option subnet-mask 255.255.255.0;
option domain-name-servers 206.47.244.12, 206.47.244.42;
option ip-forwarding on;
range 10.0.0.10 10.0.0.20;
}
And, aplty:
Code:
root@gateway:/# fortune
Command, n: Statement presented by a human to a computer in such
a manner as to make the human feel as if he were in control
Though I don't much feel it at the moment.
This is a continuation from this thread (
http://www.linuxquestions.org/questi...hreadid=312125 ).
I know it's bad practice to double post but the old thread was...less than pretty and contained lots of outdated and confusing information on my part.
I also claimed I found an answer by restting the netmask of eth1 to 255.255.0.0 which doesn't work. That means I stumbled upon the answer by a fluke I haven't been able to reproduce.