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.
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.
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.
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:
nano /etc/netplan/50-cloud-init.yaml
Adjust the configuration to define a static IP address:
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:
sudo netplan apply
Debian often uses the network interfaces configuration file instead of Netplan. Connect to your VPS via SSH and open the network interfaces file:
nano /etc/network/interfaces
Add or update the configuration for your network interface. Example configuration:
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:
systemctl restart networking
After applying the configuration, check that the new IP address has been applied correctly. Run the following command in the terminal:
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:
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:
sudo netplan apply
