Add a Secondary IPv4 Address to Your VPS

This tutorial explains how to setup an additional IPv4 address on your Vultr VPS. We will assume the following:

  • The Main IP Address of your VPS is 1.2.3.4.
  • You have purchased an additional IP address through the Vultr control panel, and you were assigned 1.2.3.5.

After purchasing an additional IPv4 address you must restart the VPS using the “Server Restart” feature from within the Vultr control panel. This must be done regardless of the installed operating system.

Each example below will configure the secondary IP address to become automatically available, and remain configured even after your server is rebooted. You can test if the IP address is configured by pinging it with the ping utility on your client computer.

Windows Server 2012

The main IPv4 address must be configured manually before adding another IPv4 address.

To configure the main IPv4 manually:

  1. Open a Command Prompt (cmd.exe).
  2. Type: ipconfig /all
  3. There will be a page or two of output. Find the page that has information about your primary ethernet adapter, which is typically “Ethernet adapter Ethernet 2”. Write down the values for IPv4 AddressSubnet MaskDefault Gateway, and DNS Servers.Ethernet adapter Ethernet 2: Connection-specific DNS Suffix . : Physical Address. . . . . . . . . : 00-00-00-00-00-00 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 1.2.3.4(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.254.0 Default Gateway . . . . . . . . . : 1.2.3.1 DNS Servers . . . . . . . . . . . : 108.61.10.10 NetBIOS over Tcpip. . . . . . . . : Enabled
  4. Open the windows control panel. You can access it from the start menu.
  5. Click “Network and Internet”.
  6. Click “Network and Sharing Center”.
  7. Click “Change adapter settings”.
  8. Right click on the primary ethernet adapter, and click “Properties”. The “Ethernet Properties” window will open.
  9. Select “Internet Protocol Version 4 (TCP/IPv4)”, then click the “Properties” button. The “Internet Protocol Version 4 (TCP/IPv4) Properties” window will open.
  10. Check the box that reads “Use the following IP address:”. Populate the fields beneath it with the values you wrote down earlier.
  11. Check the box that reads “Use the following DNS server addresses:”. Populate the fields beneath it with the values you wrote down earlier. If you only have one DNS server, leave “Alternate DNS server” empty.
  12. Click “OK”. Then click “OK” on the “Ethernet Properties” window. The main IPv4 has been configured manually. Note that it is normal for the connection to hiccup after pressing “OK”.

Add secondary IPv4 using cmd.exe:

 netsh interface ipv4 add address "Ethernet" 1.2.3.5 255.255.255.0

Add secondary IPv4 using a remote login:

  1. Open the windows control panel. You can access it from the start menu.
  2. Click “Network and Internet”.
  3. Click “Network and Sharing Center”.
  4. Click “Change adapter settings”.
  5. Right click on the primary ethernet adapter, and click “Properties”. The “Ethernet Properties” window will open.
  6. Select “Internet Protocol Version 4 (TCP/IPv4)”, then click the “Properties” button. The “Internet Protocol Version 4 (TCP/IPv4) Properties” window will open.
  7. Click “Advanced…”. The “Advanced TCP/IP Settings” window will open.
  8. In the “IP addresses” group, click “Add…”. The “TCP/IP Address” window will open.
  9. Fill in the “IP address” and “Subnet mask” boxes. Use “1.2.3.5” for the IP address and “255.255.255.0” as the subnet mask.
  10. Click “Add”. The “TCP/IP Address” window will close.
  11. Click “OK” on the “Advanced TCP/IP Settings” window. This window will close.
  12. Click “OK” on the “Internet Protocol Version 4 (TCP/IPv4) Properties” window. This window will close.
  13. Click “OK” on the “Ethernet Properties” window. This window will close, and your secondary IP address will be configured.

CentOS 6

  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:
    • Open /etc/sysconfig/network-scripts/ifcfg-eth0 in a text editor.
    • Change BOOTPROTO=dhcp to BOOTPROTO=static.
    • Add these lines at the end of the file. Substitute “[mainip]“, “[netmask]“, and “[gateway]” with the values from the “IPv4” tab on your Vultr control panel. IPADDR=[mainip] NETMASK=[netmask] GATEWAY=[gateway]
    • Run ifup eth0.
  2. Create the file /etc/sysconfig/network-scripts/ifcfg-eth0:1.
  3. Populate the file with the following contents:DEVICE=eth0:1 BOOTPROTO=static IPADDR=1.2.3.5 ONBOOT=yes
  4. Activate the alias with the following command:ifup eth0:1

Ubuntu

  1. Determine the name of your ethernet device. In this example, we’ll use eth0.ip link show
  2. Add the following lines in /etc/network/interfaces:auto eth0:0 iface eth0:0 inet static address 1.2.3.5 netmask 255.255.255.0
  3. Activate the alias with the following command:ifup eth0:0

Ubuntu 16.x

  1. Determine the name of your ethernet device. In this example, we’ll use ens3.ip link show
  2. Add the following lines in /etc/network/interfaces:auto ens3:0 iface ens3:0 inet static address 1.2.3.5 netmask 255.255.255.0
  3. Activate the alias with the following command:ifup ens3:0

Please note: You need to make sure your interface name matches that of the example: e.g. eth0ens3 etc… and make sure to modify the example configuration to use the correct interface name and IPs.

Ubuntu 18.04 LTS

  1. Determine the name of your ethernet device. In this example, we’ll use ens3.ip link show
  2. Create /etc/netplan/60-secondary-ip.yaml:network: version: 2 renderer: networkd ethernets: ens3: addresses: - 1.2.3.4/32 - 1.2.3.5/32
  3. Activate the alias with the following command:netplan try

Please note: You need to make sure your interface name matches that of the example: e.g. eth0ens3 etc… and make sure to modify the example configuration to use the correct interface name and IPs.

FreeBSD 10

  1. Add the following lines in /etc/rc.conf:ifconfig_vtnet0_alias0="1.2.3.5 netmask 255.255.255.0"
  2. Run the following command to restart networking:/etc/rc.d/netif restart && /etc/rc.d/routing restart