Skip to main content

VPS: IP Configuration (Ubuntu/Debian)

The ideal products for this guide

Get started right away — order the matching product and follow this guide step by step.

Introduction

Configuring IP addresses on your Linux VPS allows you to control how your server communicates within the network. This includes assigning IP addresses, defining the default gateway, and configuring DNS servers required for network connectivity.

Server unreachable due to missing internet connection?

In case your server becomes unreachable due to an incorrect network configuration or missing internet connection, remote access via SSH may no longer work. Use the VNC console in the web interface to connect to your server and fix the network configuration.

Preparation

Before configuring a static IP address, ensure you have the following information available:

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

This information can be found in the web interface. To do this, open your VPS management and navigate to IP addresses.

Configuration

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

Modify 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

Verification

After applying the configuration, it is recommended to verify that the new IP address has been applied correctly. To do this, run the following command in your terminal:

ip a

This command displays all network interfaces available on the system along with their current configuration details. In the output, locate the interface that was configured earlier, usually named eth0, ens18, or a similar identifier depending on the system.

Within the interface section, look for the inet entry, which represents the IPv4 address assigned to the interface. The output should contain the static IP address you configured earlier. For example:

inet 109.230.238.45/24

img

If the correct address appears in the output, the static IP configuration has been successfully applied. If the new IP address does not appear, verify the configuration file again and ensure that the changes were saved correctly before reapplying the configuration with:

sudo netplan apply

Conclusion

Congratulations! You have successfully configured your IP address on your Linux server. For further questions or assistance, please don’t hesitate to contact our support team, which is available daily to assist you! 🙂