Network Cookbook

Query name servers with nslookup

nslookup example.com

nslookup -type=A example.com

Lookup DNS records with dig

dig +trace -t A www.example.com

dig +short example.com

dig +short example.com MX

dig +nssearch example.com

dig example.com

# reverse lookup
dig -x <IP address>

Concatenate the output of different queries:

dig +short example.com;\
dig +short www.example.com;\
dig +short example.com MX

Check a website's IP address

In a shell, use ping:

ping -c1 google.com

-c1 limits the ping to 1 packet.

Output example:

PING google.com (216.58.210.206): 56 data bytes
64 bytes from 216.58.210.206: icmp_seq=0 ttl=53 time=57.619 ms
    
--- google.com ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 57.619/57.619/57.619/0.000 ms

source


DNS quick facts

  • Given www.example.com:
    • example.com is the apex, bare or naked domain
    • www is a subdomain (→ source)
  • An A record points to an IP address
  • A CNAME record point to a different domain (sets an alias)