[thelist] OT? IP masquerading with dynamic IP help?

Colin Mitchell colspan at jerkvision.com
Mon Mar 4 08:29:01 CST 2002


Sorry for the long delay in replying to this one.  Unfortunately, I just got
one of those nifty hub/firewalls and I've removed a couple lines of my
configuration because of it.

I like to use the 'netcfg' tool to setup my interfaces.  There's a panel
there where you can choose the 'Interface configuration protocol' -- choose
DHCP.  Then, in my rc.local file, I have a line that looks like this:

route add default gw eth0

(eth0 is the NIC that is attached to the external network)

That line should route all traffic on the internal network to the external
network.  Then add in the appropriate masquerading lines (which for me look
like this):

#########################################

# Load the NAT module (this pulls in all the others).
modprobe iptable_nat

# In the NAT table (-t nat), Append a rule (-A) after routing
# (POSTROUTING) for all packets going out ppp0 (-o ppp0) which says to
# MASQUERADE the connection (-j MASQUERADE).
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# Turn on IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward

route add default gw eth0

#########################################

Hope that helps you out.

Thanks - Colin



-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of dan donaldson
Sent: Sunday, March 03, 2002 3:27 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] OT? IP masquerading with dynamic IP help?



On Sunday, March 3, 2002, at 03:23  PM, Colin Mitchell wrote:

> I've run this configuration many times now without much problem.  The
> only
> thing that should be different from a static IP setup is that you'll
> want to
> grab your new IP address with DHCP.  At that point, you'll be able to
> hit
> the net from the linux box, an the config for the internal network
> shouldn't
> need to be changed at all.
>
> If you need more than that, let me know and I'll see if I can get you
> something more specific.
>

Colin:

thanks for the reply. What I don't know how to do is grab the IP from
DHCP. I did in fact do most of the original setup from the shell, but as
I look at the configuration in LinuxConf, the mapping of the second
interface to the gateway looks like its a simple correspondence -
something like 192.168.0.1 -> nnn.nnn.nnn.nnn. where the second IP is
the old static address.

Any guidance on how that second IP can be dynamically looked up from
DHCP? Is this a bit of shell magic or can it be done in LinuxConf...?
(BTW, the Linux box is not currently connected to anything - I'm doing
this on my OS X box which is directly connected using PPPoE. The plan is
to get it running with a hub on the second interface...)

dan

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list