[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ip aliasing and second default gw in /etc/network/interfaces



On Wed, Sep 03, 2003 at 01:23:58AM -0700, Peter Nome wrote:
> I'm hoping some smart soul can help me with this. After experimenting
> a bit, I discovered that I could add a second ip address by issuing
> 
>       ifconfig eth0:1 192.168.1.92 up

So far so good.. 

> Once that's in pace, I found I could add a second default gatway by
> issuing
> 
>       route add default gw 192.168.1.1

Wrong, the problem with linux routing tables is that linux is capable of
having only one default gateway, so your idea would never work, you
would need to poll the connection and change the gateway if the other
route goes down..

> I realize this question sounds silly, since I should just put it in
> interfaces in the same way I put the primary address and gateway, like
> this:
> 
> iface eth0:1 inet static 
>    address 192.168.1.71 
>    gateway 192.168.1.1
     netmask 255.255.255.0

Again, this would not work, but you are also missing the netmask.

> But it doesn't do the trick -- this is disregarded. If I enter it as
> above from bash, it always works.
> 
> I've also tried things like
> 
>         ip route add 192.168.1.0/24 dev eth0 via 192.168.1.1

what you are doing here is that you are telling linux that the network
192.168.1.0/24 resides behind 192.168.1.1 which is not what you want to
do.

what you are looking for is:
          ip route add 0.0.0.0/0 dev eth0 via 192.168.1.1

The above should work if your netmask is correctly set.

Try if that helps, 
  Sami

-- 
			  -< Sami Haahtinen >-
      -[ Notify immediately if you do not receive this message ]-
	-< 2209 3C53 D0FB 041C F7B1  F908 A9B6 F730 B83D 761C >-



Reply to: