Adding additional IPv4 to Ubuntu
If you are using Ubuntu 18.04 and newer -- please refer to Configure additional IPv4 to Ubuntu using Netplan.
and
This guide is applicable only for KVM based VPSes, for OpenVZ based VPSes please click here
To View Network Gateway and Netmask
To find the gateway and netmask of your IP address, please see this guide -- Viewing Network Gateway and Netmask
First, find the main/primary interface name with,
ip a
If the above command returns a error, you can try,
ifconfig -a
The output would be similar to,
[root@test-server ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 54:52:00:d7:74:ed brd ff:ff:ff:ff:ff:ff
inet 104.194.215.70/24 brd 104.194.215.255 scope global noprefixroute dynamic ens3
valid_lft 20732392sec preferred_lft 20732392sec
inet6 fe80::5652:ff:fed7:74ed/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Here, we see that we have eth0
as our network interface, from the above example,
If the above command shows you something like ens3
, then replace eth0
shown below with ens3
Next, We edit the interfaces file,
nano /etc/network/interfaces
Add the following into it,
auto eth0:0
iface eth0:0 inet static
address IP_ADDR
netmask NETMASK
Details for IP_ADDR
and NETMASK
can be found from the VPS control panel -- Please see Viewing Network Gateway and Netmask
Once the interfaces file is updated, the following command should activate up the interface,
ifup eth0:0
Adding more addon IPs
Similarly to add more IPs, say another addon IP,
Edit the interfaces file,
nano /etc/network/interfaces
Add the following into it, (Note the eth0:1 this time)
auto eth0:1
iface eth0:1 inet static
address IP_ADDR
netmask NETMASK
Details for IP_ADDR
and NETMASK
can be found from the VPS control panel -- Please see Viewing Network Gateway and Netmask
Once the interfaces file is updated,
ifup eth0:1
Done!
Similarly you can add more IPs, just change eth0:1 to eth0:2, eth0:3.. etc
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS