ifconfig to make an alias on the fly

Create the new alias and change the default route:

$ sudo ifconfig eth0:0 192.168.1.2 netmask 255.255.255.0
$ sudo route del default
$ sudo route add default gw 192.168.1.1

Remove the alias and the default route :

$ sudo route del default
$ sudo ifconfig eth0:0 down

Typical use : I get network settings from DHCP, but I have a huge file transfer to make and want to temporarily use a gateway on another ip lan. For exemple : to make the first update on a brand new ubuntu install.

Comments !