I'm just trying to do some simple MASQUERADING with a linux box I setup as a router on my internal network. The router resides behind another linksys router which is connected to my internet connection.
eth1 of the linux router is on the network behind the linksys router on the network 192.168.1.0 with an IP address of 192.168.1.103
eth0 of the router is on the 192.168.0.0 network with an IP of 192.168.0.103
This network (192.168.0.0) has my laptop connected to it with an IP of 192.168.0.100.
The linux router can talk to the internet from the linksys router via eth1.
Now my question is (and I've read the NAT tutorial) and Rusty's guide to Iptables how do I do ipmasquerading on the linux box so that my laptop can share the internet connection through the linux router?
The best I've been able to come up with is that I need to try this....
(but it doesn't work)
# eth1 - Incoming Interface
# (Incoming interface from the network)
# eth0 - Outgoing Interface
# (Outgoing interface from the private network)
# Make all the packets from the internal private
# network look as though they came from the router
# by Source NATing their source address when they
# exit the router.
# (i.e. change the packets source address so it matches
# that of the router.)
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
After running this script in the router I still can't ping any of the computers on the 192.168.1.0 network.
Also, what file is the mapping in the router done in?
Is it the /proc/net/ip_conntrack?
One more thing, does it have something to do with the route command? I always need to type that to get my laptop to work with my linux router, I know it has to do with giving the laptop a route to other networks and assigning a gateway, but I don't fully understand the route command.
- A Man is not an island...that's why we have fourms!
The administrator has disabled public write access.