IP MASQ/default gateway

IP MASQ/default gateway

Post by Ken Boot » Mon, 16 Aug 1999 04:00:00



I'm running Red Hat 5.2 out of the box on a system with two ne2000
cards; one (eth1) is connected to my local network (192.168.2.0/24) the
other (eth0) is connected to an ADSL modem.
I have almost everything working; dhcpc on eth0, dhcpd on eth1,
masquerading, etc., etc.
The problem I can't find a solution to is setting the default gateway.
netstat -rn gives:

0.0.0.0    192.168.2.1    0.0.0.0    UG    1500    0    0    eth1

Now the NET-3-HOWTO says to do this:

     # Default route to the rest of the internet.
     route add default ppp0

but this dosen't work (for me). I have to manually enter:

route add default gw xxx.xxx.xxx.xxx eth0

Where xxx.xxx.xxx.xxx is the IP address assigned to eth0 by th ISP. now
everything works.

How can I automate the setting of the default gateway?

P.S as soom as I figure this out, I'm going to write "Linux/IP MASQ/DSL
for dummies". I figure there's a lot of them like me trying to do this!

--
Regards, Ken

I AM.

 
 
 

IP MASQ/default gateway

Post by Steve Cowle » Mon, 16 Aug 1999 04:00:00


Ken,

I know this is going to sound crazy, but I have seen this work in the past.
Simply reverse eth0/eth1, i.e. Make eth1 physically connect to the cable
modem and eth0 connect to your local LAN. I say this because you seem to be
using DHCP to obtain an IP address/gateway for both interfaces and the
binding order ( eth0 is brought up first, then eth1 ) is dictating who gets
the default route. If I understood your post correctly.

If the above does not work, I would consider configuring the internal
interface statically instead of using DHCP. I also have ADSL and my external
interface gets its address/gateway using DHCP. Plus, my default route is set
to the .1 address of the network address assigned by my ISP. My internal
interface is configured as static, but I also run dhcpd so that my Win9x
clients can get their addess/gateway info. My internal DHCP scope points my
clients desktops default route to be the internal "static" IP address of my
Linux box.

If all else fails, you could simply put the "route add" command in the
/etc/rc.local file which will be executed at startup. i.e. After the network
is brought up. Thus, overriding DHCP. <groan>

Hope one of these suggestions works...
Steve Cowles
SWCowles at gte dot net


Quote:> I'm running Red Hat 5.2 out of the box on a system with two ne2000
> cards; one (eth1) is connected to my local network (192.168.2.0/24) the
> other (eth0) is connected to an ADSL modem.
> I have almost everything working; dhcpc on eth0, dhcpd on eth1,
> masquerading, etc., etc.
> The problem I can't find a solution to is setting the default gateway.
> netstat -rn gives:

> 0.0.0.0    192.168.2.1    0.0.0.0    UG    1500    0    0    eth1

> Now the NET-3-HOWTO says to do this:

>      # Default route to the rest of the internet.
>      route add default ppp0

> but this dosen't work (for me). I have to manually enter:

> route add default gw xxx.xxx.xxx.xxx eth0

> Where xxx.xxx.xxx.xxx is the IP address assigned to eth0 by th ISP. now
> everything works.

> How can I automate the setting of the default gateway?

> P.S as soom as I figure this out, I'm going to write "Linux/IP MASQ/DSL
> for dummies". I figure there's a lot of them like me trying to do this!

> --
> Regards, Ken

> I AM.


 
 
 

IP MASQ/default gateway

Post by Ken Boot » Mon, 16 Aug 1999 04:00:00


Steve,

Thanks for the input. Actually the IP address of the network interface *is*
statically assigned (192.168.2.1) - I'm using dchpd (the server) on that port to
configure my Win9x clients. The dchpcd  client is only used on the interface
connecting to the DSL modem.
I think you or I  missed a point when you suggested to put the "route add"
command in the /etc/rc.local file - the gateway IP adress is dynamically
allocated - how do you refer to that address in the "route add" command - do I
have to write a program to extract the info from ifconfig and dynamically create
a script? I'm not a unix script programmer, so I'd need a lot of help with that.

I had wondered whether order of the interfaces was a factor (after I had got it
all set up), but I had got this far and so close, I was hoping for a simple
switch somewhere, especially as I don't regularly do this kind of thing, so I
was afraid of messing up what I had achieved so far. Oh well - maybe I better
bite that bullet!

(The frustrating thing is, I have another Linux box which has been sitting here
for 2+ years doing essentially the same job via ppp/v.90 modem. That box is
running Slackware with a 2.0.1 kernel and has worked all that time without
problem, so I didn't mess with it. Unfortunately I was forced to upgrade to a
newer kernel to be able to run two ethernet cards. Seems like a lot of things
changed since I set up that last system)

--
Regards, Ken

I AM.


> Ken,

> I know this is going to sound crazy, but I have seen this work in the past.
> Simply reverse eth0/eth1, i.e. Make eth1 physically connect to the cable
> modem and eth0 connect to your local LAN. I say this because you seem to be
> using DHCP to obtain an IP address/gateway for both interfaces and the
> binding order ( eth0 is brought up first, then eth1 ) is dictating who gets
> the default route. If I understood your post correctly.

> If the above does not work, I would consider configuring the internal
> interface statically instead of using DHCP. I also have ADSL and my external
> interface gets its address/gateway using DHCP. Plus, my default route is set
> to the .1 address of the network address assigned by my ISP. My internal
> interface is configured as static, but I also run dhcpd so that my Win9x
> clients can get their addess/gateway info. My internal DHCP scope points my
> clients desktops default route to be the internal "static" IP address of my
> Linux box.

> If all else fails, you could simply put the "route add" command in the
> /etc/rc.local file which will be executed at startup. i.e. After the network
> is brought up. Thus, overriding DHCP. <groan>

> Hope one of these suggestions works...
> Steve Cowles
> SWCowles at gte dot net



> > I'm running Red Hat 5.2 out of the box on a system with two ne2000
> > cards; one (eth1) is connected to my local network (192.168.2.0/24) the
> > other (eth0) is connected to an ADSL modem.
> > I have almost everything working; dhcpc on eth0, dhcpd on eth1,
> > masquerading, etc., etc.
> > The problem I can't find a solution to is setting the default gateway.
> > netstat -rn gives:

> > 0.0.0.0    192.168.2.1    0.0.0.0    UG    1500    0    0    eth1

> > Now the NET-3-HOWTO says to do this:

> >      # Default route to the rest of the internet.
> >      route add default ppp0

> > but this dosen't work (for me). I have to manually enter:

> > route add default gw xxx.xxx.xxx.xxx eth0

> > Where xxx.xxx.xxx.xxx is the IP address assigned to eth0 by th ISP. now
> > everything works.

> > How can I automate the setting of the default gateway?

> > P.S as soom as I figure this out, I'm going to write "Linux/IP MASQ/DSL
> > for dummies". I figure there's a lot of them like me trying to do this!

> > --
> > Regards, Ken

> > I AM.