[No audio]
Hostname and IP address lookup. What
exactly that means is, if you have the
hostname and you want to find the IP
address, how does it work? We do have
DNS, right. And there are protocols that
we run like ping, or we go to a
browser, and we type in the hostname or
the website name. And it resolves to an
IP itself, because those are the type of
protocols that knows that it needs to
resolve IP address first. If you don't
have those protocols, and you just
wanted to know the IP or hostname, then
you will just run the commands like nslookup,
and dig, they're two major
commands or tools that are given to us
in Linux. I believe they are also
available in Windows. I'm sure nslookup
is, but I'm not sure dig is available.
But you could also dig for dig to find
out if dig is available Windows. So what
exactly these tools, or these commands
do for us. Again, they resolve hostname
to IP, IP to IP, or hostname to hostname.
Let's look at them by logging into our
system. I'm logged in to the console.
And the command I will run is nslookup.
When you run this, it will bring me to
its own menu. And if I type here
www.google.com, it is giving me the IP
address of Google. What is right here?
Right here is our resolver. Meaning this
is our DNS server, our DNS server since
we are running our machine local to our
modem, so our modem is our DNS server.
And our modem is also accepting requests
for DNS and DNS port runs on port 53.
And when you see the message here,
Non-authoritative answer, it means that when
I type nslookup for that IP, I, the my
modem does not have the information for
that google.com. It went outside on the
internet to find that information for
me. That is why you see that here Non-authoritative.
If I had the information
for Google saved in my local computer or
in my local DNS server, then I would not
have seen Non-authoritative answer, I
would have gotten the straight name and
IP address. So you could quit out of it,
or ctrl c out of it. Clear the screen.
So you could also run nslookup simply
followed by www. let's say this time,
we'll do hotmail.com. And you will see
the Hotmail IP address is right here
204.79.197.212. If you type this IP
address into the Linux machine or in
your Windows machine, you will get the
host, you will get the page associated
with this IP address. Similarly, the
same command works for dig www.hotmail.com.
And you will get the same answer but a
little differently. So some people use
nslookup, and some people use dig.
Nowadays, a lot of people users are more
inclined toward dig command as compared
to nslookup. nslookup is a very old
utility. and you could get a lot more
information out of dig command as
compared to nslookup. So try nslookup,
or dig command on different websites
like www.facebook.com, and then try to
see if you could get this IP and resolve
it to the page that you go going to. So
any example we could try to open
up our server right here. Oh sorry, our
browser, and in this browser, let's close
some of the tabs. In this browser, I will type
[No audio]
the IP address that shows up for
Facebook, which is 31.13.71.36.
You hit enter. You see it took us to
the Facebook, took us to the
Facebook page. That's how the Internet
DNS works. It does not know the name, it
only knows the IP addresses. But since
we are humans, we tend to remember the
names instead of IP or digits. That's
why it's become easier for us to do is
to use DNS that actually translates
hostname to IP address. So try these two
commands a few times, do run man command
on them, and see how it works. Good luck.
[No audio]