Configuring IP addresses on your Linux Dedicated Server 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 no longer reachable because of an incorrect network configuration or a missing internet connection, remote access via SSH may no longer work. Use the HTML5 console in Remote Management 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 this information in the Network tab for your Dedicated Server in the ZapX panel.
Ubuntu installations use Netplan for network configuration. Connect to your Dedicated Server via SSH and find 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 Dedicated Server via SSH and open the network interfaces file:
nano /etc/network/interfaces
Add or adjust 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 network interfaces on the system along with their current configuration details. Find the interface you configured in the output. Depending on your system, it is usually named eth0, ens18, or something similar.
In the interface section, you will find the inet entry, which shows the assigned IPv4 address. The output should include the static IP address you configured. For example:
inet 109.230.238.45/24
If the correct address is displayed, the static IP configuration was applied successfully. If the new IP address does not appear, check the configuration file again and make sure the changes were saved correctly before applying the configuration again.
