In this video, we get introduced to DNS in Linux for the absolute beginners.
We will discuss the basic concepts and view some commands that will help us explore DNS configuration
on hosts, specifically Linux.
Hosted at the end of this section, you will go through a practice test where you're given a set of
challenges related to DNS and are asked to solve them on a life practical Hands-On lab environment right
in your browser.
My name is Charlotte Monomyth and this is called Cloud before we get started.
Don't forget to subscribe to my channel for more videos like this.
We have two computers, A and B, both part of the same network, and they've been assigned with IP
addresses, 190 to 168, one or ten and one, not 11, you're able to ping one computer from the other
using the other computer's IP address.
You know that System B has database services on them.
So instead of having to remember the IP address of the system, B, you decide to give it a name DB
going forward, you would like to ping System B using the name DB instead of its IP address.
If you try to ping DB now, you would see that host.
It is unaware of a host named DB.
So how do you fix that?
Basically you want to tell system error that System B at IP address 192 168 one node 11 has a name DB
we want to tell system is that when I say DB, I mean the IP 192 161 dot 11.
You can do that by adding an entry into the ETSI host file on system.
He mentioned the IP address and the name you want your host to see System B as with all system E, that
the IP at 190 to 160 at one note eleven is a host named DB pings to be now get sent to the correct IP
and are successful.
Now there is an important point to note here with all system is that the IP at 100 to 168 one dot 11
is a host named Be Host.
It takes that for granted.
Whatever we put in the ATC hosts file is the source of truth for host it.
But that may not be the truth.
Host It does not check to make sure if systemis actual name is be, for instance, running a hostname
command on System B reveals that it is named host to but host.
It doesn't care.
It goes by what's in the host file.
You can even fool system into believing that System B is Google, just add an entry into the House file
with an IP mapping to Google dot com, then ping Google and you will get a response from System B,
so we have two names pointing to the same system, one as CDB and another as Google.
And we can use either names to read System B.
You can have as many names as you want for as many servers as you want in the ETSI hosts file every
time we reference another hosted by its name from host A through a PIN command or a Central Command
or through any of the applications or tools within the system.
It looks into its ETSI hosts file to find out the IP address of that host.
Translating Hostname to IP address this way is known as named resolution.
Within a small network of few systems, you can easily get away with the entries in the seahorse file
on each system, I specify which are the other systems in the environment, and that's how it was done
in the past.
Until the environment grew and these files got filled with too many entries and managing these became
too hard.
If one of the servers IP changed, you would need to modify the entries in all of these hosts.
And that's where we decided to move all these entries into a single server who will manage essentially
we call that our DNS server and then we point all hosts to look up that server if they need to resolve
the hostname to an IP address instead of its own ETSI host files.
So how do we do that?
How do we point our host to a DNS server?
Our DNS server has the IP 190 to 160 eight one hundred.
Every host has a DNS resolution configuration file at ETSI Resolved.
Can't you add an entry into it specifying the address of the DNS over?
We say name server and point it to one idea to that 168 at one hundred and that should be it.
Once this is configured on all of your host, every time a host comes up across a hostname that it does
not know about, it looks it up from the DNS over.
If the IP of any of the host was to change, simply update the DNS over and all host should resolve
the new IP address going forward.
You no longer need any entries in the XY hosts file in any of the hosts, but that does not mean you
can't have entries in hosts file.
You still can, for example, say you were to provision a test server for your own needs.
You don't think others would need to resolve the server by its name, so it need not be added to the
server.
In that case, you can add an entry into your host at C hosts file to resolve the server.
You can now resolve the server.
However, no other system will be able to do that.
So a system is able to use hostname to IP mapping from the ETSI host file locally as well as from a
remote DNS server.
What if you have an entry in both places, one in your ETSI house file and another in DNS?
I have an entry in my local files set to 100 to 168, one door one one five and someone added an entry
for the same host to one two one six eight one one one six on the DNS over.
In that case, the host first looks in the local ETSI hosts file and then looks at the name server.
So if it finds the entry in the local ATC host file, it uses that.
If not, it looks for that host in the DNS over.
But that order can be changed.
The order is defined by an entry in the file at the switch.
Dot switched off the line with the hosts entry.
As you can see, the order is first filed and then followed by DNS files, refers to the host file and
DNS refers to the DNS over.
So for every hostname, the host first looks into the ETSI hosts file and if it cannot find it there,
it then looks at the DNS over.
This order can be modified by editing this entry in the file.
As part of this order, our host would resolve the test server to one only to one sixty eight one one
one five.
What if you try to bring a server that is not in either list?
For example, I try and pin it on Facebook dot com.
I don't have Facebook dot com in my Etsy host file and I don't have it in my DNS over either.
So in that case it will fail.
You can add another entry into your result or confirm to point to a name server that knows Facebook.
For example, eight eight eight eight eight is a common, well known public name server available on
the Internet hosted by Google that knows about all the websites on the Internet.
You can have multiple name servers like this configured on your host, but then you have to configure
that on all your hosts in your network.
You already have a name server within your network configuration, all the hosts.
So in that case, you can configure the server itself to forward any unknown host names to the public
name server on the Internet.
You should not be able to pin external sites such as Facebook dot com.
Until now, we've been just trying to reach systems with their names like Web, DB, inforce, etc.
But we just tried to pin Facebook at Facebook dot com.
What is this name with a W W W and dot com at the end.
It's called a domain name and it is how IPS translate to names that we can remember on the public internet,
just like how we did for our hosts.
Now the reason they are in this format, separated by dots, is to group like things together.
The last portion of the domain name, the dot coms, the dot net start edu, dot org, etc. are the
top level domains that represent the intent of the website dot com for commercial or general purpose,
dot net for network, dot edu for educational organizations and dot org for non-profit organizations.
Let's look at one in particular, in Google's case, the dot is the route, that's where everything
starts.
Dot com is a top level domain.
Google is the domain name assigned to Google and w w W is a subdomain, the subdomains helping further
grouping things together.
Under Google, for example, Google's map service is available at Maps dot Google dot com.
So Maps is a subdomain Google storage service is available at trial.
Dot Google dot com mobile apps are available at Appstore, Google dot com.
Google's email service are available at mail dot com.
You can further divide each of these into as many subdomains based on your needs.
So you begin to see a tree structure forming.
When you try to reach any of these domain names, say, about dot Google dot com from within your organization,
your request first hits your organization's internal DNS server.
It doesn't know who apps or Google is.
It forwards your request to the Internet on the Internet, the IP address of the server serving Appstore,
Google dot com, maybe resolve with the help of multiple DNS servers, a routine server looks at your
request and points you to a server serving dot coms dot com.
The server looks at your request and forwards you to Google and Google's China server provides you the
IP of the server serving the app's applications.
In order to speed up all future results, your organization's DNS server may choose to cache this IP
for a period of time, typically a few seconds up to few minutes.
That way it doesn't have to go through the whole process again each time.
So that was out in the public.
What about your organization?
Your organization can have a similar structure to, for example, your organization could be called
as my company come and have multiple subdomains for each purpose for external facing website.
Moeldoko, my company larcombe for accessing your organization's mail drive, for accessing storage
paid or company account, for accessing the payroll application, hitcher, for accessing our application,
etc..
All of these are configured in your organization's internal DNS server.
The reason we discussed all of this is to understand another entry in the ETSI Resolved file, remember,
this is the file where we configure the DNS server to be used for our host.
With that, we were able to resolve servers in your organization with just their names like Web.
We have now introduced more standard domain names like Web, dot, my company, dot com or DB that my
company, dot com, etc..
Now when you ping where you can no longer get a response.
Of course, this is because we are trying to ping web, but there is no record for by the name web on
my server.
Instead it is web dot, my company dot com.
So you have to use web dot my company dot com.
Now I can understand if someone outside of a company wants to access our web server, he would have
to use web, got my company dot com.
But within our company, your own company, you want to simply address the Web server by its first name,
web.
Just like how you address other members in your family simply by their first names, which is not the
case when someone outside your family addresses them using their full names.
So what do you do to configure web to resolve my web dot my company dot com?
You want to say when I say web, I mean when my company dot com for that you make an entry into your
house, Etsy and resolve the conflict, call search and specify the domain name you want to append.
Next time you try to ping web, you will see it actually tries web up my company dot com.
Now your host is intelligent enough to exclude the search domain.
If you specified a domain in your query like this, you may also provide additional search domains like
this.
So it would mean when I say web, I mean Web, dot my company, dot com or web or prod, dot my company
dot com.
So your host would try searching all of these domain names when you look for a hostname.
Finally, a word about a record types.
So how are the records stored in the DNS?
So we know that it stores IP to host names that's known as air records.
Storing IPV six to host names is known as Quadir Records.
Mapping one name to another name is called C Name Records, for example.
You may have multiple aliases for the same application, like a food delivery service may also be reached
at eat or hungry.
That's where a C name record is used.
Name to name mapping.
There are many more, but that's all we're going to look at for now.
Now, Paing may not always be the right tool to test DNS resolution.
There are a few other tools as well, such as A. Up.
You can use an S lookup to query a hostname from a DNS server.
But remember, in this lookup does not consider the entries in the local ETSI hosts file.
So if you add an entry into the local SC hosts file for your web application and if you try to do an
annex, look up for that web application, it is not going to find it.
The entry for your Web application has to be present in your DNS server and its lookup only queries
the DNS server.
The same goes with Dick Dick is another useful tool to test the enemy's name resolution, it returns
more details in a similar form as is stored on the server in the upcoming Practice Exercises section.
It will practice between configuring and troubleshooting DNS in a lab environment on actual systems
through some fun and challenging exercises.
Well, that's it for this lecture.
And in the next lecture, we look at how to set up an actual DNS server on a system where we will use
accordionists as our DNS solution.
Well, thank you so much for watching.
And don't forget to subscribe to my channel for more videos like this.