Redirect DNS requests for 8.8.8.8 to a local DNS inside a LAN

domain-name-systemiplocal-area-networkredirection

I have a local network (10.0.0.0/24) with a gateway (I'll call it G, IP 10.0.0.1), a device (I'll call it N, IP 10.0.0.31) making DNS requests directly to 8.8.8.8 completely ignoring DHCP setting for DNS, and another device running my DNS server (I'll call it D, IP 10.0.0.2). Both G and D run Linux and I can completely alter their configuration whatever I want. Instead, I can't alter N's behaviour in any way, except from assigning it a different IP address through DHCP.

Now, I'd like to redirect DNS requests coming from N for 8.8.8.8 to D, so D can process that requests and provide DNS results back to N, without N noticing anything. I think that, since the local network and its gateway are under my complete control and since there is no SSL or cryptografy involved with DNS, this should be feasible.

So, how can I accomplish this?

Best Answer

Remeber 8.8.8.8 is an anycast address. You can basically do the exactly same thing Google does for maintaining one of their boxes that serve the 8.8.8.8 traffic.

Assign the IP address 8.8.8.8 as an additional address on the DNS server, and Possibly add a route if necessary directing 8.8.8.8/32 directing the traffic to your that DNS server.