Linux Networking/IP Aliasing

Multiple IP addresses

edit

There are some applications where being able to configure multiple IP addresses to a single network device is useful. Internet Service Providers often use this facility to provide a "customized" what to their World Wide Web and ftp offerings for their customers.

For example, assume you have an Ethernet network that supports two different IPv4 subnetworks simultaneously and you wish your machine to have direct access to both, you could use something like:

ip addr add 192.168.1.1/24 dev eth0
ip addr add 192.168.10.1/24 dev eth0

Adding an address also automatically adds a route to the accompanying network.

To delete an alias, simply replace add by del:

ip addr del 192.168.10.1/24 dev eth0

All routes associated with that address will also be deleted automatically.