Name Resolution Files (Demo)

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hello Cybrarians and welcome back to
00:00
the Linux+ course here at the Cybrary.
00:00
I'm your instructor Rob Goelz,
00:00
and in today's lesson we're going to
00:00
be discussing name resolution.
00:00
Upon completion of today's lesson,
00:00
you're going to understand
00:00
>> the purpose of the host file.
00:00
>> We're going to find the nsswitch file,
00:00
nsswitch.conf,
00:00
and determine what we're going to deal with it.
00:00
We're also going to modify resolv.conf file as needed,
00:00
but without further ado, let's
00:00
get going with some demo time.
00:00
[NOISE]
00:00
In today's demo we're going to start here in CentOS,
00:00
and let's go ahead and modify
00:00
our /etc/hosts file as needed.
00:00
Let's look at /etc/hosts as well,
00:00
I'm going to go ahead and just do a less on it actually.
00:00
Inside of this file what we're going to
00:00
see is just a number of
00:00
lines that are used to
00:00
configure local hostname resolution.
00:00
In this system, we really just have one line
00:00
as 127.0.0.1 for CentOS,
00:00
that's a loopback or localhost address
00:00
for it and then I have put in a localhost entry
00:00
for 192.168.1.253 which is
00:00
the IP address that I have for the Ubuntu System.
00:00
Just a neat workaround so that I don't have to use DNS.
00:00
So that I can just go to that system
00:00
directly by just typing Ubuntu.
00:00
So in other words, I can just ping Ubuntu
00:00
and it's going to ping the IP address
00:00
and give me a response.
00:00
Instead of having to go in and say ping 192,
00:00
168, etc.,
00:00
I can just ping the IP address the Ubuntu system.
00:00
Right now I don't have Ubuntu up but we can see
00:00
that this resolves the IP address that
00:00
we have in the host file 192.168.1.253.
00:00
Instead of this system having to go
00:00
out and talk to a DNS server,
00:00
it just talks to the host file.
00:00
In an environment where you have low latency,
00:00
you might choose to use on the host file, exclusively.
00:00
It's commonly used in environments like HPC,
00:00
High-Performance Computing to just put
00:00
all of the IP addresses for all of the servers,
00:00
the static IP addresses for
00:00
the servers in your environment into
00:00
one big file and then
00:00
distribute it between all of the servers.
00:00
So they don't have to use DNS and have
00:00
very quick name resolution
00:00
to find the system that they need to contact.
00:00
Let's move over to the nsswitch.conf file.
00:00
So this is actually found in etc nsswitch.conf so
00:00
let's just do a less on etc/nsswitch.conf.
00:00
I'm going to clear off the screen there with
00:00
Control L, and we'll hit Enter.
00:00
In this file, we can see that the
00:00
nsswitch.conf is used to configure a few things.
00:00
So for instance, we see down here it configures SSS on
00:00
the password file which is a security setting for Linux.
00:00
We can see that also configures
00:00
group membership, net group,
00:00
automated services but for our part,
00:00
we're not really interested in that.
00:00
What we're most interested in is down here.
00:00
We're interested in the host line and the reason we're
00:00
interested in this is because this
00:00
configures the name resolution order.
00:00
It determines what services are
00:00
used in what order for name resolution.
00:00
Most systems, just like our systems,
00:00
will specify files here first and what that means,
00:00
it's going to look at etc host,
00:00
the file we were just in for name resolution
00:00
before it looks at DNS and that, as I said,
00:00
can help you in an environment
00:00
that needs very low latency
00:00
to not have to go out and query DNS to find a hostname.
00:00
Now let's take a look at the last
00:00
file here we're interested
00:00
in today and that's the etc/resolv.conf file.
00:00
Maybe less on etc/resolv.conf and in this file,
00:00
what we have is hostname resolution,
00:00
setting external name servers.
00:00
So each name server,
00:00
which is just another word for a DNS server,
00:00
is specified using a single name server entry.
00:00
On my system I just have 192.168.1.1,
00:00
that's just the gateway for the file system
00:00
that I'm using here but if we wanted to,
00:00
we could actually set up another name server,
00:00
say for instance, the Google name server.
00:00
So we could go into this file with
00:00
sudoedit and we can specify another line
00:00
here and we can specify by saying name server 8.8.8.8.
00:00
That's the Google name server.
00:00
So if we can't resolve something using this IP address,
00:00
the files, we would go to Google
00:00
to get the resolution and in fact,
00:00
we may want to reverse this order.
00:00
We may want to use Google instead
00:00
of [inaudible] for our DNS,
00:00
maybe a little more authoritative and that's
00:00
pretty much how you configure the resolv.conf file.
00:00
In our case, we're just going to quit out of this.
00:00
I don't want to make any changes but that's
00:00
how you get into resolv.conf and
00:00
that's how you see what the name resolution is being
00:00
done for which DNS server.
00:00
That brings us to the end of the lesson today.
00:00
In today's lesson, we covered
00:00
the location and the use of the host file.
00:00
We talked about nsswitch.conf
00:00
and why we might need to modify that if
00:00
you needed to change the order of
00:00
hostname resolution and we also talked about
00:00
resolv.conf and how it's used in
00:00
hostname resolution by configuring the name server,
00:00
the DNS servers that we're going to
00:00
use to do external DNS name resolution.
00:00
But with that being said,
00:00
>> thank you so much for being here
00:00
>> and I look forward to seeing you in the next lesson.
Up Next