How to specify which DNS server for gethostbyname/checkdnsrr
Posted: Mon Nov 23, 2009 7:45 am
Functions like gethostbyname and checkdnsrr depend on a DNS server to resolve domain names or find DNS records.
Unfortunately, some providers by default use DNS servers that resolve *any* address, even non-existing ones. Non-existing domain names are typically resolved to some generic bogus advertisement page. Which is real bad practice imho, intended to fool users who make typos.
In my case for example, gethostbyname('non.existing.domain.blablabla') returns '92.242.140.13' which results in this bullcrap
Is there a way I can specify a different DNS server to be used, at script level?
Unfortunately, some providers by default use DNS servers that resolve *any* address, even non-existing ones. Non-existing domain names are typically resolved to some generic bogus advertisement page. Which is real bad practice imho, intended to fool users who make typos.
In my case for example, gethostbyname('non.existing.domain.blablabla') returns '92.242.140.13' which results in this bullcrap
Is there a way I can specify a different DNS server to be used, at script level?