Would you like to adjust your network configuration and set up additional IP addresses on your Linux VPS?
This section explains how to define and configure the primary IP address. You can find your assigned IP address, subnet mask, and gateway in the Overview tab of your VPS management panel.
On Debian systems with the traditional network configuration, this is done through the network interfaces. Open the network configuration with the command sudo nano /etc/network/interfaces. By default, the network configuration should look like this:
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address XXX.XXX.XXX.XXX
netmask 255.255.255.0
gateway XXX.XXX.XXX.1
If this content is not already present, add it as shown. Replace the IP address placeholder (XXX.XXX.XXX.XXX) with your server's IP address, which you can find in the Overview tab of your server management panel. Use 255.255.255.0 as the subnet mask (Class C network) and make sure the gateway's last octet is 1.
Save the changes with CTRL+X and press Enter to confirm. You now need to restart the network service to activate the new IPv4 address. Run the following command:
sudo service networking restart
Some distributions/images use the newer systemd-networkd instead of /etc/network/interfaces. In that case, a suitable configuration file (for example, under /etc/systemd/network/) looks like this:
[Match]
Name = eth0
[Network]
Description = Interface eth0 autoconfigured by PVE
Address = 185.223.31.234/24
Gateway = 185.223.31.1
DHCP = no
IPv6AcceptRA = false
Use the values shown, adjusted to match your own IP address and gateway, then restart the service with sudo systemctl restart systemd-networkd.
If you have ordered additional IP addresses for your VPS, you can also find them in the Overview tab of your server management panel. To set up an additional IP address on a Debian system with the traditional network configuration, add another entry for a virtual interface (for example, eth0:1) in the same /etc/network/interfaces file:
allow-hotplug eth0:1
iface eth0:1 inet static
address XXX.XXX.XXX.XXX
netmask 255.255.255.0
gateway XXX.XXX.XXX.1
Here too, replace XXX.XXX.XXX.XXX with the additional IP address shown in your server overview. The gateway stays the same as the one for your primary IP address. Save the file and restart the network as described above with sudo service networking restart.
If your VPS runs Ubuntu with Netplan instead of the traditional /etc/network/interfaces configuration, see our IP Configuration (Ubuntu/Debian) article for detailed instructions and a sample configuration.
To check that a configured IP address is correct and working, you can run a ping test. For example, you can do this on your own computer by opening the Command Prompt (cmd.exe) and running the following command:
ping <deine_server_ip>
If you configured the IP address correctly, the output should look like this:
Pinging XXX.XXX.XXX.XX with 32 bytes of data:
Reply from XXX.XXX.XXX.XX: bytes=32 time=25ms TTL=56
Reply from XXX.XXX.XXX.XX: bytes=32 time=22ms TTL=56
Reply from XXX.XXX.XXX.XX: bytes=32 time=22ms TTL=56
Reply from XXX.XXX.XXX.XX: bytes=32 time=23ms TTL=56
Ping statistics for XXX.XXX.XXX.XX:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 22ms, Maximum = 25ms, Average = 23ms