Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I currently have 1 static IP registered on my server. I'd like to go ahead and register 4 other static addresses. I'm not sure of the syntax. Should I just do iface eth0:0 inet static?

Here's what I have now:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
      address xxx.xxx.xx.xx
      netmask xxx.xxx.xx.xx
      gateway xxx.xxx.xx.xx
      broadcast xxx.xxx.xx.xx
share|improve this question

2 Answers 2

up vote 3 down vote accepted
 auto eth0:0
 iface eth0:0 inet static
         address xxx.xxx.xxx.xxx
         netmask xxx.xxx.xxx.xxx
         broadcast xxx.xxx.xxx.xxx

Don't add more gateway entries because you'll have multiple default routes.

share|improve this answer

As an alternative to MihaiM suggestion I like to setup my configuration like this. That way all the addresses for a interface and all the addresses can be brought up with a single command (ifup eth0) or down (ifdown eth0).

auto eth0
iface eth0 inet static
        address 192.168.32.5
        netmask 255.255.255.192
        network 192.168.32.0
        broadcast 192.168.32.63
        # listen on additional addresses
        up ip addr add 192.168.32.6/26 brd + dev eth0
        up ip addr add 192.168.32.7/26 brd + dev eth0
        down ip addr del 192.168.32.6/26 brd + dev eth0
        down ip addr del 192.168.32.7/26 brd + dev eth0
share|improve this answer

Your Answer

 
discard

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.