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 192.168.0.1 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.
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
For your question regarding changing of the IPs, there are several possibilities:
- Use text labels
- 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
- 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