1

I to setup multiple IPs on my Ubuntu 16.04.1 server. I have it in a data center and they gave me 5 IPs range 170-174.

1 Answer 1

0

You need to create aliases of your network interface.

  • By creating temporary aliases using ip address add command. The aliases setup this way will be lost upon a reboot and you will need to recreate those aliases.

    sudo ip addr add xx.xx.xx.xx/xx dev eth0 # For example sudo ip addr add 172.16.100.170/24 dev eth0 
  • If you need a more permanent solution, you would have to edit /etc/network/interfaces file and add alias definitions there.

Then use ip addr show command to see the changes. Then you would have to do sudo ifdown eth0 && sudo ifup eth0 to activate these settings without a reboot.

4
  • Ok so I did this and 4 out of the 5 ips work. The only work not working is 171. It is a /29 ip Commented Sep 1, 2016 at 10:26
  • since you wanna use /29, 2**(32-29) - 2 = 2**3 - 2 = 8 - 2 = 6 that means only 6 hosts are allowed to use. Commented Sep 1, 2016 at 10:32
  • You do think its a problem with the hosting company because I added all of them but 171 is not working but others work and have no problems. Commented Sep 1, 2016 at 10:51
  • The way I have done this in the past is with ifconfig. "ifconfig eth0:1 172.16.100.171 netmask 255.255.255.0 up". You can add virtual adapters on the real interface by adding colon and then a number. Commented May 18, 2022 at 15:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.