Back to lessons

Hosting Operations

Check a Domain A Record

You need to see the IPv4 address a domain currently resolves to.

Command

dig +short example.com A

What changed

Nothing changes. The command queries DNS.

Danger

safe

When to use it

Use this during DNS cutovers, migrations, and stale resolver debugging.

When not to use it

Do not assume one resolver represents every user during DNS propagation.

Undo or recovery

No state is changed.

Expected output

One or more IPv4 addresses.

demo script

Disposable terminal steps

  1. dig +short example.com A
  2. dig +short www.example.com CNAME
  3. curl -I http://example.com

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ dig +short example.com A
203.0.113.10
::exit-code::0
$ dig +short www.example.com CNAME
example.com.
::exit-code::0
$ curl -I http://example.com
HTTP/1.1 301 Moved Permanently
Location: https://example.com/

::exit-code::0

YouTube Short

Check where the domain points.

Before blaming the server, check the A record. The domain may be pointing somewhere else.

LinkedIn hook

The site was fine. The domain was pointed somewhere else.

Question: When a site disappears, do you check DNS before Nginx?

experiments

A/B tests to run

Metric: search_click_rate

A: Check a domain A record.

B: The site was fine. DNS pointed elsewhere.