Skip to content

VPS: Configure IP Addresses

Learn how to configure and manage primary and additional IP addresses on Debian and Ubuntu systems to optimize your network setup

12 November 20262 min read50 Views0 helpful

Introduction

Would you like to adjust your network configuration and set up additional IP addresses on your Linux VPS?

Configure the primary IP address

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:

Code
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:

Code
sudo service networking restart
Info: systemd-networkd

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:

Code
[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.

Configure additional IP addresses

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:

Code
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.

Tip: Ubuntu with Netplan

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.

Test the 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:

Code
ping <deine_server_ip>

If you configured the IP address correctly, the output should look like this:

Code
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

Conclusion

Congratulations, you have successfully configured your network. If you have any questions or need help, our support team is available every day! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

In the Overview tab of your VPS management panel in the ZapX dashboard.
Edit /etc/network/interfaces, which you can open with 'sudo nano /etc/network/interfaces', and enter your IP address, subnet mask (255.255.255.0), and gateway.
Run 'sudo service networking restart' to activate the new IPv4 address.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.