SUMMARY: Two IP networks on one Ethernet

Ryan Williams <breath-DPNOqEs/[email protected]> Mon, 22 Dec 2003 06:34:06 -0500
Newsgroups gmane.linux.admin.managers
Message-ID <[email protected]>
Thanks to Bob Rankin and funky1779 for their help.

The answer is shockingly concise: after ensuring that the DHCP server is 
serving correct IPs and that the gateway's internal ethernet card 
responds to 192.168.e.1, you simply have to run the following line:

iptables -t nat -A POSTROUTING -s 192.168.e.0/24 -o eth0 -j MASQUERADE

Which means (Bob's description here): "Append to the postrouting chain
this:  anything that comes from 192.168.e.0/24 and going out (-o) the
device eth0, jump to MASQUERADE".

I thought it was going to be a lot harder than this.  Chalk one up to 
elegant solutions!  Thanks, gentlefolk.

-RYaN

Ryan Williams wrote:
> The situation is this: we have a home network with a gateway running 
> Debian.  It has two Ethernet cards.  We have an IPIP tunnel configured 
> so that we can have a.b.c.d/28 addresses on our ethernet.  This has 
> worked great.
> However, we want to have dynamic hosts on this network that don't use 
> that tunnel and are dynamically assigned.  This means they should get 
> IPs from a 192.168.e.0/24 range and be NATed at the gateway.
> 
> I don't know how to do this.  I see that there is an (incomplete) page 
> dedicated to it at http://linux-ip.net/html/adv-media-share.html.  I 
> have iproute2 and iptables on the machine, but don't really understand 
> them.  I can set up the DHCP server to give out the right addresses.
> 
> I appreciate any help you can give.  Will summarize.  Thanks!
> 
> -RYaN
_______________________________________________
LinuxManagers mailing list - http://www.linuxmanagers.org
submissions: LinuxManagers-35TzE1X9F6582KRnZfj+bdi2O/[email protected]
subscribe/unsubscribe: http://www.linuxmanagers.org/mailman/listinfo/linuxmanagers