Skip to content

Instantly share code, notes, and snippets.

Last active Nov 26, 2015
What would you like to do?
dig command


Github pages

Github pages 404 if accessed by entering ip in browser address bar

When we enter hostname in browser address bar, after resolving hostname to ip, the browser also sends the hostname in http header to the resolved ip. This will enable using one ip to serve multiple websites.

# NOTE: use `dig` to resolve hostname to ip(``)

curl -I
# vs
curl -I --header "Host:"

Github routing pages is actually a CNAME to, which is used by github to route the traffics.

Answer Section: Five output column fields in Answer Section


TTL is use to cache the results.

SOA: Is the zone synchronized to all my NS ?

check the serial number which will be incremented on each update of SOA response.

dig +nssearch | cut -d ' ' -f 4 | sort | uniq -c

PTR: Reverse lookup a ip

Mail servers like AOL might use PTR records to verify incoming mail address identities.

# reverse dig ip
dig -x <ip>

' ip redirecting is based on http headers(Location:`) ip redirecting is based on http

> ```

DNS recursive lookup: Trace delegation path

using +trace option in dig


  • A - IPv4 IP address

  • AAAA - IPv6 IP address

  • CNAME - Canonical name record (Alias)

  • NS - Name Servers

  • MX - Mail eXchanges

  • PTR - PoinTeR record. Pointer to a canonical name

  • SOA - Start Of Authority. Authoritative information about a DNS zone

  • TXT - text record

  • About resource records by google

Basic terms about DNS

visit google domain for more infos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment