• Awards Season
  • Big Stories
  • Pop Culture
  • Video Games
  • Celebrities

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

how to assign static ip ubuntu 20

How to Assign Static IP Address on Ubuntu 20.04 LTS

It is always recommended to assign a static IP address to a Linux system because static ip address will be persistent across the reboots. Recently canonical has released its stable operating system “ Ubuntu 20.04 LTS (Focal Fossa) ” for both desktop and servers. In this article we will demonstrate how to assign a static ip address on Ubuntu 20.04 LTS Server and desktop.

Assign Static IP Address On Ubuntu 20.04 LTS Server

In Ubuntu 20.04 LTS server, network configuration is controlled and managed by netplan utility. But during the installation, cloud-init configure a dynamic ip to interface on server if the dhcp server is available. so, to configure a static ip, first we must make sure and confirm that network interface is not managed by cloud-init.

Open cloud-init file “ /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg ” and make sure entry “ network: {config: disabled} ” is there. In case this entry is missing, then add it manually.

Use “ ip addr show ” command from the console to view ip address,

ip-addr-show-dynamic-ip-ubuntu-20-04-server

As we can see above, a dynamic ip is assigned automatically on interface card “ enp0s3 ”. So, to make this ip address static, we must edit the netplan configuration file “ /etc/netplan/00-installer-config.yaml ”.

Above are the default entries, which shows that interface “ enp0s3 ” is getting the IP from DHCP server. As it is an yaml file, so while making the changes in the file we must follow correct indentation. Add the following lines to the yaml file,

save and close the file.

Updated-netplan-yaml-ubuntu-20-04-server

Run the following “ netplan apply ” command to make the above changes into the effect.

Now run “ ip addr show ” and “ ip route show ” command to view ip address and route details.

Output of above command would look like below,

ip-addr-show-route-ubuntu-20-04-server

Perfect, output confirms that Static IP has been assigned successfully on interface ‘ enp0s3 ‘. Even if we reboot the server, this ip address will be consistent.

Now, let’s move to Ubuntu 20.04 LTS desktop.

Assign Static IP Address on Ubuntu 20.04 LTS Desktop

Network configuration in Ubuntu desktop is controlled by network manager. Configuring a static ip address on Ubuntu 20.04 desktop is very easy. Login to your desktop environment and click on network icon and then choose wired settings .

network-icon-ubuntu-20-04-lts-desktop

In the next window, Click on ‘ gear box ’ icon under wired option,

Gear-box-icon-Ubuntu-network-icon

In the next window, Choose IPV4 Tab and then select Manual and specify the IP details like IP address, netmask, gateway and DNS Server IP.

Static-IP-Ubuntu-20-04-LTS-Desktop

Click on Apply to save these changes and we must disable and enable interface once to assign the ip address to interface.

Once you enable and disable the interface then static IP should be assigned to the interface, we can verify by looking at the Details Tab from Wired Settings .

IP-Details-Ubuntu-Desktop-Ubuntu-20-04-LTS

Perfect, above confirms that static ip address has been assigned to the interface successfully. This conclude the article; I hope these steps help you to configure static IP Address on your Ubuntu 20.04 LTS server and desktop. Please do share your feedback and comments.

12 thoughts on “How to Assign Static IP Address on Ubuntu 20.04 LTS”

Thanks for the excellent article, It is always recommended to assign a static IP address to a Linux system because static ip address will be persistent across the reboots. that is understood. where exactly i see the advantage of assigning static ip address to my linux desktop? How circled point 3, 4, 5 in IPv4 tab are assigned, especially entries 192.168.1.210 and 255.255.255.0. If these two are explained, then it will be great.

ok, ifconfig and netstat -r gives netmask and gateway. but still i would like to know the advantage of assigning static ip address to my linux desktop preferably with example applications. thanks.

Imagine you open a network service on your linux desktop, let’s assume it is a web server running on port 80, and you want to expose this service to the internet.

You would have to add a port translation rule into your internet box to forward connections on your public ip to your linux desktop system. And the configuration in the box is static, you need a fixed and consistent ip addr on your internal network.

You achieve that either with static ip that you assign by yourself, or by configuring the dhcp server inside your internet box to reserve an ip associated to your linux destop mac address.

Hi Narayan, If your desktop is connected to the modem or a switch where DHCP server is configured with subnet “192.168.1.0/24”. So when your desktop tries to get ip from DHCP server then it will always picks one ip from the pool “192.168.1.2 – 192.168.1.254” . But if you want to map a fixed ip to desktop then you can assign that IP as static.

$ip addr show just hung my SSH session. I don’t know how long it will take to time out.

nice but i cannot follow your tutorial cause i just using phone Hehe

Thank You Very Much My Problem has fixed now All credit goes to you 🙂

Hello, I’m running ubuntu server 20.04 on a hyper-v environment, i did all steps in the page, but when I want to run update, can´t connect to internet. Please help.

I got the same problem. I’m running ubuntu 20.04 on virtualbox. I fixed it by changing the “gateway4: 192.168.1.1” to “gateway4: 192.168.0.1”. Flipping the 1 to a 0, or to the same number as the one in my own ip in that place. Happy debugging!

Thanks for the good informations…

Useful article. I am using usb broadband modem and for my case it was also useful to use such command to find out default gateway $ ip route | grep default It has given: default via 10.1.1.3

I saw this link at askubuntu.com I was having issue statically assigning IP in ubuntu and after following your steps it worked. Thanks so much and keep it up

Leave a Comment Cancel reply

How to Configure Static IP Address on Ubuntu 20.04

how to configure static ip address on ubuntu 20.04

A static or fixed IP address is an IP address that does not change. Whether you reboot your device or home router, your device with a static IP address will get the same IP address. The opposite of a static IP address is the dynamic IP address. A device that does not have a static IP address will get a dynamic IP address assigned by the DHCP (Dynamic Host Configuration Protocol) server, and it may change from time to time.

configuring static ip address on ubuntu 20.04

By default, a device connected to your home router whether it’s using cable or connected through WiFi will most likely get a dynamic IP address. And, if you use your managed Ubuntu VPS also as an FTP server of web server you would want to configure a static IP address for it, so 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.

Configure Static IP Address on Ubuntu Server 20.04

In Ubuntu server 20.04, the network configuration is managed by a utility called NetPlan. NetPlan is a new network configuration tool introduced in Ubuntu 17.10 to manage network settings. And during the Ubuntu 20.04 server installation, cloud-init will configure a dynamic IP address for the network interface on the server if the DHCP server is available.

First of all, we need to check what is the ethernet interface card that we want to configure the IP address for, we can run ip a or ip link command to see it. In this example, the interface that we are going to configure the static IP is ‘ens33’.

how to set up static ip address on ubuntu 20.04

To proceed with configuring a static IP address on Ubuntu server 20.04, we have to make sure that cloud-init does not manage the network interface. To do it, let’s open cloud-init file at /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg and make sure that “network: {config: disabled}” entry is there. If the entry is missing, we have to create it.

Now, to configure a static IP address, we need to modify the YAML configuration file at /etc/netplan/00-installer-config.yaml. Please note, when editing a YAML file, make sure you follow the YAML code indentation standards. The suggested syntax for YAML files is to use 2 spaces for indentation, do not use TABS. If the indentation and syntax are incorrect, the changes will not work.

configure static ip address on ubuntu 20.04

As seen in the file, DHCP is available and the server is getting the IP address from the DHCP server. To change your server IP address, for example to 192.168.1.100, let’s back up the file /etc/netplan/00-installer-config.yaml

and open the file

to replace the content of /etc/netplan/00-installer-config.yaml above with these lines.

When editing the file, make sure the ethernet interface match with the one we see when invoking the ‘ip a’ or ‘ip link’ command.

To check the new configuration file without applying the changes, we can run this command:

If everything is okay, you will see a message as seen in the picture below. You can hit ENTER to accept the changes or leave it to revert the changes back to the previous configuration.

set up and configure static up address on ubuntu 20.04

Configure Static IP Address on Ubuntu Desktop 20.04

Most modern home routers have configuration options to allow you to reserve an IP address for a specific device connected to the same network. With this option in your home router, your devices on the network will get static/fixed IP addresses. This is the easiest and most recommended way to assign an IP address to your device, and this is called static DHCP or DHCP reservation.

If you do not want to configure it on the router, you can do it on the device itself. At this moment, we will show you how to configure a static IP address on Ubuntu desktop 20.04. Let’s click on the network icon on the top right of your screen.

ip address configuration on ubuntu 20.04

Clicking the icon will bring you to the new window, as seen in the picture below

Now just  $ 43 .99 /mo

configuring a static ip address on ubuntu 20.04

In this example, we will configure the static IP address for the wired connection. So, we need to click on the cog icon next to the on-off slider in the wired connection section. To configure your WiFi connection, then you need to click on the cog icon in the WiFi connection section.

This will open a new window, click on the IPv4 as shown in the picture below

how to configure and set up a static ip address on ubuntu 20.04

In the next window, choose “Manual” in IPv4 Method and fill the following information in the forms

setting up static ip address on an ubuntu 20.04

You can leave the DNS part blank if you want to set it to automatic or use your own DNS address, separate the IP addresses with commas, for example, 1.1.1.1, 8.8.8.8 , then click on the APPLY button above.

Congratulations! you have successfully configured a static IP address on Ubuntu 20.04.

Of course, you don’t need to configure a static IP address on Ubuntu 20.04 yourself if you use one of our Linux VPS Hosting services and have additional IP addresses. In which case you can simply ask our expert Linux admins to configure and set this up for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on How To Configure a Static IP Address on Ubuntu 20.04, please share it with your friends on social networks, or simply leave a reply below. Thanks.

Leave a Comment

Save my name, email, and website in this browser for the next time I comment.

How to Configure Static IP Address on Ubuntu 20.04

Mostly when a user connects to a network through WIFI or eternal cable, the DHCP server automatically picks and assigns IP addresses to the system. Here the downside is that once the lease time of DHCP expires, another IP address is assigned to the system.

Such changes might cause disconnection of the system and due to this it’s recommended to set static IP addresses to the system so that the ip addresses do not change even when the lease time has expired. In this guide, we’ll tell you about how to configure a static IP address on Ubuntu 20.04.

Static IP Configuration on Ubuntu Server

The Ubuntu system uses predictable network interfaces names to identify the interfaces of the network. Firstly, to set up a static IP address we need to identify the name of the interface that we want to configure. For this we will use “ ip_link ”.

This will print out all the available network interfaces such as “ enp0s3 ” that we’ll configure.

how to assign static ip ubuntu 20

Netplan is used as a default network management tool by Ubuntu and its files are written using YAML syntax with extension of “ .yaml ”. In order to configure the interface with Netplan a yaml description is needed to be created and the required configuration files for that particular render tool will be generated by Netplan.

Configuration file of Netplan is stored in “ /etc/netplan ”. Here there might be some YAML files with the names “ 01-netcfg.yaml ”, “ NN_interfaceName.yaml ” or “ 50-cloud-init.yaml ”, but they differ in each system.

Now, we need to disable cloud instances just in case your Ubuntu is provisioned with cloud-init.

This will open the file, in it write the following.

how to assign static ip ubuntu 20

Now, we need to assign an IP address and for this open the configuration file of the YAML file.

This will open the configuration file in which you need to add the following:

Here you need to understand some key points:

  • Each YAML file of Netplan is supposed to start with “ network ”.
  • Networks contain a minimum two elements.
  • Here, the first element is the network configuration format’s version.
  • Second element is device type which can be ethernets, VLANS or bridges.
  • Renders: Incase ubuntu was installed in server mode, render use networkd as back end.

how to assign static ip ubuntu 20

In this under ethernets you can define various interfaces. We defined “enp0s3” that obtains an IP address from dhcp4. Now, in order to assign “enp0s3” an IP address which is static we will edit the file:

  • Set no to dhcp4 which is a DHCP server.
  • Give a static IP address using addresses: and provide one or more IPv4 or IPv6.
  • Specify gateway
  • Set the IP address of nameserver under nameservers .

how to assign static ip ubuntu 20

After this save the file and run the below command in order for the changes to apply.

how to assign static ip ubuntu 20

Now after everything is completed, verify the changes using the command provided below.

how to assign static ip ubuntu 20

That’s all, you’ve successfully provided a static IP address to your Ubuntu server.

The easiest way to assign a static IP address is through Ubuntu Desktop as you do not need any technical knowledge as well as no worry about syntax. All you’ve to do is select Settings and go to the Network or WiFi tab. Select the cog icon next to the interface and go to IPv4 tab and there select manual and provide IP address.

how to assign static ip ubuntu 20

After this select Apply and in order to verify run the command below.

how to assign static ip ubuntu 20

In this you can directly assign a static IP address through Ubuntu Desktop as well as through the command line.

Assigning static IP addresses is beneficial as the IP address won’t change even when the lease has expired. This can be done through various ways. In this guide we showed you how to assign static IP addresses through Ubuntu server as well as through Desktop.

Personally the easiest way is through Desktop as it doesn’t require a lot of technical knowledge and involves just a few steps. Now following this guide you can assign a static IP address to your system.

TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY

[email protected]

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.

Pre-requisites:

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:

image-14

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.

image-15

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   8.8.8.8 which is Google's primary DNS server and the second value is 8.8.8.4 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.

image-17

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.

image-16

  • Verify by using the command ip a

image-18

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

LinuxOPsys

Configure Static IP Address on Ubuntu 20.04 (Server CLI and Desktop)

how to assign static ip ubuntu 20

In your IT environment, sometimes you may be compelled to configure a static IP instead of relying on the DHCP protocol. A perfect example is when you are setting up a Ubuntu server to act as a file or a web server for your organization. A static IP, as the name suggests, ensures that the IP address of your system remains unchanged. With DHCP, the IP address changes once the lease time for the IP address expires and this is undesirable for servers.

In this guide, we will explore two ways of manually assigning a static IP on Ubuntu 20.04. We will demonstrate how you can configure a static IP on an instance of Ubuntu server and Ubuntu desktop.

Assign a static IP on Ubuntu server 20.04

From Ubuntu 17.10 and later versions, networking is controlled by the Netplan feature. The configuration files for Netplan are located in the /etc/netplan directory and are written in YAML. Inside this directory, you will find YAML configuration files labeled either 50-cloud-init.yaml , or 00-installer-config.yaml .

However, If you are running a cloud instance of Ubuntu, chances are that it is managed by cloud-init which auto-assigns it an IP address by leveraging the DHCP protocol. Before we proceed further, you need to disable cloud-init. To achieve this, open the subiquity-disable-cloudinit-networking.cfg cloud-init configuration file in the /etc/cloud/cloud.cfg.d/ directory

Set the ' network ' directive to ' disabled '.

Save the changes and quit. Next, head over to the Netplan configuration file. In my case, I have the 00-installer-config.yaml file.

how to assign static ip ubuntu 20

From the configuration file, we can see the ' network' directive that has 2 elements. The first one is the ' ethernets ' which specifies the network interface and the second one is the version of the renderer which is ' systemd-networkd ' for non-GUI instances and NetworkManager for Ubuntu desktop ( With GUI )

Default Netplan configuration file

We are going to set the ' dhcp4 ' value to ' no ' to disable the DHCP protocol and specify the interface's Static IP as follows.

To assign a static IP address to  ens3  interface, modify the file as follows:

  • Specify the static IP address of the server. in the   addresses : section, specify an IPv4 address to be assigned to the network interface.
  • Next, Specify the gateway.
  • Under  nameservers , specify the DNS or IP addresses of the nameservers. Here, we have specified Google's DNS which is 8.8.8.8 and the Router's IP.

Set Static IP on Ubuntu 20.04

Save the YAML file and exit. To apply the changes made, run the command:

You can use the ifconfig or ip command to verify that your network interface is set to use the static IP configured moments ago.

Netplan apply

Additionally, you can use the IP route show command to display the new routes on your system.

Show IP routes on a Linux system

Perfect! We have successfully configured a static IP on the Ubuntu server. Let's now switch gears and see how you can replicate the same on Ubuntu Desktop 20.04

Configure Static IP on Ubuntu 20.04 Desktop

If you are running a Desktop GUI, then configuring a static IP should be quite easy. Click on the ' Network icon ' at the top right corner of your screen and select the 'Wired Settings ' option.

Select Wired settings option

This opens the 'Network ' configuration page. In the 'Wired ' section, click on the gear wheel icon.

Network settings page

This displays a summary of your current IP configuration. By default, the system obtains its IP configuration via the DHCP protocol. We will change from using DHCP to Manual.

Ubuntu Desktop IP configuration

So, click on the ' IPv4 ' tab which directs you to this section. As anticipated, DHCP is turned on.

IPv4 configuration on Ubuntu 20.04

Switch from ' Automatic (DHCP) ' to ' Manual '. Then specify the static IPv4 address including the netmask, gateway, and DNS servers. To save the changes, click on the ' Apply ' button.

Configure static IP Ubuntu 20.04

Head back to the ' Network' section and restart the networking service by toggling off and on.

Restart NetworkManager on Ubuntu 20.04

Once again, click on the gear wheel icon and confirm that the static IP settings have reflected.

Confirm static IP settings

And it's as simple as that. We have successfully configured a static IP on Ubuntu Desktop.

Ubuntu, like most other systems, comes configured with DHCP to obtain an IP from the DHCP server, or router. In this guide, we have covered how you can apply static IP settings on command-line and using the GUI. Before setting a static IP, it's always recommended to reserve the IP that you want to assign to your server on the router. Equally important is to ensure that no other client system is using that IP address to avoid an IP conflict.

If this resource helped you, let us know your care by a Thanks Tweet. Tweet a thanks

Like

Sorry about that.

About The Author

James kiarie.

James Kiarie

James Kiarie is a skilled and certified LPIC Linux administrator with a strong passion for technical writing, specializing in the Linux domain. With over four years of experience, he has crafted numerous technical guides, helping a wide audience navigate through various Linux distributions.

Nmap to Scan Open Ports – Examples + Screenshots

How to List Network Interfaces in Linux

How to Get IP address in Linux

How to Permanently add Static Route in Linux

Ping IPv6 Address from Windows and Linux CLI

How to Check Ports in Use in Linux (Listening Ports)

Tshark Examples with Cheat Sheet

How to Learn Linux – A Master Guide

13 Modern Alternatives to Linux Commands

Basic Linux Commands You Should Know

14 Command Line Tools to Check CPU Usage in Linux

13 Cool Things to Do with Linux

Leave a Reply

Leave a comment cancel reply.

foofunc.com

How to add a Static IP address in Ubuntu 20.04 server

Table of Contents

As a system administrators, we have seen many instances where we need to set up an IP address. In this article, we are going to see how to configure static IP addresses in Ubuntu 20.04. We will discuss two strategies here one with CLI and the other with Netplan

IP configuration to assign

We want to assign the following IP address to the network device  enp0s31f6 (See the find network interface section )

  • IP  address:  192.168.1.2
  • Subnet Mask  :  255.255.255.0
  • Default gateway :  192.168.1.1

Find network interface

In order to set up a static IP address. The first step is to identify the name of the ethernet interface you want to configure. To check out the interface list below-mentioned command lists all the interfaces in the system.

Below code section is the output of the command.

In this article we will configure enp0s31f6 network interface.

Configuring Static IP through CLI

To set the above IP address we will use the IP command. See the below-mentioned command to set the IP address and route.

The output of the above command is shown in the below code section.

Configuring Static IP through Netplan

In the earlier configuration, we set the IP address through CLI which is not persistent. The right way of doing configuration is doing by Netplan.

Netplan related Configuration files can be found in the /etc/netplan directory. /etc/netpan directory has multiple YAML files. In ubuntu 20.04 server it named as 01-network-manager-all.yaml. Name is different setup to setup this file can with 01-netcfg.yaml and 50-cloud-init.yaml name.

To assign a static IP address on the network interface, open the 01-network-manager-all.yaml configuration file. Configuration file look like shown in below mention snapshot

Add the following entry into the file

Now the whole file is mentioned in the code section

Once done, save the file and apply the changes by running the following command:

Use the ipconfig -a or ip a command to list all interface and check the IP address assigned or not

In this article, we have seen how to set up a static IP address from the command line as well as from the Netplan configuration file.

In case you face any issues don’t hesitate to comment.

Related posts:

how to assign static ip ubuntu 20

11 thoughts on “How to add a Static IP address in Ubuntu 20.04 server”

' src=

Superb post but I was wondering if you could write a litte more on this topic? I’d be very grateful if you could elaborate a little bit more. Appreciate it!

' src=

Hi Catalina, Thanks for the feedback.

' src=

Your style is very unique compared to other people I have read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess I will just book mark this web site.

Hi Brayden,

Thank you for your comment, I really appreciate it. Sure, I will keep posting new articles.

Warm Regards,

' src=

Amazing! Its in fact awesome post, I have got much clear idea regarding from this article.

' src=

Nice post. I was checking continuously this blog and I am impressed! Very useful information particularly the last part : ) I care for such information a lot. I was looking for this particular info for a long time. Thank you and best of luck.

' src=

Say, you got a nice blog post.Really thank you! Cool.

' src=

Your style is so unique in comparison to other folks I ave read stuff from. Thank you for posting when you have the opportunity, Guess I all just bookmark this page.

' src=

Very good article.Thanks Again. Great.

' src=

Excellent post.

' src=

I cannot thank you enough for the article post.Thanks Again. Cool.

Leave a Comment Cancel Reply

Your email address will not be published. Required fields are marked *

Name (Optional)

Email (Optional)

Save my name, email, and website in this browser for the next time I comment.

IMAGES

  1. How to Assign Static IP Address on Ubuntu Linux

    how to assign static ip ubuntu 20

  2. How to Configure Static IP Address on Linux System

    how to assign static ip ubuntu 20

  3. Set IP static on Ubuntu 20.04 LTS Server with netplan

    how to assign static ip ubuntu 20

  4. How to Assign Static IP Address on Ubuntu Linux

    how to assign static ip ubuntu 20

  5. How to Configure Static IP Address on Ubuntu 20.04

    how to assign static ip ubuntu 20

  6. How to Configure Static IP Address on Ubuntu 20.04

    how to assign static ip ubuntu 20

VIDEO

  1. แก้ Static IP ubuntu server

  2. How to configure static IP Address via command line on windows 11?

  3. How to Set Static IP in Ubuntu Server 20.04. Change and configure ip adress using putty

  4. How to set a static IP Ubuntu 22.04 LTS (3 ways)

  5. How To Configure Static IP in Ubuntu 18.04 Desktop

  6. Tutorial: How to install no-ip client in Ubuntu (2015)

COMMENTS

  1. How Do You Keep an HP Printer From Going Offline?

    To keep an HP printer from going offline, move it closer to the router when connected to a wireless network. Alternatively, use a network cable that fits firmly into the printer and computer for a cable connection, give the printer a static...

  2. 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.

  3. Where Is My IP Address Stored on My Computer?

    The location of an IP address is usually found in your computer’s network diagnostics or Internet connection settings. Though this information is stored by your computer, it is assigned by your Internet provider or LAN router.

  4. How to Configure Static IP Address on Ubuntu 20.04

    Configuring Static IP address on Ubuntu Server # · Set DHCP to dhcp4: no . · Specify the static IP address. Under addresses: you can add one or

  5. How to Assign Static IP Address on Ubuntu 20.04 LTS

    Assign Static IP Address on Ubuntu 20.04 LTS Desktop · network-icon-ubuntu-20-04-lts-desktop. In the next window, Click on 'gear box' icon under

  6. How to Configure Static IP Address on Ubuntu 20.04

    And during the Ubuntu 20.04 server installation, cloud-init will configure a dynamic IP address for the network interface on the server if the

  7. How to Configure Static IP Address on Ubuntu 20.04

    Select the cog icon next to the interface and go to IPv4 tab and there select manual and provide IP address. After this select Apply and in order to verify run

  8. Configuring Ubuntu 20.04 to use a Static IP Address

    Using DHCP Reservation to Set a Static IP Address. The best possible way to set a static IP address to your Ubuntu 20.04 device is to use DHCP

  9. Configure static IP address on Ubuntu 20.04

    Join the Partner Program and earn for your writing. Try for $5/month. Linux Server · Ubuntu 20 04 · Ubuntu 18 04 · Netplan · Yaml · Amelye Chatila. Follow

  10. Setting a Static IP in Ubuntu

    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

  11. Configure Static IP Address on Ubuntu 20.04 (Server CLI and

    Assign a static IP on Ubuntu server 20.04 · Specify the static IP address of the server. in the addresses : section, specify an IPv4 address to

  12. Ubuntu Server: Настройка статического IP-адреса

    Если у вас после сохранения файла не появилась ошибка типа: Error while loading /etc/netplan/00-installer-config.yaml , то файл отредактирован

  13. How to add a Static IP address in Ubuntu 20.04 server

    In this article, we are going to see how to configure static IP addresses in Ubuntu 20.04. We will discuss two strategies here one with CLI and the other

  14. Set Static IP on Ubuntu 20.04

    To set a static IP address, we will use a command-line utility. The utility is called Netplan and was developed by Canonical. Netplan configures