In this video I'll tell you about managing hostname for correct operations. It's important
that Linux hosts have the right name set and also hostname resolution is required
as often reversed host name lookups are performed in communication between hosts.
I would say if ever you see that your system is slow in
whatever it is doing on the network, check on your host name resolution.
First step is to use hostnamectl to set the host name and
configure the etc host file with the appropriate hostname lookup settings.
And at the network level, hostname resolution is handled by DNS, which is Domain Name Services.
DNS is typically taken care of by your network administrator, but as a Linux user
you should know how to configure local hostname resolution using etchosts. Let's check it out.
So what happens if I use hostname? Well,
hostname is showing my hostname linfen.example.org and hostnamectl.
Let's use tab completion that allows you to get information about your hostname. Use hostnamectl hostname if you
want to change it. I already did that and I'm quite happy with it. So I'm just going
to use hostnamectl status where we can see all the information obtained about my current host.
In order to make sure that hostname resolution is set up
correctly, use sudo vim on etchosts. What do we see?
Well, we see localhost and if you want to add a remote host, the only thing you
need to do is to find the IP address and add the host name ubuntu.example.org which is
also known as Ubuntu. It's common that your host names have a long name, the fqdn, the
fully qualified distinguished name, as well as a short name, Ubuntu in this case.
And if everything went all right, well, then I should be able to ping Ubuntu and that's working. So we should be good here.