Knowledge Base

Set a static IP address on Ubuntu server 22.04

In this example, we will set a static IP address on the Ubuntu 22.04 server to 192.168.1.202/24 with default gateway to 192.168.1.1 and DNS servers 8.8.8.8, 8.8.4.4, and 192.168.1.1.

  1. Locate and edit with administrative privileges the /etc/netplan/01-network-manager-all.yaml file with the following configuration. Update your desired static IP address, DNS server and gateway where appropriate.
sudo nano /etc/netplan/01-network-manager-all.yaml

To apply the new Netplan changes, execute:

sudo netplan apply

Alternatively, if you run into some issues run:

sudo netplan --debug apply
Table of Contents