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

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



Greetings !

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

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

      route add default gw 192.168.1.1

My situation is that I have two subnets, each of which have their own DSL gateway, and I'd
like the subnet machines (selectively) to be able to talk to each other and to have the other 
DSL router as a fallback when it turns out that one of the ISPs is running Windows and gets
taken out by viruses.

QUESTION: how do I enter this information in /etc/network/interfaces? I've tried the obvious 
and it fails. I've installed iproute now and could use that. These things have to be added
in a definite order --

    -- first the primary ip address
    -- then the primary gateway
    -- then the secondary ip address
    -- finally the secondary gateway

If I try to put this into /etc/network/interfaces, it just locks up. Could I put the secondary 
ip and gw in /etc/init.d/bootmisc? Is there some other logical place to put it? Do I need iproute?

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

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

from bash, but it gives the wrong mask (for default gw I want 0.0.0.0). I can put ip commands in 
/etc/network/interfaces like this (but it's not what I need):

        up ip route add 192.168.1.0/24 dev eth0 via 192.168.1.1

How do I put "route add default gw 192.168.1.1" into interfaces? If I just add that line, it freezes for 
a while and then returns unchanged. 

I'd really appreciate advice on this -- I've spent a lot of time trying to make it work.

Please cc: me.

Cheers,
Peter





        










Reply to: