Skip to content

VPS: IP Configuration (Ubuntu/Debian)

Learn how to configure a static IP address on a Linux server running Ubuntu or Debian

12 November 20263 min read39 Views0 helpful

Introduction

Configuring IP addresses on your Linux VPS lets you control how your server communicates over the network. This includes assigning IP addresses, defining the default gateway, and setting up the DNS servers required for network connectivity.

Warning: Can't reach your server because it has no internet connection?

If your server is unreachable due to an incorrect network configuration or lack of internet connectivity, remote access via SSH may no longer work. Use the Console tab in your ZapX dashboard to connect to your server and correct the network configuration.

Preparation

Before configuring a static IP address, make sure you have the following information ready:

  • The IP address you want to assign
  • Subnet mask
  • Default gateway
  • DNS servers

You can find your assigned IPv4 address (including the prefix, e.g. /24) in your ZapX dashboard: open your VPS and switch to the Overview tab. The IP Addresses card shows your primary and, if applicable, additional IPv4 addresses. For ZAP-Hosting VPSs, the gateway is usually the .1 address of your assigned network (see the example below). You can use any public resolver as your DNS server, such as 1.1.1.1 and 8.8.8.8.

Configuration

Ubuntu

Ubuntu installations use Netplan for network configuration. Connect to your VPS via SSH and locate the Netplan configuration file in the /etc/netplan/ directory. Open the configuration file:

bash
nano /etc/netplan/50-cloud-init.yaml

Adjust the configuration to define a static IP address:

Code
network:
  version: 2
  ethernets:
    eth0:
      match:
        macaddress: "bc:24:11:5f:5c:34"
      addresses:
      - "109.230.238.45/24"
      nameservers:
        addresses:
        - 8.8.8.8
        - 1.1.1.1
      set-name: "eth0"
      routes:
      - to: "default"
        via: "109.230.238.1"

Adjust the following values to match your network configuration:

  • 109.230.238.45 → Your static IP address
  • 109.230.238.1 → Your gateway
  • DNS addresses → Your preferred DNS servers

Save the file and apply the configuration:

Code
sudo netplan apply

Debian

Debian often uses the network interfaces configuration file instead of Netplan. Connect to your VPS via SSH and open the network interfaces file:

Code
nano /etc/network/interfaces

Add or update the configuration for your network interface. Example configuration:

bash
auto lo
iface lo inet loopback

# Die primäre Netzwerkschnittstelle
allow-hotplug ens18
iface ens18 inet static
        address 134.255.219.160/24
        gateway 134.255.219.1
        # dns-* Optionen werden vom resolvconf-Paket umgesetzt, falls installiert
        dns-nameservers 1.1.1.1

Adjust the values to match your network configuration:

  • address → Your static IP address
  • netmask → Your subnet mask
  • gateway → Your default gateway
  • dns-nameservers → Your preferred DNS servers

After saving the configuration file, restart the network service:

Code
systemctl restart networking

Verification

After applying the configuration, check that the new IP address has been applied correctly. Run the following command in the terminal:

Code
ip a

This command displays all the system's network interfaces and their current configuration details. Find the interface you configured in the output. Depending on the system, it is usually named eth0, ens18, or something similar.

In the interface section, you'll find the inet entry, which shows the assigned IPv4 address. The output should include the static IP address you configured earlier. For example:

Code
inet 109.230.238.45/24

If the correct address is shown, the static IP configuration has been applied successfully. If the new IP address does not appear, check the configuration file again and make sure your changes were saved before applying the configuration again with the following command:

Code
sudo netplan apply

Conclusion

Congratulations! You've successfully configured your IP address on your Linux server. If you have any questions or run into any issues, our support team is available every day and will be happy to help! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

Use the Console tab in your ZapX dashboard to connect to the server and correct the network configuration.
In your VPS's ZapX dashboard, open the Overview tab and check the IP Addresses card. For ZAP-Hosting VPSs, the gateway is usually the .1 address of your assigned network.
Ubuntu uses Netplan. Edit the configuration file in the /etc/netplan/ directory (e.g. 50-cloud-init.yaml) and enter your IP address, gateway, and DNS servers.

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.