Advance

Set IP static on Ubuntu 20.04 LTS Server with netplan

Richard 7 Min Read
Set IP static on Ubuntu 20.04 LTS Server with netplan

[Updated on Date: 2021-01-30] A static IP is an IP address that is fixed and does not change. You can set it for your devices that use an IP address to be configured for having a static IP address. Since the network configuration is controlled and managed by netplan in Ubuntu 20.04, join us to review how to set IP static on ubuntu 20.04 LTS Server with netplan. Netplan enables configuring networking on a system via YAML files easily. And processes the YAML and generates the required configurations for either Network Manager or systemd-network the system’s renderer. To buy your own Linux VPS visit Eldernode and find the best suitable package due to your needs.

Recommended Article: How to Manage Files And Folders In PowerShell

To let this tutorial work better, please consider the below Prerequisites:

A non-root user with sudo privileges.

To set up, follow our Initial server setup on Ubuntu 20.04.

Tutorial Set IP static on Ubuntu 20.04 LTS Server with netplan

Using netplan utility as a new command-line network configuration helps you to manage and configure network settings easily in Ubuntu systems.

How to check Interface name

In the first step, you need to check all interfaces on the Ubuntu 20.04 LTS server. Enter the below command for getting the Network Interface Controller name.

ip addr

When you enter the command, you can see your interface name. You need the name for network configuration later.

set ip static on ubuntu 20.04 lts server -1

 

How to Set the IP address on Ubuntu 20.04 server

Go to /etc/netplan directory and check the name of the YAML file.

cd /etc/netplan

After that, you can use the ls command to see the YAML file.

ls

It is time to set IP static on Ubuntu 20.04 LTS Server.

Sudo nano 00-installer-config.yaml

Remember: Do not forget to edit your yaml file.

Type your Static IP and other information like this

network       ethernets:         ens160:          dhcp4: no            addresses: [192.168.100.120/24]            gateway4: 192.168.100.1            nameservers:              addresses: [8.8.8.8, 1.1.1.1]          dhcp6: no       version: 2

Please attention below picture, you will see some space and some rules. If you do not consider rules, netplan can not detect your configuration.

After adding IP static and other information on the file, save, and exit.

Point: you can save and exit with Ctrl + x key and press Enter key twice.

set ip static on ubuntu 20.04 lts server -2

 

Apply configuration with the following command.

sudo netplan apply

Now you can check Network configuration by ping your IP or ip addr command.

set ip static on ubuntu 20.04 lts server -3

 

Also, you could see the video on the Eldernode Youtube channel.

 

 

Conclusion

In this article, you learned how to Set IP static on Ubuntu 20.04 LTS Server with netplan. From now on you can look at the bigger infrastructure by using the static IP to avoid network problems. In case you are interested in learning more, find our related article on How to find server public IP Address in Linux terminal.

View More Posts
Richard
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.
  • Jim Spall
    Jim Spall
    5 months ago

    Hi, very good. How can i be aware about new articles once publishing?

    Reply
  • Romola Reed
    Romola Reed
    5 months ago

    You mentioned how to check Network configuration by ping your IP or ip addr command. Please explain how to assign a static IP address to my phone?

    Reply
    • Dani
      Dani
      5 months ago

      Yes, sure. First tap on the settings icon beside the Wi-Fi network name. Once the pop-up opens, you will see IP settings at the bottom of the menu. The default option is “DHCP”. Tap on it to change the IP configuration.

      Reply
  • Ken Fairbank-Hynes
    Ken Fairbank-Hynes
    5 months ago

    Ifupdown? What is this? How could I install it?

    Reply
    • Dani
      Dani
      5 months ago

      To explain fast, please consider the 3 below steps to go for that:
      Run update command to update package repositories and get latest package information.
      Run the install command with -y flag to quickly install the packages and dependencies. sudo apt-get install -y ifupdown.
      Check the system logs to confirm that there are no related errors.

      Reply
  • Emilia Beard
    Emilia Beard
    5 months ago

    What if we do not prefer to use the netplan?

    Reply
    • Dani
      Dani
      5 months ago

      In this case you should be aware that on a running system, netplan can be removed by installing ifupdown, configuring /etc/network/interfaces manually as users have done before and finally removing the netplan.io package altogether.

      Reply
  • Math Jones
    Math Jones
    5 months ago

    why we use netplan to Set IP static on Ubuntu?

    Reply
    • Dani
      Dani
      5 months ago

      Netplan is a new command-line network configuration utility introduced in Ubuntu 17.10 to manage and configure network settings easily in Ubuntu systems. It allows you to configure a network interface using YAML abstraction.

      Reply
  • Diana Fox
    Diana Fox
    5 months ago

    How Netplan processes the YAML and generates the required configurations?

    Reply
    • Dani
      Dani
      5 months ago

      Since, Ubuntu has switched to Netplan for configuring network interfaces; Netplan is based on YAML based configuration system that makes configuration process very simple. Netplan has replaced the old configuration file /etc/network/interfaces which was used for configuring network interfaces in Ubuntu.

      Reply
  • Phoebe Kent
    Phoebe Kent
    5 months ago

    How can I display all available network interfaces names under Linux operating systems?

    Reply
    • Dani
      Dani
      5 months ago

      You can use the following commands to see all network interfaces under Linux operating systems:
      ip command – It is used to show or manipulate routing, devices, policy routing and tunnels.
      netstat command – It is used to display network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
      ifconfig command – It is used to display or configure a network interface

      Reply
  • Jamie Gale
    Jamie Gale
    5 months ago

    Is setting a static IP addresses in windows same as this ?

    Reply
    • Dani
      Dani
      5 months ago

      You can have a look at our article on (https://blog.eldernode.com/set-static-ip-in-windows-server-2016/)
      But if i want to explain you, please trace below steps: Click Start Menu > Control Panel > Network and Sharing Center or Network and Internet > Network and Sharing Center. Then, click change adapter settings. After detecting your area connection, click properties and Select Internet Protocol Version Again Click Properties and select use the following IP address.

      Reply
  • caroline sives
    caroline sives
    5 months ago

    Dear admin, could you please explain me what is the steps of setting IP static briefly?

    Reply
    • Dani
      Dani
      5 months ago

      Dear user, let’s see this overview together. After selecting the settings of the network interface you wish to configure to use a static IP address, you need to click the settings icon to start configuration. And when you select IPv4 tab, then you will select manual and enter your desired static IP address, netmask, gateway and DNS settings.

      Reply
  • marilyn bisson
    marilyn bisson
    5 months ago

    Should I connect a router overlay to configure a network?

    Reply
    • Dani
      Dani
      5 months ago

      Yes you need. Because the router is the gateway between the Internet and your home network. Also you should Access the router’s interface and lock it down.

      Reply
  • marilyn bisson
    marilyn bisson
    5 months ago

    Is setting a static IP addresses in windows same as this?

    Reply
    • Dani
      Dani
      5 months ago

      You can have a look at our article on (https://blog.eldernode.com/set-static-ip-in-windows-server-2016/)
      But if i want to explain you, please trace below steps: Click Start Menu > Control Panel > Network and Sharing Center or Network and Internet > Network and Sharing Center. Then, click change adapter settings. After detecting your area connection, click properties and Select Internet Protocol Version Again Click Properties and select use the following IP address.

      Reply

Leave Your Comment

Your email address will not be published.

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+18054214518

7 days a week, 24 hours a day