How to easily configure the network in Ubuntu Server with Netplan

Who I am
Pavel Yosifovich
@pavelyosifovich
Author and references

Manage a server

One of those things that everyone should consider at some point to learn, relates to operation of a web server. When we talk about servers, we are not just referring to a web server, as a server can also be used for storing or containing a database, for example.

In this sense, it is important to note that a server fits perfectly into the description of a technological and digital tool, since it should not necessarily be related to a physical device, since the necessary efforts have been made to turn it into a powerful program for facilitate their management.



Let's learn more about Ubuntu Server

One of the most powerful servers you could use is the Linux operating system, more specifically in its Ubuntu distribution.

This open source operating system has great advantages, thanks to the incredible collaboration from its large community of users, which makes important contributions to the improvement and optimization of each of its tools.

So in this case, how about exploring some Ubuntu Server features that will help you set up a network easily? It will just be about putting into practice all the knowledge you will acquire here.

Let's also talk about Netplan

To achieve the goal of configuring a network thanks to the advantages offered by the Ubuntu Server Linux distribution, it is necessary to talk about the most exceptional utility of the aforementioned operating system, namely Netplan.

This tool is the one that will allow you to configure the network, (through simple and quick commands), to which you are connected.

It is important to note that this utility is included within the functions of the operating system, therefore there is no need to perform any type of download or installation to use it.



How to use

Netplan has made network interface configurations a thing of the past by implementing YAML functions to make a configuration file work.

  • The Netplan configuration file may vary depending on the distribution installed. In this case, this file could be located using the command sudo nano /etc/netplan/01-netcfg.yaml.
  • If you don't know the name of your interface, enter the command sudo ip addr to get the information needed to identify it.
  • Once you know the identity of your interface, proceed with using the file 01-netcfg.yaml, even this file may vary in its structure depending on the distribution you have.
  • After the previous step, you will see a series of items related to the network configuration, which can be modified according to your needs. This list must have this structure:
    • Network:
    • version: 2
    • renderer: networkd
    • ethernet:
    • eno1:
    • dhcp4: no
    • dhcp6: no
    • addresses:
    • - 172.1.100.25 / 16
    • gateway4: 172.1.100.0
    • name server:
    • search: [local.domain]
    • addresses: [172.1.100.0]
    • eno2:
    • dhcp4: no
    • dhcp6: no
    • addresses:
    • - 192.168.100.1 / 16
    • name server:
    • search: [local.domain]
    • addresses: [8.8.8.8.208.67.222.222]

Once you have made the changes that you consider relevant or necessary, all that remains is to proceed with the update or restart of the configuration file, for this it is necessary to use the netplan apply command.



Easily configure your network with Netplan!

Thanks to this important utility that is part of Ubuntu, you will be able to configure your network in a much easier way.

For all the configuration carried out by Netplan to be really effective, you must make sure you have all the information of your network, such as the IP address or the netmask. If you no longer have knowledge of these elements, you always can use a network computer for this.


add a comment of How to easily configure the network in Ubuntu Server with Netplan
Comment sent successfully! We will review it in the next few hours.