Redirect Specific Domain Outbound Traffic Back to Local LAN
-
I think what I want is a DNS record to turn around the connection back locally. Essentially I have a domain that is forwarded to my home IP address. When at home, I usually connect via the local ip of the server and when away, I use the domain name. I can use the domain name at home, but I'm essentially going out to the internet and coming back to a server that's a few feet away from me. I would like pfsense to detect that I'm trying to hit my domain from my LAN and automatically redirect it to a specific server.
Am I supposed to use the DNS Resolver or DNS Forwarder to accomplish this?
-
I should probably add, I'm currently just using port forwarding on my pfsense box to direct incoming traffic. I am planning on setting up a reverse proxy soon to handle this along with subdividing my domain name for each web server.
-
Am I supposed to use the DNS Resolver or DNS Forwarder to accomplish this?
Does not matter. Set up the host overrides in either of them.
-
Am I supposed to use the DNS Resolver or DNS Forwarder to accomplish this?
Does not matter. Set up the host overrides in either of them.
If I currently have the domain "domain.net" forwarded to my home IP address, would my DNS Resolver Host Override look like?
Host - **leave blank?
Domain - domain.net
IP - **address of pfsense router?UPDATE
My example above worked perfectly. I redirected my own domain name back locally. I successfully tested by disabling the WAN interface and navigating to multiple Host Override domains I created. Works like a charm.
Running a traceroute with the WAN interface enabled gave me some interesting results as it still went out to the internet to resolve the name after pfsense overrode it.
-
"as it still went out to the internet to resolve the name after pfsense overrode it."
Huh?? No it didn't ;) why don't you post up your traceroute..
-
… as it still went out to the internet to resolve the name after pfsense overrode it.
Only if you hit this
by mistake. ;) -
… as it still went out to the internet to resolve the name after pfsense overrode it.
Only if you hit this
by mistake. ;)I had to create 2 host overrides for it to work the way I wanted it to
To override domain.net:
Host - **leave blank
Domain - domain.net
IP - **address of pfsense routerTo override www.domain.net:
Host - www
Domain - domain.net
IP - **address of pfsense routerThanks guys. I'm able to redirect it and keep it local now.
-
Instead of using overrides, an alternative is to add to the 'custom options' of dnsmasq (Forwarder).
From the dnsmasq config example:
# Add domains which you want to force to an IP address here. # The example below send any host in doubleclick.net to a local # webserver. #address=/doubleclick.net/127.0.0.1
Works well when there are disparate domain names that may not be part of your domain, and a blanket override is not suitable.