Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Redirecting LAN DNS

    Scheduled Pinned Locked Moved DHCP and DNS
    14 Posts 3 Posters 645 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      McMurphy
      last edited by McMurphy

      I would like to redirect all DNS requests on the LAN to a specific DNS server 100.96.1.1.

      I have followed this guide:
      https://docs.netgate.com/pfsense/en/latest/recipes/dns-redirect.html

      The guide contains the following which I do not understand
      29.03.2024_17.21.31_REC.png

      My NAT now looks like:
      29.03.2024_16.47.49_REC.png

      Workstation DNS requests to not appear to redirected:
      29.03.2024_17.13.11_REC.png

      johnpozJ 1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator @McMurphy
        last edited by johnpoz

        @McMurphy didn't we just go over how your queries need to be fully qualified?

        And redirecting dot is not going to work.. Not if the dot client is actually doing what it is suppose to do and validate the they are talking to the correct dot server.

        Also why are you redirecting to cgnat IP? even if nslookup added your search suffix.. Are you using cgnat space internally?

        Did you validate that this 100.96.1.1 can even resolve your fqdn?

        Do a directed query to this 100.96.1.1 with your fqdn, does it respond?

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.8, 24.11

        M 1 Reply Last reply Reply Quote 0
        • M
          McMurphy @johnpoz
          last edited by McMurphy

          @johnpoz

          The same outcome if I add the domain name to the hostname.

          The hostname can be resolved when I specify the DNS server manually.
          29.03.2024_17.31.52_REC.png

          johnpozJ 1 Reply Last reply Reply Quote 0
          • johnpozJ
            johnpoz LAYER 8 Global Moderator @McMurphy
            last edited by

            @McMurphy what Ip is what here.. is 192.168.2.254 your lan address? Or some IP on some other network, if your network is 192.168.2 and .254 is not pfsense IP, why would it be sending it to pfsense?

            Also you didn't follow the guide, because the guide is redirecting to loopback, 127.0.0.1 - there are all kinds of odd stuff that can happen when you redirect to some other IP that is not pfsense. Client might get a response from some other IP vs pfsense and not take the response anyway.

            Anywho.. Here created a redirection, works just fine. There is no freaking way 1.2.3.4, which doesn't even do dns would be able to resolve my local resource.. So clearly it was redirect ;)

            redirect.jpg

            An intelligent man is sometimes forced to be drunk to spend time with his fools
            If you get confused: Listen to the Music Play
            Please don't Chat/PM me for help, unless mod related
            SG-4860 24.11 | Lab VMs 2.8, 24.11

            M 1 Reply Last reply Reply Quote 0
            • M
              McMurphy @johnpoz
              last edited by

              @johnpoz

              pfSense: 192.168.2.254
              29.03.2024_17.49.30_REC.png

              I tried to adapt the guide to what I wanted. Following what is in the green box I get:
              29.03.2024_17.56.45_REC.png

              I can't use the pfSense DNS as I need to ensure all queries are resolved by 100.96.1.1 (DNS filtering service) so I am looking for an alternative.

              M johnpozJ M 3 Replies Last reply Reply Quote 0
              • M
                MoonKnight @McMurphy
                last edited by MoonKnight

                @McMurphy
                Are you behind CGNAT?
                Since your DNS is in the RFC6598
                100.64.0.0 - 100.127.255.255

                Why not put some other DNS servers in the "General Setup"
                Are you ISP blocking you for using other DNS servers?

                Or, maybe this one is blocking you?
                1880e92b-8764-451a-9c05-db4b8697231a-image.png

                --- 24.11 ---
                Intel(R) Xeon(R) CPU D-1518 @ 2.20GHz
                Kingston DDR4 2666MHz 16GB ECC
                2 x HyperX Fury SSD 120GB (ZFS-mirror)
                2 x Intel i210 (ports)
                4 x Intel i350 (ports)

                1 Reply Last reply Reply Quote 0
                • johnpozJ
                  johnpoz LAYER 8 Global Moderator @McMurphy
                  last edited by

                  @McMurphy you show your port forward where are you firewall rules on the interface?

                  So you want this 100.96.1.1 to resolve all your external dns then? Just forward to it. And block all your other dns..

                  Now that your saying hey anything but 100.96.1.1 forward to loopback, does unbound forward to this 100.96?

                  In your previous example if pfsense is 192.168.2.254, that would be the lan address. So your ! lan address wouldn't have applied..

                  100.96 as @MoonKnight is pointing out is cgnat - seems like an odd dns to use that filters, since the only way to talk to that IP would be on the isp network that is using that cgnat..

                  Also if your forwarding to this 100.96 address, and it sends back rfc1918, that 192.168.1.12 that would be a rebind, and no psfense would hand you that address unless you turned off rebind protection for that domain. Which is why a directed query would work, but pfsense forwarding to it would not..

                  I take it your domain your hiding is public - having rfc1918 address space in public dns is going to be problematic that is for sure, and is not good practice.

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 24.11 | Lab VMs 2.8, 24.11

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    McMurphy @McMurphy
                    last edited by

                    @McMurphy

                    I can put other DNS servers in the DNS server list however I need all LAN traffic to use the private DNS server that is only available over the OVPN link.

                    Catch 22:

                    • pfSense needs access to a public DNS server to establish the OVPN link
                    • All client devices are to only use the private DNS server
                    1 Reply Last reply Reply Quote 0
                    • M
                      McMurphy @johnpoz
                      last edited by

                      @johnpoz said in Redirecting LAN DNS:

                      @McMurphy you show your port forward where are you firewall rules on the interface?

                      So you want this 100.96.1.1 to resolve all your external dns then? Just forward to it. And block all your other dns..

                      Then pfSense is unable to establish the OVPN link and until established 100.96.1.1 is unavailale

                      Also if your forwarding to this 100.96 address, and it sends back rfc1918, that 192.168.1.12 that would be a rebind, and no psfense would hand you that address unless you turned off rebind protection for that domain. Which is why a directed query would work, but pfsense forwarding to it would not..

                      I have worked out how to disable to rebind and this works however if traffic goes through pfSense to 100.96.1.1 as a Forwarder then I still need a public DNS for the OVPN link to be initially established

                      I take it your domain your hiding is public - having rfc1918 address space in public dns is going to be problematic that is for sure, and is not good practice.

                      Not at all. I simply have a LAN behind a pfSense router and a DNS filtering service that is accessible via an OVPN link on pfSense. I want everything to function like normal but just use the 100.96.1.1 dns server to filter the DNS requests.

                      johnpozJ 1 Reply Last reply Reply Quote 0
                      • johnpozJ
                        johnpoz LAYER 8 Global Moderator @McMurphy
                        last edited by

                        @McMurphy said in Redirecting LAN DNS:

                        I have worked out how to disable to rebind

                        https://docs.netgate.com/pfsense/en/latest/services/dns/rebinding.html

                        An intelligent man is sometimes forced to be drunk to spend time with his fools
                        If you get confused: Listen to the Music Play
                        Please don't Chat/PM me for help, unless mod related
                        SG-4860 24.11 | Lab VMs 2.8, 24.11

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          McMurphy @johnpoz
                          last edited by

                          @johnpoz

                          Yes. I can disable rebind when I use either the Resolver or Forwarder however these do not allow me to force DNS down the private OVPN DNS server.

                          I have read about policy routing but an not sure how it works.

                          A solution would be to have either:
                          a) all DNS queries sent to the private OVPN DNS server 100.96.1.1
                          b) all DNS queries sent over the OVPN interface

                          Can this be achieved with policy routing?

                          johnpozJ 1 Reply Last reply Reply Quote 0
                          • johnpozJ
                            johnpoz LAYER 8 Global Moderator @McMurphy
                            last edited by

                            @McMurphy yes policy routing is how you send a client down a specific gateway, be that a normal gateway or some vpn connection.

                            An intelligent man is sometimes forced to be drunk to spend time with his fools
                            If you get confused: Listen to the Music Play
                            Please don't Chat/PM me for help, unless mod related
                            SG-4860 24.11 | Lab VMs 2.8, 24.11

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              McMurphy @johnpoz
                              last edited by

                              @johnpoz

                              I believe I have two possible solutions Not sure which is best and if there are quicks with either I have not thought of:

                              a) Use policy routing to send all DNS over the VPN
                              30.03.2024_17.27.40_REC.png

                              b) Use NAT to redirect all DNS enquiries to 100.96.1.1
                              30.03.2024_17.26.30_REC.png

                              My preference is (b) if that'll work as expected as the IP 100.96.1.1 will automatically be routed over the VPN

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                MoonKnight @McMurphy
                                last edited by

                                @McMurphy

                                I found this, probably not what you are looking for. But if you are using CloudConnexa as your VPN provider, then I thing you need to change your NAT rule. Try to remove the destination address.
                                https://openvpn.net/cloud-docs/tutorials/configuration-tutorials/connectors/routers/tutorial--configure-a-pfsense-router-to-connect-to-cloudconnexa.html

                                --- 24.11 ---
                                Intel(R) Xeon(R) CPU D-1518 @ 2.20GHz
                                Kingston DDR4 2666MHz 16GB ECC
                                2 x HyperX Fury SSD 120GB (ZFS-mirror)
                                2 x Intel i210 (ports)
                                4 x Intel i350 (ports)

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post
                                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.