I have an Ubuntu machine that I'm using as my home Internet router. It uses a USB mobile broadband modem as its Internet connection, and shares this with another router (via the router's "Internet" port) which I use as my LAN.
How do I redirect requests from within my LAN for a given URL to a custom IP address (ex have google.com redirect to x.x.x.x)?
Best Answer
The easiest way to come about this is properly installing
dnsmasq
(which is a DNS cacheing server) then in the folder/etc/dnsmasq.d
add a file for each domain you want to redirect.For instance this is the contents of
/etc/dnsmasq.d/hotmail.com
on my system:If I then ask the DNS server for the IP of hotmail.com i get 127.0.0.1 like this:
There are a bit more options you can set, they can all be found described in
/etc/dnsmasq.conf