Add a secondary IPv4 to your cloud server

In this tutorial, we're going to explain how to add a secondary IPv4 to your cloud server.

 

 

CentOS

  1. 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. Change BOOTPROTO="dhcp" to BOOTPROTO="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. Run ifup eth0

  2. Create this file /etc/sysconfig/network-scripts/ifcfg-eth0:1
  3. Edit the file and add the following:

    DEVICE=eth0:1
    BOOTPROTO=static
    IPADDR={SECONDARY_IP}
    ONBOOT=yes
  4. Activate the alias with the following command:
    ifup eth0:1

 

Ubuntu 16/18

  1. 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
    or
    ifconfig

  2. Edit this file /etc/network/interfaces and add the following lines:

    auto ens3:0
    iface ens3:0 inet static
    address {SECONDARY_IP}
    netmask 255.255.255.0
  3. Activate the alias with the following command:
    ifup ens3:0
    Make sure you've 
    ifupdown installed, if it's not installed, you can install it with apt install ifupdown

Please make sure to use the correct device name, whether it's eth0 or ens3 or anything else.


 

FreeBSD

  1. Edit this file /etc/rc.conf and add the following line:

    ifconfig_vtnet0_alias0="{SECONDARY_IP} netmask 255.255.255.0"

    Where {SECONDARY_IP} is your secondary IP Address


  2.  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)

  • IP, secondary IP, Cloud Server, CentOS, Ubuntu, Windows
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Blocked ports on Cloud Servers

The following ports are blocked on all Cloud Server plans: TCP & UDP port 17 TCP & UDP...

Can I use my own ISO?

Yes, with the Upload ISO feature, you can upload your own bootable operating system image, mount...

How to set a rDNS/PTR record for my Cloud Server IP?

You can update rDNS record from cloud server portal. From the navigation menu:Services > My...

How many IPv4 can be assigned to a Cloud Server?

Cloud Servers are delivered with 1 IPv4 and you can add one more IP.

Cloud Servers are Managed?

We offer management plan for cloud servers with an additional fee and it's available to cPanel...