Linux Networking/IP Aliasing

Multiple IP addresses


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 dev eth0
ip addr add 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 dev eth0

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