How to redirect custom urls to some local IPs with pfSense



  • Hi there,

    I opened up a ServerFault question here http://serverfault.com/questions/589147/how-to-redirect-custom-urls-to-some-local-ips-with-pfsense when I realized there could be some useful help here :)

    Basically, I'd like to setup a wifi local network and map a certain url to a server on this network. Here is the image of the desired config:

    I've searched again and again in pfSense config (DNS, Firewall, NAT..) but in vain.

    How could I achieve that?

    Thanks a lot



  • You can add a Host Override in DNS Forwarder GUI. That will map the host.domain to the IP address you want. Then the rest of the URL is a reference to some page on that server.



  • Hi Phil,

    That what I thought, I created an entry in DNS Forwarder > Host Overrides

    What I entered:

    | host      |  domain      | IP                |
    –---------------------------------------------
    | myurl    |  myurl.ext  | 172.16.1.42 |

    But then when on my machine I try to ping myurl.ext it fails, while pinging directly the IP works.

    Maybe there is something else to configure with DNS?

    Thanks for your help



  • The entry you made will be for myurl.myurl.ext
    Put myurl in host, and just "ext" in domain.



  • Awesome, that works!! But that was not really clear, below the "domain" field there is a direction "eg: example.com".. Quite confusing.

    Second and LAST question: it works if explicitly on my machine I set up that DNS address to use is the router IP (in my case, 172.16.1.1). In my case, I will have users that just connect leur iPhone to the wifi hotspot and I cannot ask them to specify a specific DNS config in their device.

    What do I have to set up on pfSense side to automatically tell the devices via DHCP that they should use the right pfSense IP as DNS resolver. Dunno if it is clear enough –'

    Thanks



  • Hi there,

    I found in the DHCP config the way to set the right DNS server to connected devices, that work perfectly for me now!

    Alternate question: this is perfectly working on every device connected through rj45 directly to switch connected to pfSense, but not wireless, because my hotspot unifi seems to set its proper sub network and I can't access my server.. I'll try to sort that out alone :)

    Thanks for your help Phil!


  • LAYER 8 Global Moderator

    "below the "domain" field there is a direction "eg: example.com".. Quite confusing."

    How that is a normal domain, with a host in front of it like www. for example then the domain example and the top level domain (tld) com.  You using myurl.ext is using the myurl as host in the TLD ext which not a normal configuration.  host.mydomain.tld would be a more standard configuration.  Use of tld as your domain is not really common practice.


Log in to reply