Adding a 2nd IP - Linux


#1

What is the recommended way to add a second IP into the Linux (Ubuntu) config ?

eth0:0 in /etc/network/interfaces ?

Any routing needed ?
What mask to use ?


#2

To add manually, you can do it using ip like this:

ip a add 1.2.3.4 dev eth0

Or using /etc/network/interfaces so it comes up at boot:

auto eth0:1
iface eth0:1 inet static
    address 1.2.3.4
    netmask 255.255.255.255

For our additional ip addresses, the netmask is 255.255.255.255 as it’s just a single ip routed to your primary ip.

Ian