How to Configure Static IP Address on Ubuntu Server

Usually, when a client system connects to a network via WiFi or an ethernet cable, it automatically picks an IP address from the router. This is made possible through the DHCP server which auto-assigns IP addresses to clients from a pool of addresses.

A Static IP address is recommended for servers as the static address does not change as oppose to a dynamic IP address assignment via DHCP server.

In this guide, We will learn How to Configure a Static IP Address on Ubuntu Server 22.04 | 20.04 LTS with Netplan

Step 1 – Check the name of Network interface

First of all, We need to check the name of Network interface by execute following command below:

ip addr


ip link



Output as below:


From the output, my network interface is ens33 and IP Address as

Step 2 – Configure static IP Address

Go to the /etc/netplan directory and find YAML configure file

cd /etc/netplan


go to YAML file

In this case, my YAML file is 00-installer-config.yaml

Now, open 00-installer-config.yaml file by execute the command below:

sudo vim 00-installer-config.yaml

Open YAML file

Comment default lines and add new content below. Be mindful of the spacing in the YAML file.

 version: 2
 renderer: networkd
   dhcp4: no
    addresses: [,]
    - to: default

Configuration file like below:

Edit YAML file

Save and exit file by press Esc Shift :x Enter

Save and exit file

And run the command below for the change to take effect:

sudo netplan appy

Apply configure

Then finally, you check the new IP address using the command below:

ip addr

Perfect! The IP address has now changed successfully.


Thank you for reading !!!

6 thoughts on “How to Configure Static IP Address on Ubuntu Server

  1. Hello there! I could have sworn I’ve been to this website before but after browsing through a few of the posts I realized it’s new tto me.
    Nonetheless, I’m definitely happy I stumbled upoon it and I’ll be book-marking it and checking back frequently!

  2. Wow, that’s what I was searching for, what a stuff!
    existing here at this blog, thanks admin of this site.

Leave a Reply

Your email address will not be published. Required fields are marked *