On a Debian 10 machine, I would like all domain names to resolve to a fixed IP address, except for a handful that should still resolve to their original addresses.
I'm setting up a test environment for an app that does a lot of HTTPS requests to all sorts of domains (think search engine crawler). I have an HTTP server that can deliver canned answers which should receive all those requests, and I cannot instrument the code under test to use a proxy. However, the test machine should still be able to reach Debian's package servers for updates and the git server etc.
/etc/hosts
does not seem to allow wildcards. Setting up bind
looks like a lot of work, and I'm not sure if it covers my use case. Is there any package, or hook in the system I could use?
You can use dnsmasq for this, for instance to resolve all domains to the loopback, except for those to example.com, you'd place the following in
dnsmasq.conf
: