In this tutorial, we're going to explain how to add a secondary IPv4 to your cloud server.
CentOS
- Change the boot protocol from "dhcp" to "static" on eth0. If you are already using a static binding, you can skip this step. Otherwise, follow these directions:
A. Edit/etc/sysconfig/network-scripts/ifcfg-eth0
B. ChangeBOOTPROTO="dhcp"toBOOTPROTO="static"
C. Add the following at the end of the file:
IPADDR={MAIN_IP}
NETMASK={SUBNET_MASK}
GATEWAY={GATEWAY_IP}
{MAIN_IP} is your server main IP
{SUBNET_MASK} is your server Netmask
{GATEWAY_IP} is your server gateway IP
D. Runifup eth0 - Create this file
/etc/sysconfig/network-scripts/ifcfg-eth0:1 - Edit the file and add the following:
DEVICE=eth0:1
BOOTPROTO=static
IPADDR={SECONDARY_IP}
ONBOOT=yes - Activate the alias with the following command:
ifup eth0:1
Ubuntu 16/18
- Determine the name of your ethernet device. In this example, we'll use
ens3
Use one of the following commands to determine your network devide name:ip link show
orifconfig - Edit this file
/etc/network/interfacesand add the following lines:
auto ens3:0
iface ens3:0 inet static
address {SECONDARY_IP}
netmask 255.255.255.0 - Activate the alias with the following command:
ifup ens3:0
Make sure you'veifupdowninstalled, if it's not installed, you can install it withapt install ifupdown
Please make sure to use the correct device name, whether it's eth0 or ens3 or anything else.
FreeBSD
- Edit this file
/etc/rc.confand add the following line:ifconfig_vtnet0_alias0="{SECONDARY_IP} netmask 255.255.255.0"
Where {SECONDARY_IP} is your secondary IP Address - Run the following command to restart networking:
/etc/rc.d/netif restart && /etc/rc.d/routing restart
After you add your secondary IP, you must reboot the server using Server Restart function from the management panel in your client area (AKA: One Portal)
