Adding a new IP to eth0 eth0:0

My server has multiple failover IP addresses.

Mainly so I don’t forget, here is how to add a new failover IP under ubuntu (and I would assume any debian based distribution of linux):

ssh into the server

sudo jed /etc/network/interfaces  (jed or whatever your editor of choice is)

find the line that starts

auth lo eth0

and add the eth0:0 (or whatever) part to that line

Mine now reads

auto lo eth0 eth0:0 eth0:1

You now need to add the virtual eth port.

For this you need the new IP (I will use 192.168.1.22 in my example)

You will also need to call the new port something (I will use eth0:0)

You also need the broadcast address (I will use 192.168.1.255)

You will also need the netmask (this is generally 255.255.255.0)

You will also need the network (I will use 192.168.1.0)

iface eth0:0 inet static

address 192.168.1.1

netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0


Save the file, exit back to bash and type
/etc/init.d/networking restart
wait a short time for the network to update and you should be able to ping the new IP.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge