We can use ping
, nslookup
and dig
to get a website's IP:
$ ping google.com
PING google.com((2607:f8b0:4006:819::200e)) 56 data bytes
$ nslookup google.com
Non-authoritative answer:
Name: google.com
Address: 172.217.12.174
Name: google.com
Address: 2607:f8b0:4006:819::200e
$ dig +short google.com -t a
172.217.12.142
source: https://www.howtouselinux.com/post/check-the-ip-address-of-a-website
Notes:
if a given DNS target has multiple A records, your response from (especially) ping
can be quite variable (e.g., if your target has three IPs and there's no record-caching effects in play, each time you ping you could end up with any one of those three IPs being selected).
Both dig
and nslookup
will at least return all the A records ...but are less-frequently installed on hosts.
Things get really if your target's DNS is being managed by a some kind of policy-service. Depending on the actions of that policy-service, you can get really variable responses.