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
.
- 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
![](https://livestream.puntenel.nl/wp-content/uploads/sites/14/2023/04/setstatic1.jpg)
To apply the new Netplan changes, execute:
sudo netplan apply
Alternatively, if you run into some issues run:
sudo netplan --debug apply