-2

I'm trying to set up an ubuntu 14.04 server to listen on multiple IP addresses. A range has been assigned to the server (X.X.X.146/29) and ip addr show confirms that this is how eth0 has been configured (private info masked):

$ ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet X.X.X.146/29 brd X.X.X.151 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 XXXX::XXX:XXXX:XXXX:XXXX/64 scope link 
       valid_lft forever preferred_lft forever

I can ping and ssh into the server on X.X.X.146, but ping fails with "host unreachable" on any of the other assigned IP addresses. In particular this is a problem because the domain name for the server is assigned to X.X.X.149.

Just to test it further, I set up nginx listening on port 80. curl X.X.X.146 gets a response from nginx but curl X.X.X.149 times out. I'm sure this is a really simple thing to set up but I can't figure it out.

aquavitae
  • 99
  • 6

1 Answers1

1

You need to configure the other IP addresses on this host system.

You can do by adding relevant configuration lines in /etc/network/interfaces file like below.

auto eth0:0
iface eth0:0 inet static
   address X.X.X.149
   netmask 255.255.255.248
   network X.X.X.144
   broadcast X.X.X.151

You should add these lines for all IP addresses you want to use, increasing the second number in eth0:0 part for each IP address.

kasperd
  • 30,455
  • 17
  • 76
  • 124
Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • According to [this](http://askubuntu.com/questions/547289/how-can-i-from-cli-assign-multiple-ip-addresses-to-one-interface) network aliasing is deprecated. Anyway, shouldn't the netmask achieve the same effect? – aquavitae Apr 08 '16 at 13:35
  • True, that is a deprecated notation. The answer in the other question is correct and fulfills your needs. Netmask doesn't achieve the same effect. Netmask only tells the computer which IP addresses are reachable directly and which IP addresses need routing to reach. – Tero Kilkanen Apr 08 '16 at 17:08
  • Thanks, that answers my question. If you update your answer with that I'll happily accept it – aquavitae Apr 09 '16 at 17:19