About 1.5 hours
Understanding about DNS is important when it comes to IP address or URL of a website. DNS plays an important role in communicating with a website, like, when we enter “www.google.com”, do you know what really happens behind the scenes? Let’s find out.
ping google.com
. Let it run for a few seconds, then press control+C. “Does anyone know what ping means?”
ping google.com
.Its own Operating System. If the domain name’s corresponding IP address isn’t on record, then it will query…
The name server (DNS server) it is set up to use. This is the recursive name server shown above. The name server doesn’t know the IP address for www.abc.com, so it will start the following chain of queries before it can report back the IP address to your computer
Query the Internet root servers to get the name servers for the .com TLD.
Query the .com TLD name servers to get the authoritative name servers for abc.com.
Query the authoritative name servers for abc.com to finally get the IP address for the host www.abc.com, then return that IP address to your computer.
Done! Now that your computer has the IP address for www.abc.com, it can access that host.
(photo and steps are from https://royal.pingdom.com/2009/06/08/a-visual-explanation-of-how-dns-lookups-work/)
Let’s setup a DNS server locally, it’s easy!
Enter sudo vim /etc/hosts
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
discuss output of: ipaddress domain
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost
Edit hosts file to point ‘127.0.0.1’ to ‘whatever.whodat’
Example:
127.0.0.1 myblog.dev
Expected output:
\$ ping myblog.dev PING myblog.dev (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.041 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.089 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.047 ms
Spend 20 minutes watching this video and reading this comic. Take notes if you think it will help.
Find a partner. Without any resources to look at, try to explain the process after your partner asks you, “What happens when you enter google.com in your browser search bar?”
Form small groups and answer these questions to assess your own understanding:
ping
mean and what does it do in the command line?