Is there a way in Linux to make it so when the DNS client looks up information on a DNS name it would return an IP number, even if it does not exist?
I am creating a testing environment, and I want to be able to resolve domain names that do not exist.
I know I can do this in the host file however I do not want to edit this file for every domain name I try to lookup.
Further clarification on my question is this
Scenario 1: I ping google.com
dns lookup google.com
and get the real IP number.
Scenario 2: I ping nonexstiantdoamin.com
it would return local IP number instead of lookup failing.
Depending on what you are trying to accomplish and how you are using the resolver (
– Deathgrip Aug 07 '17 at 15:24dig
,nslookup
,C
Library likeresolver(3)
) you can write a wrapper around the lookup and have it supply IPs when the real solution fails. Still, why would you want to have DNS behave as if broken?