How to Configure a Static IP Address on Ubuntu Server

Published March 20, 2025
How to Configure a Static IP Address on Ubuntu Server
Cheap Dedicated Server

How to Configure a Static IP Address on Ubuntu Server


 

Setting up a static IP address on your Ubuntu Server is crucial for maintaining network stability, ensuring uninterrupted remote access, and avoiding conflicts with dynamic IP changes. In this guide, we’ll walk you through the steps to configure a static IP on Ubuntu Server.

Step 1: Identify Network Interface

First, determine the network interface you want to configure. Run the following command:

ip a

Look for your primary network adapter, usually named eth0, ens33, or similar.

Step 2: Edit the Netplan Configuration

Ubuntu Server uses Netplan for network configuration. Edit the Netplan file using:
Edit the Netplan Configuration

sudo nano /etc/netplan/00-installer-config.yaml

Modify or add the following lines, replacing the values with your desired IP settings:
Modify or add the following lines

network:
  ethernets:
    ens33:
      dhcp4: no
      addresses:
        - 192.168.1.100/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4
  version: 2

Replace ens33 with your network interface name and adjust the IP addresses accordingly.

Step 3: Apply Changes

Save the file and apply the new configuration with:
Apply Changes

sudo netplan apply

To verify, run:

ip a

Step 4: Test Connectivity

Test the static IP configuration with:

ping -c 4 8.8.8.8

If everything is set up correctly, your Ubuntu Server should now be using a static IP address.


 

 

Windows Server Update Services (WSUS): A Complete Guide
(F.A.Q)

 

Why should I use a static IP on Ubuntu Server?

A static IP ensures network consistency, crucial for services like SSH, web hosting, and file sharing.

 

How do I find my current IP address?

Use the command ip a or hostname -I to check your current IP.

What should I do if I lose network access after applying changes?

Check the Netplan file syntax with sudo netplan try before applying changes. If an issue arises, revert the changes by editing the file again.

 

Can I use a static IP alongside DHCP?

Yes, but it’s generally recommended to disable DHCP for the specific interface where you set a static IP.