How to redirect a URL to a custom IP address?
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:
address=/hotmail.com/127.0.0.1
address=/www.hotmail.com/127.0.0.1
If I then ask the DNS server for the IP of hotmail.com i get 127.0.0.1 like this:
llp@cerberus:~$ nslookup hotmail.com
Server: 192.168.0.10
Address: 192.168.0.10#53
Name: hotmail.com
Address: 127.0.0.1
llp@cerberus:~$
There are a bit more options you can set, they can all be found described in /etc/dnsmasq.conf
Related videos on Youtube
yuttadhammo
Updated on September 18, 2022Comments
-
yuttadhammo over 1 year
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)?
-
prince over 8 yearsI want to do the same thing, but the problem is I'm behind a proxy. This solution is not working for me.
-
Edik Mkoyan over 7 yearsdid you try cname?
-
vikas027 about 6 yearsIs there a way to add multiple IPs?
-
FindOutIslamNow over 2 years