Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If my machine is connected to several networks and configured with multiple addresses (ipv4), is it wise to configure and use labels to identify them ?

By labels I mean the iproute2 ip command's "label" tag:

ip address add dev eth0 label eth0:local

I want to be able to identify the address and change it using a script when needed.

I'm asking because the man page refers to Linux-2.0 net aliases compatibility which sounds deprecated.

Also, I might be missing a better solution.

share|improve this question
up vote 1 down vote accepted

Any recent distribution should support text labels and all support numeric labels (eth0:0 for example). Maybe some scripts/utilities will have issues when they expect a number and find a text label after the colon. Also the start-up scripts support network configuration with the labels. Labels (alias interfaces) can be setup also with plain old ifconfig (not only the ip command).

For your question regarding changing of the IPs, there are several possibilities:

  1. Use text labels
  2. Use numeric labels (eth0:0, eth0:1, ...) and remember which number corresponds to which network; I think the effect is the same for both text and numeric labels
  3. Find the correct interface in the script by the network address (assuming each labeled interface will belong only to one network); this is the most correct option in my opinion
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.