Redirecting DNS requests respone issue

  • Hello, I've set up a rule to forward all LAN DNS requests heading externally, not coming from my internal DNS server and the pfsense itself, to redirect to my DNS server.

    This seems to be working correctly, however, I am running into issues like this:

    dig @
    ;; reply from unexpected source:, expected
    ;; reply from unexpected source:, expected
    ;; reply from unexpected source:, expected

    ; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> @
    ;; global options: +cmd
    ;; connection timed out; no servers could be reached

    So I can see for this machine, the request was redirected to, which is the DNS server, but there does not seem to be any masquerading here, the client is aware of the redirect.

    Is there a way to set up a LAN to LAN redirect without exposing this to the client? This might just be a problem for "dig" and other applications like it, but I am worried about some of my IoT devices having issues because they can see their DNS is being redirected.

  • You have to masquerade the requests to the DNS server with the interface address of pfSense, so that return packets are addressed back to pfSense.

  • Cool, how does one go about doing that? My Google-fu is a bit weak today.

  • @z3r0_XG
    That can be done by outbound NAT on pfSense.

    If your outbound NAT is still in automatic mode switch into hybrid mode. Then add a new rule with settings like these:
    Interface: <that one facing to the DNS server>
    source: LAN net
    destination: <DNS servers IP>
    translation: interface address

  • @viragomann WORKED! TYVM -

    dig @

    ; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> @
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 62363
    ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

    ; EDNS: version: 0, flags:; udp: 4096
    ; IN A

    com. 900 IN SOA 1600953019 1800 900 604800 86400

    ;; Query time: 171 msec
    ;; SERVER:
    ;; WHEN: Thu Sep 24 13:10:34 UTC 2020
    ;; MSG SIZE rcvd: 141

    Internal DNS log:

    Sep 24 09:10:34 dnsmasq[25829]: query[A] from
    Sep 24 09:10:34 dnsmasq[25829]: forwarded to 2604:6000:1529:8082:9c5d:c6ff:fe2a:ae3b
    Sep 24 09:10:34 dnsmasq[25829]: validation result is SECURE
    Sep 24 09:10:34 dnsmasq[25829]: reply is NXDOMAIN

Log in to reply