"ip" Linux command line trick (or: is ifconfig obsolete?)

We all know how to add a virtual IP using ifconfig command line:

ifconfig eth0:1 up

Apparently Linux' /sbin/ip tool provides an alternative:

ip addr add dev eth0

This way we do not create a new interface at all: this is a secondary IP that belongs to eth0. Also, it's "hidden" from ifconfig (at least until someone fixes that..), which most people use. Cool, eh?

Apparently RedHat cluster uses this method for adding a Virtual IP to a machine, while Linux-ha (version 1 at least), Veritas cluster and Oracle RAC use the traditional, eth0:1-like addresses.

The /sbin/ip tool seems very powerful.. I should learn some more tricks =)

Leave a Reply

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