How to add Extra IP(s) on Linux

IMPORTANT: There seems to be issues with more than 1 IP on Ubuntu, we've so far only figured out how to get all IPs to work on Centos 7

So for Centos 7, ssh and login as root to one of the IP that pings, once inside, type

nmtui

and go to "Edit a connection" and delete ALL except ens18. Select ens18, go to Edit then under "IPv4 Addresses", click Add for every one of your IPs with /32 at the end so you will add

xxx.xxx.xxx.xxx/32
yyy.yyy.yyy.yyy/32

And however many IPs you have. Then click OK then Quit and type reboot to reboot VPS

On Centos: create /etc/sysconfig/network-scripts/ifcfg-eth2 (using vi command) that contains:

DEVICE=eth2
BOOTPROTO=dhcp
ONBOOT=yes

Then reboot vps. If still not working, if working IP is on eth0, then try set extra IP as eth0:0 with DHCP. More info

NOTE: On Centos 7 Min, there's no ifconfig so you need to install it first via command

yum -y install net-tools

On Ubuntu, you modify sudo vi /etc/network/interfaces. Then sudo /etc/init.d/networking restart or reboot VPS or Stop VPS then Start VPS via web panel.

auto eth0:0
iface eth0:0 inet dhcp

NOTE: Again, assuming working IP is on eth0. Some ubuntu/debian may show ens18 instead of eth0 so you will use ens18:0, ens18:1, etc... auto ens18:0 iface ens18:0 inet dhcp Hint: You can find out where working IP is on by typing ifconfig

Below is a sample of our Ubuntu 16.10 template on New KVM SSD Cached Custom plan:

First fine one from all the IPs assigned to you that pings, say in this matter, it is 23.226.214.199, then you ssh to that IP


rentvps@ubuntu:~$ ifconfig
ens18: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 63.223.115.198 netmask 255.255.255.224 broadcast 63.223.115.223
inet6 fe80::8f8:9ff:fe5f:db7f prefixlen 64 scopeid 0x20<link>
ether 0a:f8:09:5f:db:7f txqueuelen 1000 (Ethernet)
RX packets 7014 bytes 563071 (563.0 KB)
RX errors 166 dropped 0 overruns 0 frame 166
TX packets 76 bytes 7100 (7.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens19: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 23.226.214.199 netmask 255.255.255.224 broadcast 23.226.214.223
inet6 fe80::101a:99ff:fe4f:5081 prefixlen 64 scopeid 0x20<link>
ether 12:1a:99:4f:50:81 txqueuelen 1000 (Ethernet)
RX packets 7757 bytes 1413464 (1.4 MB)
RX errors 164 dropped 0 overruns 0 frame 164
TX packets 271 bytes 32188 (32.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


You will find the IP on ens18 is not pinging so you now need to modify /etc/network/interfaces by typing

sudo vi /etc/network/interfaces

and add ens19:0 below ens19 and delete the ens18 entries so you will have (you get the IP and netmask from above)

auto ens19
iface ens19 inet dhcp

auto ens19:0
iface ens19:0 inet static
address 23.226.214.199
netmask 255.255.255.224

Then reboot VPS by typing below via SSH

sudo reboot

Bu mövzu kifayət qədər köməkçi oldu?

 Çap

Digər başlıqlar

How to resize/extend Windows or Linux disk space (LVM)

If you buy a plan with more than 15GB of disk space, the remaining space is empty and need to be...

How to add Tun/TAP/PPP/Fuse support

NOTE: This is for new Openvz/LXC plans only. 1. You need to login to web panel and click the...

How to order Addons (extra rams/space/bandwidth)

1. Please login and go to to our client area products page2. Click "Active" button on the product...

How setup OpenVPN on OpenVZ with Centos 6 64-bit template

This is only for New OpenVZ with Centos-6-OpenVPN-64-bit template. You can reinstall to this...

My Ubuntu template cannot SSH as root

If you have Ubuntu on your OpenVZ/LXC plans and you cannot login as root via SSH, it is because...