DEV Community

Discussion on: 3 ways to get a domain's IP address - Linux Tips

Collapse
 
ferricoxide profile image
Thomas H Jones II

Thing to bear in mind is, 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.