I think using a fake DNS (eg. 127.0.0.1
) would be sufficient. There's just one problem: it won't solve your problem.
Internet doesn't work on domains, it works on IPs. Domains are an addition that solves the problem of IPs being hard to remember. DNS translates domain names to server IPs. For most protocols you can simply put in IP instead of the domain and it will just work. HTTP 1.1 is an exception - the domain name used is sent in HTTP headers to allow for running multiple domains on one IP. Headers can be easily manipulated and you could still get to any website without DNS.
Oh, and you could simply use an OS-independent DNS resolver.
What you need is a firewall.