What is DNS?

Projected Time

About 1.5 hours

Prerequisites

Motivation

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.

Objectives

Specific Things to Learn

Materials

Group Lesson

  1. On your command line, enter ping google.com. Let it run for a few seconds, then press control+C. “Does anyone know what ping means?”
  1. DNS lookup: Act out what happens to the request. Literally have one person deliver a “packet,” bouncing from different name servers, like what happens in this video or this comic.

If a browser has a domain name like www.abc.com that it needs an IP address for, it will query these systems in order:

Group Practice

Let’s setup a DNS server locally, it’s easy!

  1. 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
    
  2. 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
    
  3. Edit hosts file to point ‘127.0.0.1’ to ‘whatever.whodat’

Example:

127.0.0.1   myblog.dev
  
  1. ping whatever.whodat

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

Independent Practice

Challenge

Check for Understanding

Form small groups and answer these questions to assess your own understanding: