Datamation Logo

Tip of the Trade: Assign Multiple Addresses to a Network Interface

June 18, 2008
Datamation content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

The ip command is part of the iproute2 suite of TCP/IP networking utilities. It keeps trying to replace the old familiar ifconfig and route commands, which do what they do splendidly but are a bit limited for today’s network environments. One thing ip can do that ifconfig cannot is assign multiple addresses to a single network interface. ifconfig can assign multiple aliases, such as eth0:0, eth0:1, and so forth, but then you must give each alias a separate configuration as though they are separate physical interfaces. ip adds addresses to a single interface like this:

Recent Tips
» OpenSolaris liveCD
» Squid

» Specto

Read All Tips

# ip addr add 192.168.1.10/24 brd + dev eth0
# ip addr add 192.168.2.10/24 brd + dev eth0

brd + means “automatically set the broadcast address.” View the results with this command:

$ ip addr show eth0
2: eth0:  mtu 1500 qdisc noop qlen 1000
link/ether 00:03:6d:00:83:cf brd ff:ff:ff:ff:ff:ff
inet 192.168.2.10/24 brd 192.168.2.255 scope global eth0
inet 192.168.3.10/24 brd 192.168.3.255 scope global eth0

If you run ifconfig to check your addresses, it will see only the first one.

This is a great way to get access to multiple subnets without having to create a herd of new configurations, or install multiple network interface cards. Another practical use for this is accessing a new server or router for the first time. Typically, these come with a default IP address. If it’s on a different subnet, but on the same switch, you can quickly add a compatible address to your workstation and log in to the new device. When you’re finished, remove the unwanted addresses like so:

# ip addr del 192.168.3.10/24 dev eth0

man ip is the best and most complete reference.

This article was first published on ServerWatch.com.

  SEE ALL
ARTICLES
 

Subscribe to Data Insider

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more.

Datamation Logo

Datamation is the leading industry resource for B2B data professionals and technology buyers. Datamation's focus is on providing insight into the latest trends and innovation in AI, data security, big data, and more, along with in-depth product recommendations and comparisons. More than 1.7M users gain insight and guidance from Datamation every year.

Advertisers

Advertise with TechnologyAdvice on Datamation and our other data and technology-focused platforms.

Advertise with Us

Our Brands


Privacy Policy Terms & Conditions About Contact Advertise California - Do Not Sell My Information

Property of TechnologyAdvice.
© 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.