Skip to content

Instantly share code, notes, and snippets.

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

Dig

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 githubutilities.github.io` to resolve hostname to ip(`103.245.222.133`)

curl -I 103.245.222.133
# vs
curl -I 103.245.222.133 --header "Host: githubutilities.github.io"

Github routing

github.io pages is actually a CNAME to github.map.fastly.net., which is used by github to route the traffics.

Answer Section: Five output column fields in Answer Section

| NAME | TTL | CLASS | TYPE | IP |

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 google.com +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>

'google.com ip redirecting is based on http headers(Location: http://www.google.com/`) baidu.com ip redirecting is based on http

> ```

DNS recursive lookup: Trace delegation path

using +trace option in dig

TYPE

  • 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