How to Configure Static IP Address on Ubuntu 22.04 LTS and 22.10
Switching from dynamic IP allocation to static IP addresses is easy on Ubuntu 22.04 "Jammy Jellyfish" and 22.10.
The IP address of most devices today is generated by the Dynamic Host Configuration Protocol (DHCP) server. A DHCP server assigns a dynamic IP address to your device when it's connected to a network. Thus, you have the chance to change this IP address from time to time.
On the other hand, a static IP refers to a fixed, immutable address, different from dynamic IPs. You can set static IP settings for Ubuntu versions 22.04 LTS and 22.10 in three different ways. Here's how to get started.

Set a Static IP on Ubuntu With the nmcli Command
It's pretty easy to configure Ubuntu 22.04 static IP settings using the nmcli command . nmcli is a text-based utility used to check the status of the wired connections you are using on your device.
With this command, you can access additional networking information such as your connection status, the name of your host device, and general permissions in your network configuration. Also, this command is very useful in your Ubuntu server static IP settings.
You can get information about your connection with the following command:
The output of this command will be as follows:
Create a static link with the command given below. Then, manually configure the enp0s3 and ipv4 settings with the appropriate parameters in the nmcli command:
If you use the nmcli connection show command again, you can see that the static link has been added.
After this process, add the static connection you created to the DNS IP:
Now use the command below to activate the connection:
If the output displays "connection successfully activated," you've successfully set up a static IP address on your machine.
You can consider using static IP addresses to avoid connection problems caused by dynamic IP addresses. A static IP address allows you to have a fixed identity and location when connected to the internet.
You can verify the static IP you want to assign to your device by running the following command:
Using Netplan for Static IP Settings on Ubuntu
Just like nmcli, another command you can use for setting a static IP on Ubuntu is netplan. You can easily make Ubuntu static IP settings using the netplan command in 22.04 LTS and 22.10 versions. To do this, follow the steps below.
First, find out the name of your network interface using the command below:
What you see here is your network interface name. This name may be different on each device.
Now, create a file named 01-netcfg.yaml in the /etc/netplan folder. Edit it with your favorite text editor.
Add the following lines to the file:
As you can see, you have disabled the DHCP IP setting with the dhcp4: no statement. You've then added the IP address and DNS settings assigned by Google.
After saving this file, run the following command to apply the changes:
Configure Static IP Settings on Ubuntu Graphically
The graphical network interface in Ubuntu 22.04 is quite useful if you don't want to use the command line. So much so that you can easily set the Ubuntu static IP address using this interface.
To do this, click on the Network icon in the upper right corner of your desktop. Then, select Wired Settings from the drop-down menu. Click on the Gear icon to open the settings window.
Then, switch to the IPv4 tab in the window that opens.
As you can see, DHCP is enabled by default. Change the IPv4 Method to Manual as you want to use a static IP instead of a dynamic one. Next, change your address, netmask, and gateway settings. Finally, modify your DNS setting and click the Apply button.
You must restart this wired connection for all these actions to take effect. To do this, simply toggle the switch next to the network name on and then off.
Why Should You Use Static IP Addresses?
You learned how to configure static IP settings in "Jammy Jellyfish" 22.04, the latest LTS version of Ubuntu, and 22.10, using both the graphical settings interface and the two terminal commands: nmcli and netplan. Also, now you know how to set a static IP on Ubuntu server 22.04.
Due to insufficient IP addresses, some service providers may assign the same address to two different users. In this case, connection problems can occur. Using static IP addresses instead does not cause such problems as it is user-specific, but beware as someone can misuse your IP address in several ways.
How to Set a Static IP Address On Ubuntu 22.04
The first task anyone would do after installing Ubuntu is setting an IP address to a system to connect to the network/internet. If the Wi-Fi router, ISP, or network doesn’t provide DHCP services, you must manually assign IP addresses.
Here, we will see how to set a static IP Address on Ubuntu 22.04, using,
- GNOME Control Center
- NetworkManager
You can use any method to set a static IP address on Ubuntu 22.04.
Find Network Interfaces on Ubuntu 22.04
You can run any of the below commands in a terminal to get a list of network interfaces available on the system.
The output of the ifconfig command on a desktop:
Here, we will see how to configure a static IP for enp0s3 (Wired) / wl01 (Wi-Fi).
IP Address : 192.168.0.10 Netmask : 255.255.255.0 Gateway : 192.168.0.1 DNS Server 1 : 192.168.0.1 DNS Server 2 : 8.8.8.8 Domain Name : itzgeek.local
Set Static IP Address on Ubuntu 22.04 Desktop
1. using gnome network manager.
Using the GNOME network control center to set a static IP address on In Ubuntu 22.04 desktop is straightforward.
Set IP for Wired Interface using GNOME
Open the Gnome control center using the gnome-control-center network command or go to Activities >> Settings >> Network .
Click on the gear icon on the Wired interface page and then IPv4 tab >> Manual >> Enter IP address, Netmask, Gateway, DNS (Toggle to disable Automatic DNS configuration) >> Apply .
Finally, use the toggle in the Network page to disable and enable the network interface to apply the IP address.
Set IP Address for Wi-Fi using GNOME
Click on your Wifi router name and then enter the router’s password to connect. Your laptop will automatically receive an IP address from a Wi-Fi router with a built-in DHCP service on a successful connection.
To assign a static IP address or Wi-Fi interface, click on the gear icon on the Wi-Fi interface page and then IPv4 tab >> Manual >> Enter IP address, Netmask, Gateway, DNS (Toggle to disable Automatic DNS configuration) >> Apply .
Finally, disable and enable the Wi-Fi interface to apply the IP address.
2. Using Netplan
Netplan is a utility for easily configuring networking on a Ubuntu system. It reads the configuration files .yaml present in the /etc/netplan directory.
3. Using NetworkManager CLI
Set ip for wired interface using nmcli.
First, let us list the available network connections.
Then, configure static IP address to wired interface.
Finally, run the below commands to apply the IP address.
Set IP Address for Wi-Fi using nmcli
First, list the available Wi-Fi access points using the below command.
Next, connect to the Wi-Fi access point.
Finally, run the below commands to apply the IP address
Set Static IP Address Using NetPlan on Ubuntu 22.04 Server
Netplan is a network configuration utility that reads YAML files and generates all network configurations for the renderer tool (NetworkManager or networkd) to configure the network on a system.
Netplan configuration files are found in the /etc/netplan/ directory.
Set IP for Wired Interface using Netplan
Now, create a new netplan configuration for the wired network interface.
Then, make changes to the below information and use it for your requirement.
Finally, apply all network configurations and restart renderers.
Set IP Address for Wi-Fi using Netplan
Wi-Fi Interface Name : wl01 Wireless Access Point Name : Raj Wireless Access Point Password : MyPass
First, create a new netplan configuration for the wired network interface.
And then generate the required configuration for the renderers.
Verify Static IP Address on Ubuntu 22.04
Verify the static IP address using the below commands.
Also, verify the DNS server’s entries.
That’s All.
How to Install Brave Browser on Fedora 36 / Fedora 35
How to Install phpMyAdmin with Nginx on Ubuntu 22.04
How to Install MySQL on Ubuntu 22.04
How to Install Cacti on Ubuntu 22.04
How to Install pgAdmin on Ubuntu 22.04 / Ubuntu 20.04
How to Set up DNS Server on Ubuntu 22.04 / Ubuntu 20.04
How to Install PostgreSQL on Ubuntu 22.04
How to Install Plex on Ubuntu 22.04

- CentOS 8 / RHEL 8
- CentOS 7 / RHEL 7
- CentOS 6 / RHEL 6
- LinuxMint 20
- Linux Mint 19
- Linux Mint 18
- Rocky Linux 8
- Ubuntu 22.04
- Ubuntu 20.04
- Ubuntu 18.04
- MySQL / MariaDB
- Other Tools
- Buying Guides
Complete Guides by How-To Geek
Our latest product roundups, reader favorites, more from how-to geek, latest geek news, latest reviews, across lifesavvy media.
Join 425,000 subscribers and get a daily digest of news, geek trivia, and our feature articles.
By submitting your email, you agree to the Terms of Use and Privacy Policy .
How to Set a Static IP Address in Ubuntu
Dave McKay first used computers when punched paper tape was in vogue, and he has been programming ever since. After over 30 years in the IT industry, he is now a full-time technology journalist. During his career, he has worked as a freelance programmer, manager of an international software development team, an IT services project manager, and, most recently, as a Data Protection Officer. His writing has been published by howtogeek.com, cloudsavvyit.com, itenterpriser.com, and opensource.com. Dave is a Linux evangelist and open source advocate. Read more...
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work. Read more...

Your home network relies on IP addresses to route data between devices, and sometimes on reconnecting to the network a device’s address can change. Here’s how to give an Ubuntu Linux computer a permanent IP address that survives reboots.
Dynamic and Static IP Addresses Setting a Static IP Address in Ubuntu Using the GNOME Desktop and Applications Connection Convenience
Dynamic and Static IP Addresses
Everything on your network home network, whether it’s using a wired connection or Wi-Fi, has an IP address . IP stands for Internet Protocol. An IP address is a sequence of four numbers separated by three dots. Each IP address that is unique within that network.
IP addresses act as numeric labels. Your router uses these labels to send data between the correct devices. Usually, your router assigns IP addresses. It knows which IP addresses are in use and which are free. When a new device connects to the network, it requests an IP address and the router allocates one of the unused IP addresses. This is called DHCP, or dynamic host configuration protocol .
When a device is restarted or powered off and on, it may receive its old IP address once more, or it might be allocated a new IP address. This is normal for DHCP and it doesn’t affect the normal running of your network. But if you have a server or some other computer that you need to be able to reach by its IP address, you’ll run into problems if its IP address doesn’t survive power downs or reboots.
Pinning a specific IP address to a computer is called allocating a static IP address . A static IP address, as its name suggests, isn’t dynamic and it doesn’t change even if the computer is power-cycled .
Setting a Static IP Address in Ubuntu
We’re demonstrating this technique on Ubuntu, but it ought to work on any Linux distribution. The nmcli network manager tool was released in 2004, so it should be present on just about any standard distribution.
Let’s take a look at the network connections that already exist on the computer. We’re using the connection command with the show argument.
This displays some information about each connection. We only have a single connection configured.
The output is wider than the terminal window. This is the information that we’re shown.
- Name : Our network connection is called “netplan-enp0s3.”
- UUID : The universally unique identifier Linux uses to reference this connection internally.
- Type : This is an ethernet connection.
- Device : This connection is using the “enp0s3” network interface. It’s the only network card in this computer.
We can use the ip command to discover the IP address this computer is using.
In the output we can see the “enp0s3” entry, and its current IP address, 192.168.86.117. The “/24” is a shorthand way of saying that this network uses a 255.255.255.0 subnet mask . Take a note of this number, we’ll need to use it later.
We need to choose the IP address we’re going to set as our static IP address. Obviously, you can’t use an IP address that is already in use by another device. One safe way to proceed is to use your current IP address. We know for certain that nothing else is using that IP address.
If we want to use a different IP address, try pinging it. We’re going to test whether IP address 192.168.86.128 is in use. If everything else on your network uses DHCP and you get no response to the ping command, it should be safe to use.
Even if another device had previously used that IP address, it’ll be given a new IP address when it next boots up. Nothing is responding to the ping requests. We’re clear to go ahead and configure 192.168.86.128 as our new static IP.
We also need to know the IP address of your default gateway , which will usually be your broadband router. We can find this using the ip command and the route option, which we can abbreviate to “r.”
The entry that starts with “default” is the route to the default gateway. Its IP address is 192.168.86.1. Now we can start to issue commands to set up our static IP address.
The first command is a long one.
Taken in small chunks, It’s not as bad as it looks. We’re using sudo . The nmcli arguments are:
- con : Short for “connection.”
- add : We’re going to add a connection.
- con-name “static-ip” : The name of our new connection will be “static-ip.”
- ifname enp0s3 : The connection will use network interface “enp0s3.”
- type ethernet : We’re creating an ethernet connection.
- ip4 192.168.86.128/24 : The IP address and subnet mask in classless inter-domain routing notation . This is where you need to use the number you took a note of earlier.
- gw4 192.168.86.1 : The IP address of the gateway we want this connection to use.
To make our connection a functioning connection, we need to provide a few more details. Our connection exists now, so we’re not adding anything, we’re modifying settings, so we use the mod argument. The setting we’re changing is the IPv4 DNS settings. 8.8.8.8 is the IP address of Google’s primary public DNS server , and 8.8.4.4 is Google’s fallback DNS server.
Note that there is a “v” in “ipv4.” In the previous command the syntax was “ip4” without a “v.” The “v” needs to be used when you’re modifying settings, but not when adding connections.
To make our IP address static, we need to change the method which the IP address obtains its value. The default is “auto” which is the setting for DHCP. We need to set it to “manual.”
And now we can start or “bring up” our new connection.
We didn’t get any error messages which is great. Lets use nmcli to look at our connections once more.
Here’s the output:
Our static-ip connection is active and using device “enp0s3.” The existing connection “netplan-enp0s3” is no longer associated with a physical network interface because we’ve pinched “enp0s3” from it.
Using the GNOME Desktop and Applications
Click the icons at the far-right end of the system bar to show the system menu, then click on the “Wired Connected” menu option. If you’re using a wireless connection, instead click the name of your Wi-Fi network.
The available connections are displayed. A dot indicates which is in use. Our new connection is the active connection. Click the “Wired Settings” or “Wi-Fi Settings” menu option.
The details of the active connection are displayed. We can see our new “static-ip” connection has the IP address, default gateway, and DNS servers that we set for it. You can swap between the available connections by clicking directly on their names.
Click the cog icon to enter the settings for the “static-ip” connection.
A dialog box opens. Click on the “IPv4” tab.
Because we set our new IP address to be static, the “Manual” radio button is selected. You could change this back to DHCP by selecting the “Automatic (DHCP)” radio button, and clicking the green “Apply” button.
To create a new connection using the “Settings” application, click the “ + ” icon on the “Networks” page, above the list of wired connections.
A dialog appears. We need to provide a name for this connection.
We’re calling our new connection “static-2.” Click the “IPv4” tab.
Select the “Manual” radio button, and complete the “Address”, “Netmask”, and “Gateway” fields. Also complete the DNS field, and then click the green “Apply” button. Note the comma between the DNS entries.
Our new connection is listed in the “Wired” connections pane.
RELATED: How to Assign a Static IP Address in Windows 10 or 11
Connection Convenience
Using the nmcli command or the GNOME desktop and apps, you can hop between network connections very easily and very quickly.
It’s more convenient to have a selection of connection profiles and move between them as you need to, rather than to have one that you keep editing. If something goes horribly wrong with the connection you’re editing or adding, you can always fall back on one of the existing connections.
RELATED: How to Use bmon to Monitor Network Bandwidth on Linux
- › How to Find Your IP Address on a Windows 10 PC
- › How to Assign a Static IP Address in Windows 10 or 11
- › How to Change Your IP Address
- › How to Find Your IP Address on Windows 11
- › How to Get Your Public IP in a Linux Bash Script
- › How to Win $2000 By Learning to Code a Rocket League Bot
- › How to Watch UFC 285 Jones vs. Gane Live Online
- › Dear Advertisers, I Already Bought It
How to Set Static IP Address on Ubuntu Server 22.04
In this post, we will cover how to set static ip address on Ubuntu server 22.04.
It is highly recommended to have a static ip on linux server because it would be persistent across the reboot. Static IP plays an important role for servers like Mail Server, Web Server and File server etc.
Prerequisites
- Minimal Installed Ubuntu Server 22.04
- Regular User with sudo admin rights
In Ubuntu server 22.04, networking is controlled by netplan utility , so we will use netplan to configure static ip address on Ubuntu server.
Note: we cannot use nmcli utiltity as it is not the part of default installation on Ubuntu server.
Setting up Static IP address on Ubuntu Server 22.04
Login to your Ubuntu server 22.04, look for the netplan configuration file. It is located under /etc/netplan directory.
Run below cat command to view the contents of ‘00-installer-config.yaml’
Note: Name of configuration file may differ as your per setup. As it is an yaml file, so make sure to maintain the indentation and syntax while editing.
As per above output, it says that we have ens33 interface and it is getting ip from dhcp server. Alternate way to view interface name is via ip command.
Now, to configure static ip in place of dhcp, edit netplan configuration file using vi or nano editor and add the following content.
save and close the file.
In the above file we have used following,
- ens33 is the interface name
- addresses are used to set the static ip
- nameservers used to specify the DNS server ips
- routes used to specify the default gateway
Note: Change the IP details and interface name as per your environment.
To make above changes into the effect the apply these changes using following netplan command,
Run following ip command to view the ip address on interface,
To view the default route, run
Output of above commands,
Perfect, above commands’ output confirms that static ip and route has been configured successfully.
That’s all from this post. Kindly do post your queries and feedback in below comments section.
4 thoughts on “How to Set Static IP Address on Ubuntu Server 22.04”
How do I use Netplan to set up a static IP address on WIFI?
change the network device “ens33” to something else, it will be listed when you run “ip a”; it;s probably wlan0 but that’s not guaranteed.
there will be a config file for the wifi interface. look for something like 00-installer-config-wifi.yaml
Hey! thanks I had problems before setting up the DNS and none config would work! This one did and you made this post really simple to follow!
Leave a Comment Cancel reply
Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
How to change ip address in ubuntu desktop through command line
In Ubuntu desktop 13.04 changing /etc/network/interfaces file don't change ip address or convert DHCP to static network interface configuration. after changing the file I tried
----------EDIT----------
I have connected to system with ssh.
- command-line
- network-manager
- How are you changing the IP when editing the` /etc/network/interfaces` file? – Mitch ♦ Aug 21, 2013 at 11:46
- @Mitch link – Necktwi Aug 21, 2013 at 11:50
- 1 You mean to say you edited that file but it doesn't have any effect? It doesn't change the IP address? – Alaa Ali Aug 21, 2013 at 11:52
- @Alaa i did sudo service networking restart – Necktwi Aug 21, 2013 at 11:53
6 Answers 6
By default, Ubuntu (or Network Manager to be specific) ignores the /etc/network/interfaces file. To make the changes you made take effect, execute the following commands:
Assuming that wlan0 is the interface you are editing. Once you do that, wlan0 will come up with the settings you have under its stanza in /etc/network/interfaces .
Edit: since you're connected through SSH. You can try the following:
Edit /etc/NetworkManager/NetworkManager.conf and change ifdown managed to false :
- How to restart the networking service?
- if i use ifdown i will loose connection to the system. If it dont work there is no way to connect again. – Necktwi Aug 21, 2013 at 12:10
- i can try restarting the system but if static ip is not set i cant know its dynamic new ip – Necktwi Aug 21, 2013 at 12:14
- @neckTwi try my updated answer. Also, are you sure it's going to have a different IP? Usually, there's a lease period where, even if you restart the machine, it'll still get the same IP until the pre-defined lease period expires. But that depends of course, I'm just saying what's on my mind. – Alaa Ali Aug 21, 2013 at 12:17
- what does [ifupdown] managed=false mean? – Necktwi Aug 21, 2013 at 12:20
- If it is set to true, NetworkManager "manages" the interfaces mentioned in /etc/network/interfaces . If it's set to false, NetworkManager does not manage the interfaces mentioned there. – Alaa Ali Aug 21, 2013 at 12:27
Try this. Just press Ctrl + Alt + T on your keyboard to open Terminal. When it opens, run the command(s) below:
This is done with the help of guntbert
Once done save and exit
add this line DHCP mode
Static mode
Once done save the file, and:
- These aren't permanent changes. They'll be overridden when the computer restarts. – Alaa Ali Aug 21, 2013 at 11:52
- that dont survive system restart – Necktwi Aug 21, 2013 at 11:52
- Do you have a static or dynamic IP? – Mitch ♦ Aug 21, 2013 at 11:57
- @guntbert Is this better? Thanks :) – Mitch ♦ Aug 21, 2013 at 16:49
- This doesn't work (or no longer works). Ubuntu doesn't seem to care about /etc/network/interfaces . – giusti Mar 12, 2017 at 13:39
You can change your ip address by using the following script:
Open terminal with Ctrl + Alt + t and type the following command:
Find eth0 section and setup IP address as follows:
Save and close the file. Once done, restart network:
Verify new IP address by using the following command :
- This is just a vehicle for your own websites; please disclose your affiliation to ip-details.com and Whoisxy.com , or don't link to these sites from all your posts . See the help center . – Martijn Pieters Jun 19, 2014 at 11:31
I am posting this answer to give another dimension to the question and existing answers, not as a direct answer to the original question. Your IP will be lost at reboot. However, I think it's worth you understanding these commands, iproute2 package is the currently method of on-the-fly interface management via the CLI. Lots of people are still writing scripts using ifconfig for example.
I think it's worth noting the use of the iproute2 packages;
Show current IPs on all interface ( ip addr )
Add an IP address to my wireless interface ( ip addr add )
Show my IP addresses again, note the additional IP on wlan0 ( ip addr )
Show the link state of my interfaces ( ip link )
Delete this 2nd IP address from my wireless interface ( ip addr delete )
Show IP addresses just for wlan0 to check ( ip addr show wlan0 )
The same commands could have been used to remove my current IP, 172.22.0.221 then add another, but I would have lost connectivity, which I can't right now. Below are those commands though, after which I would also need to add a new default route route;

From t he detailed instructions on this site :
- disable the graphical management of your network connection in /etc/NetworkManager/NetworkManager.conf
- Gather the information for the static IP (interface, IP to be used, default gateway, subnet,DNS)
- Modify /etc/network/interfaces to include the information above.
- Restart networking and network-manager services
This is the right way to do it.
Your Answer
Sign up or log in, post as a guest.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged command-line networking network-manager or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
- Announcement: AI-generated content is now permanently banned on Ask Ubuntu
Hot Network Questions
- Can carbocations exist in a nonpolar solvent?
- How to handle a hobby that makes income in US
- For the Nozomi from Shinagawa to Osaka, say on a Saturday afternoon, would tickets/seats typically be available - or would you need to book?
- Do new devs get fired if they can't solve a certain bug?
- Whats the grammar of "For those whose stories they are"?
- My code is GPL licensed, can I issue a license to have my code be distributed in a specific MIT licensed project?
- Identify those arcade games from a 1983 Brazilian music video
- Why do small African island nations perform better than African continental nations, considering democracy and human development?
- Recovering from a blunder I made while emailing a professor
- Knocking Out Zombies
- Counting Letters in a String
- How can I check before my flight that the cloud separation requirements in VFR flight rules are met?
- Is there a single-word adjective for "having exceptionally strong moral principles"?
- AC Op-amp integrator with DC Gain Control in LTspice
- Batch split images vertically in half, sequentially numbering the output files
- Minimising the environmental effects of my dyson brain
- Would the magnetic fields of double-planets clash? and what would happen then?
- Radial axis transformation in polar kernel density estimate
- Why does it seem like I am losing IP addresses after subnetting with the subnet mask of 255.255.255.192/26?
- How to Fix my DIY Smart Switch Install
- What is the point of Thrower's Bandolier?
- Are there tables of wastage rates for different fruit and veg?
- Trying to understand how to get this basic Fourier Series
- Follow Up: struct sockaddr storage initialization by network format-string
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
How To Set A Static Ip Address In Ubuntu
By default, a device connected to your home router, whether it is connected via cable or Wi-Fi, will most likely receive a dynamic IP address. If you also use your managed Ubuntu VPS as an FTP or web server, you want to configure a static IP address for it so that you can reach the server using the same IP address. In this tutorial, we will show you how to configure a static IP address on Ubuntu 20.04. We have mentioned steps below to Set a Static IP Address in Ubuntu
Steps to Set a Static IP Address in Ubuntu #
Final words #.
We hope like our article on how to Set a Static IP Address in Ubuntu. The IP address of most devices today is generated by a Dynamic Host Configuration Protocol (DHCP) server. A DHCP server assigns a dynamic IP address to your device when it is connected to a network. So you have the possibility to change this IP address from time to time. A static IP, on the other hand, is a fixed, unchanging address that is different from dynamic IPs. You can set static IP settings in Ubuntu 22.04 LTS in three different ways. Here’s how to get started.
How to change from DHCP to Static IP Address in Ubuntu 22.04
Dynamic Host Configuration Protocol is commonly known as DHCP, used in the networking as a network protocol and it helps different devices to connect with a specific IP address. As the name is telling its dynamic so it changes and assigns different IP addresses to the devices which is very much helpful if we talk about the security of devices because it’s unable to access the IP address.
Sometimes we want the same IP address so in this write-up, we will change the DHCP of our machine to the permanent static IP address in Ubuntu.
How to change from DHCP to a static IP address on Ubuntu 22.04
To learn the method of changing from DHCP to a static IP address, first we have to find out the IP address of our machine which can find out by using the command:

We will open the networking tool of Ubuntu which is known as nmtui by using the command:

Please enable JavaScript
A menu of NetworkManager will be displayed from which we can choose the “Edit a connection”:

Now choose your connection and click on the “Add”:

The details of the connection are being displayed:

Change the mode of a configuration of IPv4 from “Automatic” to “Manual” using the command:

When you are done, scroll down the menu and click on the “Ok” button to save the settings:

Click on the “Back” to go back the menu:

Click on the “Activate a connection” to make it active:

Again click on “Activate”:

And click on the “Back” to save the settings:

Now Quit as the DHCP is changed to the static IP address:

In the terminal run the command to check the new assigned IP address:
Another approach to change the DHCP to static IP address is by going on the “Network” section in the Settings, and then click on the “Settings icon” next to the connected button:

Click on the “Manual” and insert the information of “Address”, “Netmask”, “Gateway”, and “DNS”:

Toggle the button off and then turn on to apply the new changes:

Again click on the setting icon to open the details of the network connection:

The changes have successfully been applied.
DHCP assigns and uses the dynamic IP addresses to the machine which are beneficial for security reasons but we can also change it to a static IP address by the two different methods which are discussed in this guide for Ubuntu 22.04.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY
[email protected]


How-tos and tutorials for sys admins
How to Change the IP Address in Ubuntu

Ubuntu, being a predominantly Linux operating system, has several programs to assist us in completing various tasks. It’s crucial to understand how to update your computer’s IP address since it allows you to transport any sort of data over a network. In this post, we’ll go through the two distinct methods for changing IP addresses on your Ubuntu system.
An IP address, or Internet Protocol address, is a numeric address assigned to various computers and networked devices that use the Internet Protocol. An IP address is used to both identify and determine the location of a machine. Every IP address on the network is unique, allowing for better communication between all connected devices. There are two sorts of IP addresses: public and private (public and private). Your public IP-address is used to communicate via the Internet in the same manner that your physical address is used for postal mail. In the other hand, every device on a local network is given a private IP address that is unique within its sub-network.
Another distinction between IPv4 and IPv6 protocols may be made. IPv4 is the most used IP format, consisting of a four-part structure with four bytes separated by dots (e.g., 192.168.1.3). Apart from the fact that as the number of devices increases, it becomes increasingly difficult to keep track of them all, IPv4 may soon run out of addresses. That is why, in contrast to IPv4, IPv6 was invented.
Change IP Address in Ubuntu
There are two ways through which your IP address can be changed in Ubuntu:
- Change IP address Using Command Line Method
- Change IP address Using GUI (Graphical User Interface) Method
A brief detail of both methods is explained below:
How to Change IP Address Using Command Line Method
The Command-Line method is a simple and mostly used way in Linux to change your IP address in Ubuntu. First, run the mentioned below command to check active network interfaces:

After listing network interfaces, open the file named as “/etc/netplan/*.yaml” in nano editor by using the command mentioned below:

“/etc/netplan/*.yaml” file will open a new page having following information:

In the “/etc/netplan/*.yaml” file write the mentioned below code in order to change the IP address:

After writing the code, press “CTRL+O” to save the changes, and to apply the settings run the mentioned below command:

Now, run the mentioned below command to check the modified IP address of the “enpos3”
By running this command, you can get a modified IP address of any network interface on your Ubuntu system.

How to Change IP Address Using GUI (Graphical User Interface) Method
If you don’t know how to use the command line or you are facing any difficulty in the application of commands, you can also check IP addresses by another method.
Mentioned below are the steps to change IP-address using GUI.
Step 1: Application Menu (Settings)
Open the Ubuntu Applications Menu which is provided in the left corner of the screen (denoted by the nine dots symbol) and then search for “Settings” option and click on the icon:

Step 2: Network Settings
Settings Menu will be shown after clicking the “settings” icon. In settings options, go to “Network”.

Step 3: IP Address Details
When you press the “gear icon” given after your connection, a window will get opened that contain more setting and information of your connection with network and IP-address. In order to change IPv4 address, click on the “IPv4” tab.

Step 4: Changing IP Address Details
After selecting the IPv4 tab, select the method as “manual” enter details of your own choice and then click on the “apply” button.

Step 5: Applying New Settings
After clicking on the “apply” button, in order to apply new IP settings, turn the switch OFF and ON.

Step 6: Checking New Settings
In order to check whether new settings are applied or not, click on the “gear icon” and then go to the “details” option provided in the network settings icon and new IPv4 address settings will be obtained.

In this article, the basic overview of IP addresses, their types, and the contrast between the IPv4 and IPv6 protocols is being provided. The two different ways through which you can change your IP address in Ubuntu Linux are being discussed in this article as well. These approaches include the command line approach and the GUI approach.

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.
- ← How to Reinstall Ubuntu
- How to Setup a VPN on Ubuntu →
Similar Posts

How to Find the MAC Address in Ubuntu

Top 7 Free and Open-Source Security Tools

How to Configure Your Linux Firewall to Best Protect Your Data Center
- Change Ubuntu Ip Address
How to Change Ubuntu IP address
- Updated: December 26, 2022
Rachelle J. Alley
Ubuntu ip address: how to change ubuntu ip address in terminal through netplan, how to use gui to change the ubuntu ip address, ubuntu linux change ip using command line config file, how to statically assign an ubuntu ip address.
- FAQs - Ubuntu IP Address
Final Thoughts

While working on Ubuntu systems, many situations force you to change the IP address. In this article, we will reveal how to change Ubuntu IP address. You can easily modify the designated IP address on your system through “netplan” or by using the Ubuntu GUI Network settings.
The basic tool used to change network preferences in Ubuntu is called netplan. This tool corresponds with the kernel via NetworkManager daemons and systemd-networkd, also termed as renderers. Netplan collects the configurations of the network through “/etc/netplan/*.yaml” files while making the configuration preferences for all interfaces of the network.
There are many ways to change IP Address on ubuntu like using best VPN for Ubuntu , or through netplan or terminal etc. Here we’ll learn about how to change IP address on Ubuntu through terminal and GUI.
First thing first, to change Ubuntu IP address, enlist the running network interfaces by running the Ubuntu “ip” command. This command is used in Ubuntu to rearrange interfaces and assign or delete routes, etc.
If you add “link” in the “ip” command it will show the name, link-layer details, the status of an interface, etc. Run the following “ip link” command to get more information about your network systems:
Next step involves opening the “/etc/netplan/*.yaml” file in editor:
Up next, write the code given below in the “/etc/netplan/*.yaml” file to alter the IP address on your computer:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
dhcp6: no
addresses: [192.168.2.2/24]
gateway4: 192.168.2.2
nameservers:
- dhcp4 is IPv4 properties and dhcp6 is IPv6 DHCP properties.
- enp0s3: name of the network interface.
- addresses enclose the order of addresses for the network system.
- gateway4 holds the IPv4 address of the default gateway (If you’re still confused, then check out our guide on how to find your default gateway IP address )
- nameservers hold an order of IP addresses for nameservers.
Now hit “CTRL+O” to reserve the changes done in the file.
After saving, apply the changed settings by using the following netplan command in your terminal:
Next, confirm whether the IP address of the “enpos3” network interface is modified or not:
After running this command, the result will show a modified IP address.
Ubuntu also offers the convenience to modify the IP address of the network interface using its GUI portal. Here’s how you can do that:
- Launch Settings and click the Network tab in the menu on the left.
- Click on the gear icon to alter the selected network’s IP address.
- Next up, select the “IPv4” section from the menu.
- Uncheck the Automatic (DHCP) option under the IPv4 menu and select “Manual.”
- Now add the desired Netmask, IP address, Gateway, and information related to DNS.
- After filling in all the information click on the “Apply” button.
- Here you go! You can click the “Details” button to confirm the modified IP address.
Follow these steps to change Ubuntu IP address using Command Line Config File:
Launch terminal and write the following command:
sudo vi /etc/network/interfaces
Go to the eth0 section and set up the IP address as desired.
Now save and close the file and restart the network through this command:
To confirm the new IP address run this command:
$ ifconfig eth0
Whenever you are connected to a network, your device immediately gets an IP address from the network. There are two types of IP addresses ; static and dynamic. Let’s find out how to assign a static IP address .
- First of all, launch Terminal.
- Next, run “ip addr show” command to see the network adapter for which you want to change the IP address, and then execute.
- Run “ip addr add X.X.X.X/24 dev eth0” command to modify the IP address (you can use any IP address you want to assign).
- Once executed, verify the new IP address by running “ip addr show”
FAQs – Ubuntu IP Address
How do i change my ip address in the linux terminal.
Run the “ifconfig” command accompanied by the network interface name and the new IP address you wish to change on your system. For the subnet mask, you can add a “netmask” clause along with the subnet mask or utilize the CIDR code straightaway.
How do I set a static IP in the Ubuntu terminal?
Here is how to set up a static IP address using the command line in Ubuntu:
- Get the network interface and default gateway’s name.
- Locate the Netplan configuration.
- Edit the Netplan configuration to set up a static IP address.
How do I find my IP address in the Ubuntu terminal?
Follow the steps below to find your IP address in Ubuntu 20.04:
- Run the command $ ip a to check the internal IP.
- Execute the command $ systemd-resolve –status | grep Current for checking the current DNS server IP address.
- Run command $ ip r for displaying the default gateway IP.
Ubuntu offers the option to modify the network interface IP address , whether you are doing it for running any media server on your device or port forwarding.
Netplan is the network management tool in the Ubuntu system that is used to configure and manage the network settings.
In this article, we have elaborated on how to change Ubuntu IP address using the “netplan” tool through the Ubuntu terminal, as well as the method for modifying the IP address through Ubuntu GUI.

Rachelle J. Alley's Biography :
Tech enthusiast by day, movie fanatic by night. Rachelle spends her week consuming numerous cups of coffee and typing her way into online privacy and security. Weekends, in her life, call for binge-reading her favorite books and multiple naps.
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.
By submitting this form you agree to our Terms of service and Privacy Policy
How to Check IPv4 Address on Ubuntu 22.04
Question – How to find static IP Address of My Ubuntu Desktop system? 2 Ways to find IP Address on Ubuntu 22.04 Desktop and server editions?
Ubuntu 22.04 desktop edition comes with an attractive Gnome Desktop Environment. You can either use the command prompt to check the current IP address on your system or use a GUI option to view the local IP address on your system.
You can also use another article to change IP address on Ubuntu 22.04 desktop and server editions.
Choose one of the below methods to check the current IP address on a Ubuntu system.
Method 1: Checking IP Address via Command Line on Ubuntu 22.04
The Ubuntu desktop users Press CTRL+ALT+T to open the terminal and the server user connects to the system over SSH.
Once you get the terminal access, execute the ip addr show or its short version ip a command to view all the configured IPv3 addresses on network intefaces.
You will see all the assigned ipv4 addresses on network interfaces.
The above output shows that the 192.168.1.212 IP with 24 netmark is configured on the system
Method 2: Checking IP Address in Ubuntu 22.04 Desktop
To follow this method, you must have a desktop environment on your Ubuntu system. Now,
In this tutorial, you have learned to find the currently configured IP address on a Ubuntu system. Hope this tutorial provides you with the right instruction and is helpful for you.
Related Posts
A step-by-step guide to installing opendkim with postfix on ubuntu – unleash the power of dkim, how to install composer on ubuntu 22.04, how to create sftp user in ubuntu 22.04 (no shell access), leave a reply cancel reply.
Save my name, email, and website in this browser for the next time I comment.
Type above and press Enter to search. Press Esc to cancel.

IMAGES
VIDEO
COMMENTS
You can easily make Ubuntu static IP settings using the netplan command in 22.04 LTS and 22.10 versions. To do this, follow the steps below. First, find out the name of your network interface using the command below: sudo ip a What you see here is your network interface name. This name may be different on each device.
Click on the gear icon on the Wired interface page and then IPv4 tab >> Manual >> Enter IP address, Netmask, Gateway, DNS (Toggle to disable Automatic DNS configuration) >> Apply. Set IP for Wired Interface Finally, use the toggle in the Network page to disable and enable the network interface to apply the IP address.
You can configure a static IP address on Ubuntu 22.04 Jammy Jellyfish either from command or GUI. First, we will cover the instructions to configure one from GNOME GUI. Start by opening Settings and click on Network menu and hit the gear wheel of the desired network interface. Next, click the IPv4 tab, and then the manual configuration option.
Method 1: Configuring Static IPv4 Address on Ubuntu 22.04 Desktop The Ubuntu Desktop editions have a graphical interface for configuring the network interfaces. Follow the below steps to configure a static IP address on Ubuntu 22.04 Desktop system. ADVERTISEMENT Click the network icon in the upper-right corner.
After gathering your connection name, subnet mask, and default gateway, you can set a static IP address in the terminal using the nmcli command. Or, in the GNOME desktop, open your connection settings and click the + icon, then enter the info for your static IP address there.
Using nmcli command line utility, we can configure static ip on ubuntu 22.04. Procedure and commands are listed below, Run below command to identify the device name, $ nmcli connection show To assign the static IP address, create a connection with name 'static ip' and use interface as 'enp0s3', run beneath command
Setting up Static IP address on Ubuntu Server 22.04 Login to your Ubuntu server 22.04, look for the netplan configuration file. It is located under /etc/netplan directory. $ cd /etc/netplan/ $ ls -l total 4 -rw-r--r-- 1 root root 116 Oct 12 04:03 00-installer-config.yaml $ Run below cat command to view the contents of '00-installer-config.yaml'
Configure static IP address on Ubuntu 22.04 Server To apply the new Netplan changes execute: $ sudo netplan apply Alternatively, if you run into some issues run: $ sudo netplan --debug apply Confirm your new static IP address by using the ip Linux command : $ ip a Check current IP address Troubleshooting
using only cli to change the IP address, since the HW is not accessible and the script is changing the IP address through SSH, so it has to be the only cli The changes to be permanent, the IP address shouldn't be lost on restart This should be applicable to all the version of ubuntu
To temporarily configure an IP address, you can use the ip command in the following manner. Modify the IP address and subnet mask to match your network requirements. sudo ip addr add 10.102.66.200/24 dev enp0s25 The ip can then be used to set the link up or down. ip link set dev enp0s25 up ip link set dev enp0s25 down
In "IPV4" Method" tab, select "Manual" and enter your static IP address, Netmask and Gateway. Once done, click on the "Apply" button. To verify the changes, open your terminal either by using the Ctrl+Alt+T keyboard shortcut or by clicking on the terminal icon and run: ip addr The output will show the interface IP address:
n2:~$ ip r s default via 172.22..1 dev wlan0 proto static 169.254../16 dev wlan0 scope link metric 1000 172.22../24 dev wlan0 proto kernel scope link src 172.22..221 metric 2 192.168.122./24 dev virbr0 proto kernel scope link src 192.168.122.1 ip a del 172.22..221/24 dev wlan0 ip a a 172.22..10/24 dev wlan ip r a default via 172.22..1 ...
So you have the possibility to change this IP address from time to time. A static IP, on the other hand, is a fixed, unchanging address that is different from dynamic IPs. You can set static IP settings in Ubuntu 22.04 LTS in three different ways. Here's how to get started.
Method 1: Manually edit Network Configuration files To get a Static Ip Address on Ubuntu server 22.04|20.04|18.04, you'll edit interfaces configuration file located at /etc/network/interfaces. You can use vi / vim editor or nano editor for this purpose.
How to change from DHCP to a static IP address on Ubuntu 22.04 To learn the method of changing from DHCP to a static IP address, first we have to find out the IP address of our machine which can find out by using the command: $ ip a We will open the networking tool of Ubuntu which is known as nmtui by using the command: $ nmtui
After writing the code, press "CTRL+O" to save the changes, and to apply the settings run the mentioned below command: $ sudo netplan apply. Now, run the mentioned below command to check the modified IP address of the "enpos3". $ ip a. By running this command, you can get a modified IP address of any network interface on your Ubuntu system.
Ubuntu is a common server choice for beginner... What's up, Guys!!! In this video, I walk through how to set a static IP address in Ubuntu 22.04 Server Edition.
Launch Settings and click the Network tab in the menu on the left. Click on the gear icon to alter the selected network's IP address. Next up, select the "IPv4" section from the menu. Uncheck the Automatic (DHCP) option under the IPv4 menu and select "Manual.".
Method 1: Checking IP Address via Command Line on Ubuntu 22.04. The Ubuntu desktop users Press CTRL+ALT+T to open the terminal and the server user connects to the system over SSH. Once you get the terminal access, execute the ip addr show or its short version ip a command to view all the configured IPv3 addresses on network intefaces.
In this video, I am showing how to assign static IP address to Ubuntu 20.04 desktop machine.We can do it in two ways. I am using the GUI to change the IP add...