Server Fault is a question and answer site for system and network administrators. 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

How do I add more IP addresses to a network card on Linux? Do I use the route command?

It's Ubuntu Server 10.04 LTS.

share|improve this question
Why did someone downvote this? I don't get it? – ServerChecker Jun 2 '11 at 18:28
@sciurus, I disagree. If we're going to do that, then what's the point of Besides, a quarter of the time we do searches on Google these days, we get spam blogs, or a query in a forum where no one has ever given out an answer, or ExpertExchange (gah!), or advice from like 2007. No thanks. I'll stick with the stack* sites. – ServerChecker Jun 7 '11 at 19:23
up vote 3 down vote accepted

do you mean you want to add secondary ip ?

   $ sudo vi /etc/network/interfaces
     auto eth0
     iface eth0 inet static
      address x.x.x.x
      netmask x.x.x.x
      network x.x.x.x
      gateway x.x.x.x
      broadcast x.x.x.x

     auto eth0:1
      iface eth0:1 inet static
      address x.x.x.x
      netmask x.x.x.x
      network x.x.x.x
      broadcast x.x.x.x

   $ sudo /etc/init.d/networking restart
share|improve this answer
Can you expand on this? I mean, what about the changes I need to do to whatever else is already in /etc/network/interfaces by default? – ServerChecker Jun 2 '11 at 18:49
on /etc/network/interfaces, the default is only 1 device (eth0/etch1/ethX) so you need to add more if you want to add secondary ip, i updated the sample above. – chocripple Jun 3 '11 at 0:46

You can use the new style:

ip address add dev eth0

Or the old style:

ifconfig eth0:1 netmask
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.