This tutorial explains how to setup an additional IPv4 address on your Vultr VPS. We will assume the following:
1.2.3.4
.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.
The main IPv4 address must be configured manually before adding another IPv4 address.
To configure the main IPv4 manually:
cmd.exe
).ipconfig /all
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 Address, Subnet Mask, Default 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
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:
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
toBOOTPROTO=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
.
Create the file /etc/sysconfig/network-scripts/ifcfg-eth0:1
.
Populate the file with the following contents:
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=1.2.3.5
ONBOOT=yes
Activate the alias with the following command:
ifup eth0:1
Determine the name of your ethernet device. In this example, we'll use eth0
.
ip link show
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
Activate the alias with the following command:
ifup eth0:0
Determine the name of your ethernet device. In this example, we'll use ens3
.
ip link show
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
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. eth0
, ens3
etc... and make sure to modify the example configuration to use the correct interface name and IPs.
Determine the name of your ethernet device. In this example, we'll use ens3
.
ip link show
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
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. eth0
, ens3
etc... and make sure to modify the example configuration to use the correct interface name and IPs.
Add the following lines in /etc/rc.conf
:
ifconfig_vtnet0_alias0="1.2.3.5 netmask 255.255.255.0"
Run the following command to restart networking:
/etc/rc.d/netif restart && /etc/rc.d/routing restart
You could earn up to $300 by adding new articles