
The internet we use to connect, explore, create, and share is built on IP communication. There are times when we can’t rely on automatic addressing for various reasons. In this post, we will go through how to set a static IP address configuration on Ubuntu. Covering both graphical and command line options for setting a static IP address.
Where Do I Get/Assign A Static IP?
If this isn’t your network, you will want to have an IP address assigned by the network administrator. You will need the following IP address, Subnet/Prefix, Gateway, and at least one DNS server.
If this is your network it is recommended to use an IP address not part of the DHCP Server pool. If you don’t you could run into an issue where two devices are trying to use the same IP address resulting in issues.
Ubuntu Desktop
Netplan was introduced in Ubuntu 18.04 and has been included in releases since. On desktop installations, Netplan will get configured to use Network Manager. This is to ensure that Network settings can be configured via Gnome Desktop.

Graphical Interface
First, open Gnome Settings this can be done one of two ways:
- Option 1: In gnome click on the network icon in the status bar and then click on the gear icon (Something Close to this: ⚙).
- Option 2: Hit the meta key (The Key with Tux or Windows Icon on it) type settings and click on settings
- Once in settings, we will be focusing on the Wi-Fi or Network tabs, this is dependent on if you want to set a static IP for a wireless connection or a wired connection.

- Once on one of those two pages we are looking for a connected interface and will click the ⚙ icon.

- It will open a new window which will be on the Details tab. This tab shows the current IP information which you should take a screenshot or note down in case you need to revert.

To Configure
- To configure a static IP address click on the corresponding tab for IPv4 or IPv6 networking.
Note: An IPv4 address will have dots (.) whereas an IPv6 address will have colons (:)
- From there select manual

- Enter the IP information and click apply.

- Now toggle the connection off and back on the connection and that’s it for changing network settings from gnome settings.

From Command Line
If you want to edit the network manager configuration from the command line the tool you want is nmtui. Nmtui is a command-line interface you will want to use to start running the following command:
nmtui
This will open up the following interface. Use Using arrow keys and enter to navigate.

Select edit a connection and press enter:

Highlight the connection you want to edit, and use the right arrow key to select edit and click enter.

To manually set an IP select <automatic> next to the desired IP version and click enter.

Select Manual and click enter.

Now Navigate to the show button for the desired IP version and click enter.

This is the page where you will enter the status IP information. Once everything is entered navigate to the <OK> and click enter.
To apply go back to the screen we started with and select activate a connection.

Highlight the connection you just edited deactivate and activate it again.
If you encounter any issues verify the information is accurate and bounce the interface again.
Ubuntu Server
On modern Ubuntu Server installations, Netplan will be in use. The Netplan configuration files are located in /etc/netplan/. The configuration files are in yaml and will end with .yaml
First, To Check What Is Configured
Before we can configure Netplan we need to have an interface name.
To get the interface name use the following command to see the available network interfaces.
ip addr
You will see something the like following:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether e6:2f:ce:c4:16:5d brd ff:ff:ff:ff:ff:ff altname enp0s18 inet 192.0.2.172/24 brd 192.0.2.255 scope global ens18 valid_lft forever preferred_lft forever
In this case, we can see the active interface is ens18, also it’s good practice to the IP information before making changes in case you need to revert.
This template is the configuration you will use for a physically connected network interface.
network:
version: 2
ethernets:
interface:
addresses:
- IP/prefix
nameservers:
addresses:
- DNS1
- DNS2
routes:
- to: default
via: gateway
- Replace Replace IP/prefix with the IP and Network Prefix for example: 198.51.100.112/24
- Replace the interface with the correct interface name for example: ens18
- Replace nameservers DNS1 and DNS2 with valid DNS Servers for example: 1.1.1.1 and 1.0.0.1
- Replace the gateway with the IP of the default Gateway for example: 198.51.100.112
To try the configuration before applying use the following command:
sudo netplan try
To apply without trying use:
sudo netplan apply
Conclusion
We have covered how to configure a static IP on an Ubuntu desktop using Gnome settings and nmtui. We also covered using Netplan directly. However, preparation is needed from a reserved IP address and the network information.
Additional Links
- Other Ubuntu Posts
- Ubuntu Desktop Docs
- Ubuntu Server Network Configuration Docs
- Netplan Offical Documentation

Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.
Leave a Reply