- In this video
I'll tell you how to manage persistent configuration
for network interfaces.
Now, this is a topic where we have huge differences
between the distributions.
To start it, there is NetworkManager.
NetworkManager is what you use
for persistent interface configuration
on Red Hat Family Linux
and also indirectly on Ubuntu desktop.
We'll talk more about it in just a little bit.
NetworkManager has two main utilities, which are nmtui
and nmcli, where nmtui is a text user interface.
It's a nice text user interface where you can easily
choose your options.
And nmcli is a command line interface.
On Ubuntu server as well as desktop, there is Netplan
and Netplan is used for persistent interface configuration.
Netplan provides a YAML configuration abstraction
for various back-ends.
Based on this YAML file,
back-end specific configuration files are generated.
And now here is the interesting thing.
On Ubuntu server, systemd-networkd is used
as the default back-end to Netplan.
If you would want to use something else,
there's a network renderer option in your Netplan
YAML file, which can be used to specify another back-end.
On Ubuntu desktop, NetworkManager is used
as a default back-end.
Why that difference?
Well, because NetworkManager is very good
at managing wifi connections, which you typically find
on desktops and not so much on servers.
So on Ubuntu server, systemd-networkd
is a standard back-end for managing networking.
It uses one or more YAML files
which are provided by Netplan for the network configuration.
So etc Netplan whatever dot YAML is where you need to go.
And in this Netplan configuration,
a renderer networkd
is used to connect to systemd-networkd.
On modern versions of Ubuntu server,
this is a default setting, so you might not
specifically find this renderer option anymore.
If you don't find it,
then you are safe and systemd-networkd is used.
The Netplan configuration files need to be created manually
for persistent network configuration.
I have an example about that on the next slide.
And the front end for querying network status
is networkctl.
Networkctl is a part of systemd-networkd.
And like many of the other system, the utilities,
it has CTL at the end of the utility name.
So you would use commands
like networkctl status and networkctl up and down.
Now how can we provide Netplan Static IP Configuration?
Well, you create a configuration file that would look
like etc Netplan 99 underscore conflict dot YAML.
And then you can use sudo Netplan apply to activate
and networkctl status to verify.
And this is what the configuration file might look like.
Let me type that for you.
So here we are on Ubuntu server
where I'm going to use
sudo vim etc Netplan
99 dash config dot YAML.
So, we need to define it.
Network version two,
renderer networkd,
and then we have the ethernets.
And in the ethernets, I'm defining ens 33.
Addresses.
And that's the list of IP addresses that you want to assign.
So 10.0.0.11/24, for instance,
or whatever you want it to be.
Then we have gateway four,
and that will be 10.0.0.1.
And we can insert the name servers.
So the name servers typically come with a search parameter.
My domain, comma your domain, or whatever you want it to be.
This is a list by the way.
The square bracket notation is equivalent to using list
and every item separately in the list.
And addresses,
that's where we specify the addresses of the name server.
And there we go.
So now, I can use sudo Netplan apply.
And okay, it's telling us gateway four has been deprecated,
use default routes instead,
but it's a warning and deprecation,
that means that it still works.
So sudo networkctl status is showing
the current configuration.
And in the current configuration,
you can see that we have everything that was just set.
Now, this is how you use Netplan on an Ubuntu server system.
Let's also have a look at the centOS machine
for NetworkManager.
So NetworkManager, that is nmcli or nmtui.
I would advise if you need to do this on the exam,
use mntui.
Nmtui is text user interface.
And as such, it is very intuitive.
So in nmtui, we see the connection
and the connection is a configuration that is connected
to a specific network card.
So, you typically don't want to add or delete connections.
You just go to edit,
and in this edit, you find all the options that you want.
So by default you don't see very much,
and that's because everything is obtained automatically
through a DHCP server.
You wanna change stuff, go to the IPv4 configuration
and make that manual, and then you select show,
and then you can enter all the information
that you want to use.
Now this is so intuitive that I'm pretty confident
that you will figure this out for yourself.
Only one thing to realize,
after editing a connection, you need to activate it.
So go to activate, press enter, press enter,
and then the connection with all the new settings is active.
Last command is nmcli.
Nmcli is a little bit hard,
because it's a command line utility.
But, nmcli is awesome tab completion.
So, as we have just seen, nmcli is working with connection.
So I'm using nmcli connection.
And I'm pressing the tab key twice
and I see all the opposite that are available.
So if I want to edit, for instance,
there we go, edit, tab, tab.
And there we can see the different connections.
So, I want to edit ens33.
Tab tab is not doing anything, so I'm pressing enter.
And here we get the nmcli editor.
And that's also what makes it a little bit complex,
the nmcli utility.
Nmcli is powerful.
But I would say on the exam, don't go use nmcli.
And if you want to use it, man nmcli dash examples.
This is giving you a couple of examples
where you can easily pick out what you wanna do.
As I told you,
NetworkManager is very much for wifi networks.
On a server, you don't wanna do the wifi,
but you see in the examples, there are many wifi examples.
What you probably want to do is something
like what you see in example 11.
I would say,
try it for yourself, if you wanna know more about it,
but on the exam, please focus on nmtui.
That's the difference between spending one minutes
or spending ten minutes on the same assignment.