2

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
Ben
  • 3,630
  • 17
  • 62
  • 93

2 Answers2

3
 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.

MihaiM
  • 708
  • 1
  • 8
  • 17
2

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
Zoredache
  • 128,755
  • 40
  • 271
  • 413