Hey guys and welcome back. So in the previous nugget we had talked about the ARP table and
the way we could retrieve this information was using the ARP command. Now what I want
to talk to you about is the root command. Now again this is another deprecated command
that we are dealing with but it just so happens that the LPEG2 examination does require we
do have familiarity with these old commands and tools. So we must charge on and learn
how to use it. So that is exactly what we're going to do. Okay so before we actually look
at this command a very brief word on the concept of rooting. So in the previous nugget we actually
talked about how devices actually communicate when they are within the same local network. So
the way we communicate over a local network, devices ultimately talk to other devices using
that MAC address hence why we were relying on the address resolution protocol so that we could
actually ascertain and bind the MAC address information to particular IP address information.
Now what we're going to talk about now is connections between remote networks. This means
connecting to networks that are not the network that you happen to be on. So that would mean
that if you are here, this could be your little computer and you want to speak to the big bad
internet. Well the internet is a collection of many different networks and these are remote
networks. You will be aware that the way you connect to the internet is via a device known as a
router or if you are in America a router and quite simply all this device does is that it holds
information about different networks in something called a rooting table. So if a packet is destined
for a remote network, you send it to the router and the router will look it up in its rooting
table and it will know which interface to send that packet out. Now we also have a concept of a
default gateway. Now all a default gateway is, it is a router i.e. a device that is capable of
reaching remote networks and you set that as your default next hop when you're trying to reach a
remote network. Simply put your local machine, if it does not have rooting capabilities the way an
actual router can, you're not able to reach remote networks but you can reach the router that is on
and present within your local network. That will be the default place you send that traffic to. So
whenever you have a remote destination that you're trying to reach, you don't worry about how to get
there, you just by default send that information to your local router and the router will calculate
the correct path and how to get that traffic to that destination. So like I say integral to this
process is the concept of a rooting table. Now we also have our own form of a rooting table within
our local Linux machine but it's much much simpler than what you would see on a typical enterprise
router that we're talking about. Instead it's just going to have information relating to things like
our gateway and the way we can actually display our rooting table on our little Linux machine is we
can use this root command. Similarly we can also make modifications to the rooting table via the
very same command using particular options and switches. So we can just say root and this is
the information we get right here. What this is saying is that if we do not have another root
specified for a particular packet, the default is to send it simply to the gateway. Now what about
this one right here? For example here we can see if we have a packet that is destined for 192.168.0.0
with a slash 24 mask. What do we do with it? Well it says here we're sending it to 0.0.0.0.0. Now when
we see this in the rooting table what it actually means is that we should just broadcast this
communication over the local network which indeed does make sense. Now notice we also get the
interface related information. If we want to happen to make a manual change to the rooting
table then we can do this by using the root command followed by the option add to add a root to the
rooting table or we can say the word del to delete an entry in the rooting table. So let's say I
wanted to manually add a new root. What I could say is sudo root add and I could specify the
network I want to add. I will say dash net and the network will be 192.168. Let's just say maybe
50.0 with a net mask of slash 24 so that's 255.255.255.0 and now what I want to do is to specify the
default gateway so I'll say GW and the gateway would have to be on our local network so I'll say
192.168.0. something and I will have that as 0.1. So if I hit enter type in my password and I say
root now notice that I actually have manually added this entry here if we want to go to this
network then we send it to 192.168.0.1 which happens to be my default gateway which we can
actually ping right now 192.168.0.1 that is just simply my home router. Now if we want to remove
this entry from the rooting table what I could say is sudo root del net and I'll say 192.168.50
and again the same syntax net mask and the gateways 192.168.0.1 if I hit enter and I now say root
that information of that entry should I say has now been updated and removed so really if you
happen to be having issues connecting to remote networks you could use the root command see that
you do have a default gateway configured and if you want to statically modify the rooting table
to add your own entries as you so wish or remove entries which you believe may be causing you
issues then by using the very same root command you can update the rooting table by either adding
or removing networks or adding or removing gateways as you need but like I say the root
command is indeed deprecated it is not the recommended way to perform such an action anymore
it really is just there for legacy purposes for the examination there is a newer command on the
block which has replaced the ifconfig command as well as the root command and others and that is the
ip command and it's that command that we're going to be looking at next so I hope this has been
informative for you and I'd like to thank you for viewing