- Another part of networking is the host identity.
So, for correct operations, it's important that the
Linux hosts have the right name set.
Also, host name resolution is often a heart requirement.
As often reversed host name lookups are performed
in communication between hosts.
The main command to manage hostnames is hostnamectl
and you can configure the /et/hosts file with
the appropriate hostname lookup settings.
Let me demonstrate.
So, to start it I'm using hostname,
hostname is the old command.
Hostnamectl is the new command
and host main- hostnamectl status, for instance,
is showing you the static hostname and so much more.
So, the static hostname here seems to be just centos.
Nice thing about hostnamectl is that it is also
telling you information about the operating system
and much more.
Now, if you use sudo hostnamectl,
then you can actually set the hostname.
So, hostname centos.example.com.
And now if I use hostnamectl status again,
then we can see that this hostname has actually been set.
It's up to you.
If you use an FQDN, a Fully Qualified Domain Name.
That includes DNS information as in hostname.example.com
or a short hostname.
Now, in order to enable hostname resolving
there's a configuration file ITC hosts
and I'm going to edit ITC hosts right now.
You can see that by default it only has information
about localhost.
I am going to add 192, 168, 29, 141
for my centos.example.com.
That's the long name and I'm also including the short name,
192, 168, 29, 142, for the ubuntu.example.com
and the short name ubuntu.
Now, what is the result?
The result is at this point I can use utilities
like ping to verify connectivity with my ubuntuhost.
ITC host is convenient, it's for local hostname resolution.
If you wanna be able to do hostname resolution
on internet hosts, that is the system called DNS,
but DNS is not something that we are going to configure
in this course.