Hey guys and welcome back. So what I want to talk to you about in this skill right here
is revolving around the concept of troubleshooting, network issues and if you happen to be a
network engineer or a systems administrator you will know that we do happen to get a lot
of issues on the networks. We've been able to troubleshoot those issues is obviously
going to be very very helpful. It's going to make your life much much easier. So definitely
a very useful concept to have under your belt. So with that said let's get to it then. Now
the very first thing that I want to talk to you about in this nugget right here specifically
relates to network configuration files. Now you may be aware that with respect to Linux
we can manage many of our configurations directly via such text files and this is exactly what
I'm talking about right here. We're going to manipulate particular text files with
respect to our network settings. Now for the purposes of the LPIC2 examination there are
some particular configuration files that we do want to be aware of. So let me just highlight
what those are, give you a general description of what they do and we might even get to look at a
few. So let's get to it then. Now the very first one which I want to talk to you about is a
configuration file within the Etsy directory and this is the Etsy hosts file. Now what this
configuration file does is it's going to allow us to associate particular host names to IP addresses.
Now you may be thinking that this sounds pretty much like what DNS does. This is really what we
are talking about here. The difference here is that this particular file is going to be used for
DNS resolution on your local network. So if you happen to have a particular address on your local
network let's say the address is 192.168.0.50 and maybe this is a web server whatever it may be.
Instead you could just type in something like I don't know let's just maybe say my server.cbtn.com
whatever it may be. The point is is that as opposed to having to send a particular request to an
external DNS server to look up this host name and resolve it to that particular IP address we could
just reference particular local files on our system that will do this binding for us. So when we
happen to type in this address it's going to be recognized as a host name within our what's it
called the Etsy hosts file and instead of doing that DNS look up we can just resolve it directly
to the IP address we bind it to within this file right here. Now of course you absolutely can set
up a DNS server for your local network but quite honestly this can be cumbersome it can be additional
complexity that you perhaps may want to avoid especially if you are just dealing with a private
local network this can be a great solution for you. So let me show you what this configuration
file looks like then shall I. Okay so what I will say is nano and I'm going to the Etsy directory
and then the host file notice that if I do not use super user privileges and I enter this file
it's going to tell me that this is unwriteable we know why because it is in the Etsy directory this
is going to be system wide configurations therefore we need super user privileges. Now we can see here
we already have some configurations here now let me just show you what some of these are so say for
example here we have this address 127.0.0.1 now you may recall this happens to be the IPv4
look back address this is super super common you're going to see it everywhere not just my machine
it'll be the same for you too. Now what is happening here is that on the left hand side
let's split this here on this side as the IP addresses and on this side are the host names
so what this actually means here is that if I just happen to type in the word local host that is
going to be resolved to the IP address 127.0.0.1 you see that similarly if I just say IPv0 that is
going to be resolved to the IP address 127.0.1.1 now a little bit below this might look a little
bit more confusing but the reality is it is not confusing at all this is just simply IPv6 configurations
and what we're looking at are hexadecimal based addresses it's still the same concept that on
the left hand side right here we have our IP addresses just IPv6 addresses and on the right
we can see what we are resolving this to so if I would just happen to go and let's say for example
ping one of these host names let's just say ping and I'll just say local host what my machine is
going to do it's going to see this as a host name it's not an actual IP address and it's going to
look in this configuration file right here it's a host it's going to look for this particular entry
in this case it finds it right here and it's going to say what IP address is associated with this name
and it's going to find this value right here 127.0.0.1 in essence that is the address I will ping so
let's just try this out then so if I just escape out here and I just say ping local host and I
hit enter check this out we're actually getting a ping and within the brackets if I just press
control Z to stop this you can see the address indeed is 127.0.0.1 similarly if I just say
ping IPv0 look at this we are also just pinging this address right here so check this out I also
have this other Linux machine here it's actually a windows machine running windows subsystem for
Linux but you can just treat it as a separate Linux machine entirely so I'll just minimize mine
right now and I'll open up my Linux here okay so if I open up this machine and I just say IP adder
and I just grep to filter the results and I will grep for 192.168.0.0 so we can see here this is the
address right here 192.168.0.39 on this machine whereas my main Linux machine if I open it up
we can see this is 0.65 now I can actually ping this machine ping 192.168.0.39 because it is on
the same local network and if I hit this now we can see this pings quite the thing so this means
we have communication between this device here on the right and this device here on the left but
again if I wanted to associate a particular hostname so that I didn't have to maybe say remember the
IP address I could just make a modification in my etsy host files let me just do that right now
what I will do here I'll just full screen this and of course I'm going to have to use super
user privileges to modify this and type in my passwords we'll tell if I typed in the correct
password there we go okay so on the left hand side let me just get some space what I can see here is
the IP address 192.168.0.39 and all I will do in the right here is associate that with a particular
hostname let me just call this trevor box I should imagine this is my good friend trevor's machine
and he's on the same network so I'll just save this right now and I'll escape now I can just say
ping trevor box and to enter and look at this we are successfully pinging this device and we are
pinging 192.168.0.39 we have been able to resolve this by making the modification directly within
this etsy host file really try to remember that now one thing I will say is that when we go in here
we can actually just like we see right here we actually see two entries you see them on the left
we have this here ip6-localhost and ip6-lookback what is happening here is the use of an alias
so what I could do here is I can modify this let's maybe also call this machine2 let's say okay so
that means if I ping machine2 it will resolve to this IP address or alternatively I could refer to
it as trevor box so if I save this and escape out and I just ping machine2 notice this that we're
actually getting a response back now the response actually is saying the IP address here but the
device is called trevor box since that is the first name associated with the IP address but we still
have the ability to refer to this as an alias okay and again we could add as many aliases as we so
wish I could also say for example pizza box and say ping pizza box is still going to get a response
from trevor box at 192.1680.39 so that is one of the big configuration files we have to be aware of
the next one I want to talk to you about is etsy once again same big location and it is the resolve.conf
configuration file and notice this is resolve without an e on the end okay just remember the
spelling here within this configuration file this is well no surprise is the resolver configuration
file and what this is going to allow us to do is going to allow us to specify dns servers as well as
the search domains for the particular host so let me actually show you what this configuration
file will look like then so we will clear the screen if I say sudo nano etsy resolve.conf
let me go up there we go go in here check this out what we're actually seeing here is the ip address
of my name server i.e my dns server so we use the name server keyword here and then the ip address
now this is just going to be a local host lookup you can tell this because it is a 127 based ip
address we're thinking lookbacks here now we have this keyword here called options this allows us to
specify additional options now some options you may see say for example you might see a timeout
option so that would mean that if you happen to specify multiple name servers as opposed to just
one right here you listed maybe say two different domain name servers what you could do with the
timeout option is you could specify the time and seconds that you should wait for a particular
response from a dns server before attempting to go to the next server so what i'm seeing here is if
we happen to use two different servers let's just say we had one at 192 168 1.1 and then maybe we're
also using google's public dns server of 8.8.8.8 we could say a timeout and the options parameter
and set the timeout to 2 that would mean if we happen to send a dns request we would first use
this particular dns server but if we did not get a response back within the two seconds timeout
we would then abandon this and begin to use this to resolve the query now the options parameter is
going to allow us to specify other things as opposed to the timeout things such as the maximum
amount of attempts that we would want to issue i.e the amount of queries before a failure occurs
so let me just modify this configuration file right now if i go in here and i happen to type in
a let's just say a bad address 192 168 0.145 let's just maybe say and i save you an escape if i try
to ping google.com we're not going to be able to get a particular response that is because
we can see here we have a failure in name resolution what is happening is that we're trying to send
this request google.com and have it be resolved quite frankly by a server which does not exist
there is nothing on my local network with this ip address now what i could do is i could in fact
specify google's public dns server this is a very well known dns server of 8.8.8.8 if i save this
this happens to be a real dns server out on the internet so if i now resend this request notice
here but actually now resolving this to a particular ip address we can see this indeed
right here so within this configuration file this is where we specify which dns server we want to use
and we can specify additional options i.e which server to use next after a particular time it
happens or after a amount of failed attempts whatever it may be you can control these parameters
within this configuration file now another configuration file we have to be aware of
this one is debian based specific i.e this is a configuration file you will find on debian systems
and this one is again within the etsy directory not surprising you here and it is in the network
folder and the file is called interfaces so this particular configuration file is the primary
file on debian based systems whereby you can make interface configuration changes so you may recall
we have concepts such as dhcp this is how an interface can dynamically and automatically get an ip
address and alternatively we can statically configure an ip address i.e we actually type the ip
address in ourselves manually if we want to be able to do such things for maybe say a particular
interface say for example if i do an if config we can see this interface right here enp0s3 if we
wanted to make a modification to its ip address such that it would be manually changed or request an
ip address via dhcp the location whereby we could do such a thing again is in the etsy network
interfaces file now on red hat based systems every single interface on your machine say for
example you had eth0 and eth1 and maybe a different look back address whatever it may be each interface
would actually have its own separate configuration file now each of these configuration files will
be found within a particular directory and this is going to be in the etsy directory it will be in
the sysconfig directory and within this it's going to be in a directory called network-corrupts
i'm kind of running out of space here but this directory here is going to have multiple configuration
files for every individual interface as opposed to debian whereby we have one file whereby we
can specify the configurations for all interfaces again just like with the one we saw before we
can make changes to things such as dhcp configuration settings as well as static ip address allocation
just a different way of handling this thing depending on the family of operating system
you're using debian versus red hats now the last configuration file that we do have to be aware of
once this is again in the etsy directory easy to remember that point and it is called the ns
switch configuration file this is the name service switch config file and what this is used to do
it's used to determine which source you should get your dns from and in which order to remember
we had our etsy hosts file this is a configuration file and we would also have our name server which
we found in our resolve.conf file now the question is if i happen to make a request for a name resolution
such as google.com what should i consult first should i actually look in the configuration
file for my local host or should i just go directly to the name server and make a dns request to the
server itself well we can choose our priority by specifying this within xanss switch let me just
show you to do nano xanss switch.conf am i going here we can see the actual process here so look
at this see for this right here host we can see that for looking up hosts we would first consult
our files first and then if we could not resolve that particular host name from our local files we
would then use the dns query now what i actually could do here is i could invert this such that
and of course i'm not actually going to be able to save this because i'm not using super user
privileges but i could just remove this right here and say dns and then files that would mean that
even if we had an entry within the xanss host file configuration it would actually not be looked up
instead we would just send a request to the dns server first and only if that happened to fail and
we couldn't get a response then would we fall back and use our local files and again the order of
which is specified within xanss switch.conf now there actually is more things as you can probably
gather that you can do within this particular file but with respect to the scope of the lpik2
examination this here is really what we are focusing in on okay doc so i do know that was a lot to
take in for these particular configuration files but like i say understanding what these files
actually are and what they can do as well as their particular location is going to give you a lot of
granular control over how your network operates and by having this control and understanding
of the configuration files this is going to go a long way for you to be able to resolve and
troubleshoot particular network issues whether it's ip address allocation or say for example
dns lookups okay doc so i hope this has been informative for you and i'd like to thank you for viewing