Web lists-archives.com

ifconfig/ ifupdown/ ip -




So I change between two internet connections from time to time.

I use /etc/network/interfaces ("/e/n/i")

When I modify /e/n/i , I then run a little "reset" script, like so:

dev=eth0
ifdown $dev
ifconfig $dev down
ifup $dev

Here and there I've had problems.

Recently I discovered the ip command.

Apparently, after reconfiguring as above, two IP addresses end up
attached to eth0 - one for each (staticly configured in /e/n/i)
ISP network connection.

So now I am manually running something like:

ifconfig eth0 down
ip address del 10.1.1.30/24 dev eth0
ip address del 192.168.1.30/24 dev eth0
ip address del fe80::f2de:f1ff:fef7:ea96/64 dev eth0
ifup eth0

But this (atm) is a very manual process, and it seems to me that I am
not taking down eth0 properly, and that I should not have to
introduce IP address awareness into my eth reset script, just to
properly reset my eth0 static configuration.

Any pointers of what I need to read/ what I am missing, would be
really appreciated.