- Awards Season
- Big Stories
- Pop Culture
- Video Games
The Basics of Pulling an IP Address: What You Need to Know
When it comes to understanding the internet, knowing how to pull an IP address is a fundamental skill. An IP address (Internet Protocol address) is a unique identifier that is assigned to each device connected to the internet. It is used to identify and locate a device on the network, enabling communication between two or more devices. In this article, we will discuss the basics of pulling an IP address, including what it is, why it’s important, and how to do it.
What is an IP Address?
An IP address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. It uniquely identifies each device on the network and allows data packets to be routed from one device to another. An IP address consists of four numbers separated by periods, such as 192.168.1.1.
Why is Pulling an IP Address Important?
Pulling an IP address can be useful in many situations. For example, if you are troubleshooting a network issue or trying to track down malicious activity on your network, you may need to pull an IP address in order to identify the source of the problem or determine which device is responsible for the malicious activity. Additionally, if you are trying to access a website or service that requires authentication, you may need to pull your own IP address in order to gain access.
How Do You Pull an IP Address?
Pulling an IP address can be done in several ways depending on your operating system and what type of information you need. On Windows systems, you can use the ipconfig command in Command Prompt or PowerShell; on Mac systems, you can use the ifconfig command in Terminal; and on Linux systems, you can use the ip command in Terminal. Additionally, there are websites that allow you to look up your public IP address without having to run any commands or install any software.
In conclusion, knowing how to pull an IP address is essential for understanding how networks work and troubleshooting any issues that may arise with them. With this knowledge in hand, you’ll be able to identify devices on your network and access services that require authentication with ease.
This text was generated using a large language model, and select text has been reviewed and moderated for purposes such as readability.
MORE FROM ASK.COM
Setting a Static IP in Ubuntu – Linux IP Address Tutorial
In most network configurations, the router DHCP server assigns the IP address dynamically by default. If you want to ensure that your system IP stays the same every time, you can force it to use a static IP.
That's what we will learn in this article. We will explore two ways to set a static IP in Ubuntu.
Static IP addresses find their use in the following situations:
- Configuring port forwarding.
- Configuring your system as a server such as an FTP server, web server, or a media server.
To follow this tutorial you will need the following:
- Ubuntu installation, preferably with a GUI.
- sudo rights as we will be modifying system configuration files.
How to Set a Static IP Using the Command Line
In this section, we will explore all the steps in detail needed to configure a static IP.
Step 1: Launch the terminal
You can launch the terminal using the shortcut Ctrl+ Shift+t .
Step 2: Note information about the current network
We will need our current network details such as the current assigned IP, subnet mask, and the network adapter name so that we can apply the necessary changes in the configurations.
Use the command below to find details of the available adapters and the respective IP information.
The output will look something like this:
For my network, the current adapter is eth0 . It could be different for your system
- Note the current network adapter name
As my current adapter is eth0 , the below details are relevant.
It is worth noting that the current IP 172.23.199.129 is dynamically assigned. It has 20 bits reserved for the netmask. The broadcast address is 172.23.207.255 .
- Note the subnet
We can find the subnet mask details using the command below:
Select the output against your adapter and read it carefully.
Based on the class and subnet mask, the usable host IP range for my network is: 172.23.192.1 - 172.23.207.254 .
Subnetting is a vast topic. For more info on subnetting and your usable IP ranges, check out this article .
Step 3: Make configuration changes
Netplan is the default network management tool for the latest Ubuntu versions. Configuration files for Netplan are written using YAML and end with the extension .yaml .
Note: Be careful about spaces in the configuration file as they are part of the syntax. Without proper indentation, the file won't be read properly.
- Go to the netplan directory located at /etc/netplan .
ls into the /etc/netplan directory.
If you do not see any files, you can create one. The name could be anything, but by convention, it should start with a number like 01- and end with .yaml . The number sets the priority if you have more than one configuration file.
I'll create a file named 01-network-manager-all.yaml .
Let's add these lines to the file. We'll build the file step by step.
The top-level node in a Netplan configuration file is a network: mapping that contains version: 2 (means that it is using network definition version 2).
Next, we'll add a renderer, that controls the overall network. The renderer is systemd-networkd by default, but we'll set it to NetworkManager .
Now, our file looks like this:
Next, we'll add ethernets and refer to the network adapter name we looked for earlier in step#2. Other device types supported are modems: , wifis: , or bridges: .
As we are setting a static IP and we do not want to dynamically assign an IP to this network adapter, we'll set dhcp4 to no .
Now we'll specify the specific static IP we noted in step #2 depending on our subnet and the usable IP range. It was 172.23.207.254 .
Next, we'll specify the gateway, which is the router or network device that assigns the IP addresses. Mine is on 192.168.1.1 .
Next, we'll define nameservers . This is where you define a DNS server or a second DNS server. Here the first value is 184.108.40.206 which is Google's primary DNS server and the second value is 220.127.116.11 which is Google's secondary DNS server. These values can vary depending on your requirements.
Step 4: Apply and test the changes
We can test the changes first before permanently applying them using this command:
If there are no errors, it will ask if you want to apply these settings.
Now, finally, test the changes with the command ip a and you'll see that the static IP has been applied.
How to Set a Static IP Using the GUI
It is very easy to set a static IP through the Ubuntu GUI/ Desktop. Here are the steps:
- Search for settings .
- Click on either Network or Wi-Fi tab, depending on the interface you would like to modify.
- To open the interface settings, click on the gear icon next to the interface name.
- Select “Manual” in the IPV4 tab and enter your static IP address, Netmask and Gateway.
- Click on the Apply button.
- Verify by using the command ip a
In this article, we covered two methods to set the static IP in Ubuntu. I hope you found the article useful.
What’s your favorite thing you learned from this tutorial? Let me know on Twitter !
You can read my other posts here .
I am a DevOps Consultant and writer at FreeCodeCamp. I aim to provide easy and to-the-point content for Techies!
If you read this far, thank the author to show them you care. Say Thanks
Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started
- Change Ubuntu Ip Address
How to Change Ubuntu IP address in 2023
- Updated: November 21, 2023
Minnie J. Hamilton
How to use gui to change the ubuntu ip address, how to change ubuntu ip address by terminal using netplan, ubuntu linux change ip using command line config file, how to statically assign an ubuntu ip address.
- FAQs - Ubuntu IP Address
To change Ubuntu IP address, you can adjust the network settings. By changing the IP address in Ubuntu, you can ensure smooth connectivity and adapt to your network requirements. Modifying the IP address involves accessing the network configuration files, such as “ /etc/network/interfaces ” or using the “ netplan ” utility in newer versions.
Ubuntu is an open-source Linux distribution widely used for desktop and server environments. Modifying your IP address on Ubuntu has its pros and cons. It can enhance network security, troubleshoot connectivity issues, and improve network management. However, it may disrupt existing connections and require reconfiguration of network-dependent applications.
ExpressVPN is the best VPN to change IP addresses on Ubuntu . It offers a reliable VPN solution with a wide network of servers, allowing easy switching between IP addresses and bypassing geolocation restrictions. ExpressVPN provides robust encryption, high-speed connections, and a user-friendly interface, making it an ideal choice for privacy and accessing region-restricted content on Ubuntu.
Ubuntu users can also use free VPN for Ubuntu which enables them to effortlessly change their IP address by connecting to various servers. This feature enhances privacy, bypasses geographical restrictions, and allows seamless access to region-restricted content. Utilizing a free VPN for Ubuntu provides users with flexibility and control over their online identity.
Here are the six steps to change the IP address in Ubuntu using the graphical user interface (GUI):
- Click on the network icon in the top-right corner of the Ubuntu desktop.
- Select “ Wired Settings” or “ Wi-Fi Settings ,” depending on your network connection type.
- Locate your active network connection and click on the settings icon next to it.
- Select the IPv4 tab.
- Choose the “ Manual ” option from the dropdown menu next to “ Method. “
- Enter the new IP address, subnet mask, default gateway, and DNS servers in the respective fields, and click “ Apply ” or “ Save ” to save the changes.
Here is how to change Ubuntu IP address by the terminal using Netplan
- Compile a roster of the current Ubuntu enable network interfaces using the “ IP ” command. In the Ubuntu terminal, the Ubuntu Netplan static IP command is employed for tasks such as assigning or removing routes, enabling or disabling interfaces, and more. By including “link” in the “ IP ” command, you can obtain additional details about the interfaces, including link-layer information, names, and statuses. Execute the provided “ IP link ” command to acquire further information about your network interfaces.
- Open the file “ /etc/netplan/*.yaml ” in your nano editor.
- Once you open the file “ /etc/netplan/*.yaml, ” you will find the following information within it.
- Copy and paste the following code into the “/etc/netplan/*.yaml” file to modify the IP address on your system.
- The properties “ dhcp4″ and “dhcp6 ” represent the IPv4 and IPv6 DHCP settings, respectively.
- The network interface named “ enp0s3 ” is the target for changing the IP address.
- The “ addresses ” field contains a sequence of addresses associated with the network interface.
- The “ gateway4 ” field holds the IPv4 address of the default gateway.
- The “ nameservers ” field consists of a series of IP addresses for the nameservers.
- To save the changes made in the file, press “ CTRL+O “.
- Apply the modified settings by executing the provided Netplan command in your terminal.
- Verify if the IP address of the “ enp0s3 ” network interface has been successfully changed.
- The IP address on our Ubuntu system has been successfully altered.
Follow these steps to change Ubuntu IP address using Command Line Config File.
Launch the 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
Note : To set a static IP address on Ubuntu using the command line, you can utilize the “ ifconfig ” command.
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 to change IP address in Ubuntu Terminal?
To change the IP address in Ubuntu Terminal, follow these steps:
- Launch Terminal.
- Use the “ip addr show” command to identify the network adapter you wish to modify the IP address for.
- Execute the “ip addr add X.X.X.X/24 dev eth0” command to change the IP address (replace X.X.X.X with the desired IP address).
How to change the IP address in Linux?
To change the IP address in Linux, follow these steps:
- Log in as a root user.
- Open a terminal session.
- Enter “ifconfig -a” in the command prompt.
- Use “ifconfig ethx xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx” with the values from step 3 for IP address and subnet mask, replacing “ethx” with the interface displayed in step 3.
- Press Enter.
How do I change my IP address in Ubuntu 20.04?
To change your IP address in Ubuntu 20.04, follow these steps:
- Edit the file “/etc/netplan/50-cloud-init.yaml” (or “/etc/netplan/01-netcfg.yaml”) with administrative privileges.
- Apply the modified Netplan configuration by running the command: “sudo netplan apply.”
- Verify the new static IP address using the command: “ip a.”
Note : To set static ip ubuntu or to perform Ubuntu 22.04 network configuration from the command line, use the following one-liner: “sudo nano /etc/netplan/50-cloud-init.yaml && sudo netplan apply && ip addr”.
How do I change my IP address in Ubuntu 18.04 CLI?
To change your IP address in Ubuntu 18.04 CLI follow the steps:
- Open the GNOME Network configuration settings by searching for “ network ” in the Activities screen and clicking on the Network icon. Then, click on the cog icon.
- In the Network interface settings dialog box, go to the “IPV4” Method section and choose “ Manual. ” Enter your static IP address, Netmask, and Gateway. Click on the “ Apply ” button to save the changes.
- Open the terminal using the Ctrl+Alt+T keyboard shortcut or by clicking on the terminal icon. Type “ ip addr ” in the terminal.
- The output will display the interface IP address, such as “2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:e9:40:f2 brd ff:ff:ff:ff:ff:ff inet 192.168.121.106/24 brd 192.168.121.255 scope global dynamic noprefixroute ens3 valid_lft 3523sec preferred_lft 3523sec inet6 fe80::5054:ff:fee9:40f2/64 scope link valid_lft forever preferred_lft forever.”
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.
Changing the IP address on Ubuntu is a straightforward process that allows users to configure their network settings according to their needs. By following a few simple steps, users can modify the IP address to meet specific requirements.
To change the Ubuntu IP address , users can access the Network configuration settings, select the manual method under the IPV4 section, and enter the desired static IP address, netmask, and gateway. Verifying the changes can be done by using the “ ip addr ” command in the terminal, which displays the updated interface IP address.
For users seeking additional privacy and security while changing their IP address on Ubuntu, ExpressVPN stands out as the top recommendation. ExpressVPN offers robust encryption, a vast server network, and user-friendly applications that are compatible with Ubuntu. With ExpressVPN, users can enjoy a seamless and secure browsing experience, ensuring their online activities remain private and protected.
Minnie J. Hamilton's Biography :
Minnie's road to sense of fulfillment and purpose has touched medicine, pattered into business & economics and is now finding the expansion of that purpose through voices of reason in the world of technology & online privacy. She will continue to write as long as people may find truth in it. On Sunday’s, she snaps back into the reality of fantastical ogres, satyrs and the depths of the seas. Her current adventure is The Ninth House.
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.
How to set a static ip address in ubuntu.
When static is the way forward.
What is a static ip address, setting a static ip in ubuntu, set a static ip in ubuntu with the gui, connection convenience, key takeaways.
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.
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.
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 .
Nmcli is the command-line network manager tool , and can be used to change your IP address, configure network devices, and --- relevant to our purposes --- set up a static IP in Ubuntu.
We're demonstrating this technique on Ubuntu 22.04 LTS, but it ought to work on any Linux distribution, including Ubuntu 23.04. The nmcli 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.
nmcli connection show
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 the current IP address assigned to the Ubuntu system. 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 responds to the ping requests, so 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.
sudo nmcli con add con-name "static-ip" ifname enp0s3 type ethernet ip4 192.168.86.128/24 gw4 192.168.86.1
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 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. 18.104.22.168 is the IP address of Google's primary public DNS server , and 22.214.171.124 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.
nmcli con mod "static-ip" ipv4.dns "126.96.36.199,188.8.131.52"
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."
nmcli con mod "static-ip" ipv4.method manual
And now we can start or "bring up" our new connection.
nmcli con up "static-ip" ifname enp0s3
We didn't get any error messages which is great. Lets use nmcli to look at our connections once more.
nmcli con show
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.
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. Click the "Wired Settings" or "Wi-Fi Settings" menu option. The details of the active connection are displayed.
If you followed our previous instructions the new connection will be the active connection. We can see our new "static-ip" connection has the IP address, default gateway, and DNS servers that we set for it.
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 our new static IP 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.
You can swap between the available connections by clicking directly on their names.
If you want to modify a connection after you create it, click the cog icon. In this case, we'll 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.
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.
How to Assign Static IP Address on Ubuntu Linux
Brief: In this tutorial, you’ll learn how to assign static IP address on Ubuntu and other Linux distributions. Both command line and GUI methods have been discussed.
IP addresses on Linux Systems in most cases are assigned by Dynamic Host Configuration Protocol (DHCP) servers. IP addresses assigned this way are dynamic which means that the IP address might change when you restart your Ubuntu system . It’s not necessary but it may happen.
Dynamic IP is not an issue for normal desktop Linux users in most cases . It could become an issue if you have employed some special kind of networking between your computers.
For example, you can share your keyboard and mouse between Ubuntu and Raspberry Pi . The configuration uses IP addresses of both system. If the IP address changes dynamically, then your setup won’t work.
Another use case is with servers or remotely administered desktops. It is easier to set static addresses on those systems for connection stability and consistency between the users and applications.
In this tutorial, I’ll show you how to set up static IP address on Ubuntu based Linux distributions. Let me show you the command line way first and then I’ll show the graphical way of doing it on desktop.
Method 1: Assign static IP in Ubuntu using command line
Note for desktop users : Use static IP only when you need it. Automatic IP saves you a lot of headache in handling network configuration.
Step 1: Get the name of network interface and the default gateway
The first thing you need to know is the name of the network interface for which you have to set up the static IP.
You can either use ip command or the network manager CLI like this:
In my case, it shows my Ethernet (wired) network is called enp0s25:
Next, you should note the default gateway IP using the Linux command ip route :
As you can guess, the default gateway is 192.168.31.1 for me.
Step 2: Locate Netplan configuration
Ubuntu 18.04 LTS and later versions use Netplan for managing the network configuration. Netplan configuration are driven by .yaml files located in /etc/netplan directory.
By default, you should see a .yaml file named something like 01-network-manager-all.yaml, 50-cloud-init.yaml, 01-netcfg.yaml.
Whatever maybe the name, its content should look like this:
You need to edit this file for using static IP.
Step 3: Edit Netplan configuration for assigning static IP
Just for the sake of it, make a backup of your yaml file.
Please make sure to use the correct yaml file name in the commands from here onward.
Use nano editor with sudo to open the yaml file like this:
Please note that yaml files use spaces for indentation . If you use tab or incorrect indention, your changes won’t be saved.
You should edit the file and make it look like this by providing the actual details of your IP address, gateway, interface name etc.
In the above file, I have set the static IP to 192.168.31.16.
Save the file and apply the changes with this command:
You can verify it by displaying your ip address in the terminal with ‘ip a’ command.
If you don’t want to use the static IP address anymore, you can revert easily.
If you have backed up the original yaml file, you can delete the new one and use the backup one.
Otherwise, you can change the yaml file again and make it look like this:
Method 2: Switch to static IP address in Ubuntu graphically
If you are on desktop, using the graphical method is easier and faster.
Go to the settings and look for network settings. Click the gear symbol adjacent to your network connection.
Next, you should go to the IPv4 tab. Under the IPv4 Method section, click on Manual.
In the Addresses section, enter the IP static IP address you want, netmask is usually 24 and you already know your gateway IP with the ip route command.
You may also change the DNS server if you want. You can keep Routes section to Automatic.
Once everything is done, click on Apply button. See, how easy it is to set a static IP address graphically.
If you haven’t read my previous article on how to change MAC Address , you may want to read in conjunction with this one.
More networking related articles will be rolling out, let me know your thoughts at the comments below and stay connected to our social media.
Dimitrios is an MSc Mechanical Engineer but a Linux enthusiast in heart. His machines are powered by Arch Linux but curiosity drives him to constantly test other distros. Challenge is part of his per
Meet DebianDog - Puppy sized Debian Linux
Reduce computer eye strain with this nifty tool in linux, install open source dj software mixxx version 2.0 in ubuntu, install adobe lightroom alternative rawtherapee in ubuntu linux, complete guide to installing linux on chromebook, become a better linux user.
With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to It's FOSS.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.
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 addresses of most devices today are generated by Dynamic Host Configuration Protocol (DHCP) servers. 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 22.04 LTS and 22.10 in three different ways. Here's how to get started.
Understanding IP Configuration in Ubuntu
Ubuntu's progression in network management has made configuring settings like the static IP more user-friendly. The feature to set a static IP in Ubuntu 22.04, in particular, has advantages in terms of network efficiency and stability.
Unlike dynamic IPs, which might vary over sessions, a static IP in Ubuntu remains consistent. This is especially advantageous for servers where consistent address recognition is paramount. For these servers, static IP configurations can become a necessity.
While the graphical interface offers a more intuitive way to handle IP configurations, using the static IP command line can offer more precision. For users who want granular control over their network configurations, command-line methods are a preferred choice. By mastering this method, users can ensure optimal Ubuntu IP configuration for their needs.
However, the benefits of a static IP in Ubuntu, especially in the 22.04 version, come with responsibilities. Ensuring that these IPs are correctly set up is crucial, as misconfigurations can lead to network vulnerabilities.
So follow the steps below to configure a static IP address on your Ubuntu machine correctly.
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. If you're aiming to set a static IP on an Ubuntu server, this command proves invaluable.
You can get information about your connection with:
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:
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:
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 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 on Ubuntu?
You've now understood how to configure a static IP in Ubuntu, especially in the "Jammy Jellyfish" 22.04 LTS version and 22.10, using both graphical and command-line methods with nmcli and netplan.
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.