1 00:00:00,000 --> 00:00:02,520 [No audio] 2 00:00:02,520 --> 00:00:06,150 Hostname and IP address lookup. What 3 00:00:06,150 --> 00:00:08,369 exactly that means is, if you have the 4 00:00:08,369 --> 00:00:10,410 hostname and you want to find the IP 5 00:00:10,410 --> 00:00:14,070 address, how does it work? We do have 6 00:00:14,070 --> 00:00:17,430 DNS, right. And there are protocols that 7 00:00:17,430 --> 00:00:22,950 we run like ping, or we go to a 8 00:00:22,950 --> 00:00:26,580 browser, and we type in the hostname or 9 00:00:26,580 --> 00:00:29,220 the website name. And it resolves to an 10 00:00:29,220 --> 00:00:32,820 IP itself, because those are the type of 11 00:00:32,820 --> 00:00:35,100 protocols that knows that it needs to 12 00:00:35,100 --> 00:00:39,330 resolve IP address first. If you don't 13 00:00:39,330 --> 00:00:40,980 have those protocols, and you just 14 00:00:40,980 --> 00:00:44,550 wanted to know the IP or hostname, then 15 00:00:44,550 --> 00:00:48,003 you will just run the commands like nslookup, 16 00:00:48,003 --> 00:00:51,600 and dig, they're two major 17 00:00:52,050 --> 00:00:54,810 commands or tools that are given to us 18 00:00:54,810 --> 00:00:58,290 in Linux. I believe they are also 19 00:00:58,410 --> 00:01:02,100 available in Windows. I'm sure nslookup 20 00:01:02,100 --> 00:01:04,379 is, but I'm not sure dig is available. 21 00:01:04,410 --> 00:01:07,890 But you could also dig for dig to find 22 00:01:07,890 --> 00:01:12,660 out if dig is available Windows. So what 23 00:01:13,140 --> 00:01:16,560 exactly these tools, or these commands 24 00:01:16,590 --> 00:01:20,070 do for us. Again, they resolve hostname 25 00:01:20,070 --> 00:01:24,180 to IP, IP to IP, or hostname to hostname. 26 00:01:25,740 --> 00:01:28,470 Let's look at them by logging into our 27 00:01:28,470 --> 00:01:33,000 system. I'm logged in to the console. 28 00:01:33,690 --> 00:01:37,620 And the command I will run is nslookup. 29 00:01:38,010 --> 00:01:42,450 When you run this, it will bring me to 30 00:01:43,200 --> 00:01:46,200 its own menu. And if I type here 31 00:01:46,200 --> 00:01:52,920 www.google.com, it is giving me the IP 32 00:01:52,920 --> 00:01:57,900 address of Google. What is right here? 33 00:01:58,410 --> 00:02:01,590 Right here is our resolver. Meaning this 34 00:02:01,590 --> 00:02:05,610 is our DNS server, our DNS server since 35 00:02:05,610 --> 00:02:08,639 we are running our machine local to our 36 00:02:08,639 --> 00:02:12,389 modem, so our modem is our DNS server. 37 00:02:12,750 --> 00:02:16,290 And our modem is also accepting requests 38 00:02:16,500 --> 00:02:21,060 for DNS and DNS port runs on port 53. 39 00:02:21,960 --> 00:02:24,012 And when you see the message here, 40 00:02:24,012 --> 00:02:28,380 Non-authoritative answer, it means that when 41 00:02:28,380 --> 00:02:33,810 I type nslookup for that IP, I, the my 42 00:02:33,810 --> 00:02:36,480 modem does not have the information for 43 00:02:36,480 --> 00:02:40,350 that google.com. It went outside on the 44 00:02:40,350 --> 00:02:42,510 internet to find that information for 45 00:02:42,510 --> 00:02:46,187 me. That is why you see that here Non-authoritative. 46 00:02:46,187 --> 00:02:49,260 If I had the information 47 00:02:49,560 --> 00:02:53,550 for Google saved in my local computer or 48 00:02:53,550 --> 00:02:56,100 in my local DNS server, then I would not 49 00:02:56,100 --> 00:02:59,010 have seen Non-authoritative answer, I 50 00:02:59,010 --> 00:03:00,690 would have gotten the straight name and 51 00:03:00,690 --> 00:03:03,300 IP address. So you could quit out of it, 52 00:03:04,260 --> 00:03:08,010 or ctrl c out of it. Clear the screen. 53 00:03:08,340 --> 00:03:10,770 So you could also run nslookup simply 54 00:03:10,770 --> 00:03:13,650 followed by www. let's say this time, 55 00:03:13,650 --> 00:03:16,980 we'll do hotmail.com. And you will see 56 00:03:16,980 --> 00:03:19,950 the Hotmail IP address is right here 57 00:03:19,950 --> 00:03:27,660 204.79.197.212. If you type this IP 58 00:03:27,660 --> 00:03:30,540 address into the Linux machine or in 59 00:03:30,540 --> 00:03:33,060 your Windows machine, you will get the 60 00:03:33,060 --> 00:03:36,240 host, you will get the page associated 61 00:03:36,240 --> 00:03:38,610 with this IP address. Similarly, the 62 00:03:38,610 --> 00:03:42,630 same command works for dig www.hotmail.com. 63 00:03:42,840 --> 00:03:45,360 And you will get the same answer but a 64 00:03:45,360 --> 00:03:47,760 little differently. So some people use 65 00:03:47,790 --> 00:03:50,220 nslookup, and some people use dig. 66 00:03:50,460 --> 00:03:52,860 Nowadays, a lot of people users are more 67 00:03:52,860 --> 00:03:56,160 inclined toward dig command as compared 68 00:03:56,160 --> 00:03:58,770 to nslookup. nslookup is a very old 69 00:03:58,770 --> 00:04:02,220 utility. and you could get a lot more 70 00:04:02,220 --> 00:04:04,650 information out of dig command as 71 00:04:04,650 --> 00:04:07,680 compared to nslookup. So try nslookup, 72 00:04:07,920 --> 00:04:11,010 or dig command on different websites 73 00:04:11,070 --> 00:04:17,279 like www.facebook.com, and then try to 74 00:04:17,279 --> 00:04:20,430 see if you could get this IP and resolve 75 00:04:20,430 --> 00:04:23,040 it to the page that you go going to. So 76 00:04:23,040 --> 00:04:25,649 any example we could try to open 77 00:04:25,649 --> 00:04:30,300 up our server right here. Oh sorry, our 78 00:04:30,300 --> 00:04:34,200 browser, and in this browser, let's close 79 00:04:34,200 --> 00:04:38,700 some of the tabs. In this browser, I will type 80 00:04:38,700 --> 00:04:40,980 [No audio] 81 00:04:40,980 --> 00:04:45,210 the IP address that shows up for 82 00:04:46,410 --> 00:04:54,702 Facebook, which is 31.13.71.36. 83 00:04:54,702 --> 00:04:58,620 You hit enter. You see it took us to 84 00:04:58,620 --> 00:05:00,990 the Facebook, took us to the 85 00:05:00,990 --> 00:05:06,000 Facebook page. That's how the Internet 86 00:05:06,000 --> 00:05:11,040 DNS works. It does not know the name, it 87 00:05:11,040 --> 00:05:14,760 only knows the IP addresses. But since 88 00:05:14,760 --> 00:05:18,150 we are humans, we tend to remember the 89 00:05:18,150 --> 00:05:21,330 names instead of IP or digits. That's 90 00:05:21,330 --> 00:05:23,520 why it's become easier for us to do is 91 00:05:23,520 --> 00:05:26,550 to use DNS that actually translates 92 00:05:26,550 --> 00:05:29,790 hostname to IP address. So try these two 93 00:05:29,790 --> 00:05:33,000 commands a few times, do run man command 94 00:05:33,030 --> 00:05:36,660 on them, and see how it works. Good luck. 95 00:05:36,660 --> 00:05:38,688 [No audio]