Reputation: 24964
Is there an easy way, on *nix platforms(Linux specifically) to get the IP address of a hostname, while supplying a custom DNS server to use in place of the system's configured one? I want to access this information from a C program.
Upvotes: 0
Views: 269
Reputation: 23542
You will need to use your own resolver, directly sending DNS packets, instead of relying on the system's resolver and gethostbyname
. You would probably want to use a library, such as adns.
Upvotes: 3
Reputation: 842
nslookup <hostname> <dns server>
For example:
nslookup www.example.com ns1.example.com
Upvotes: 2