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
You need to create aliases of your network interface.
By creating temporary aliases using
ip address addcommand. 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 eth0If you need a more permanent solution, you would have to edit
/etc/network/interfacesfile 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.
- Ok so I did this and 4 out of the 5 ips work. The only work not working is 171. It is a /29 ipAjaydev Singh– Ajaydev Singh2016-09-01 10:26:18 +00:00Commented Sep 1, 2016 at 10:26
- since you wanna use /29,
2**(32-29) - 2 = 2**3 - 2 = 8 - 2 = 6that means only 6 hosts are allowed to use.Rahul– Rahul2016-09-01 10:32:11 +00:00Commented 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.Ajaydev Singh– Ajaydev Singh2016-09-01 10:51:24 +00:00Commented 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.edt11x– edt11x2022-05-18 15:18:30 +00:00Commented May 18, 2022 at 15:18