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

    DNS Block and Redirect for IPv6

    Scheduled Pinned Locked Moved DHCP and DNS
    21 Posts 3 Posters 223 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.
    • A
      aGeekhere @Gertjan
      last edited by

      @Gertjan That is what i thought however
      948704d3-8efe-47cb-ac4e-1221565de523-image.png

      However i get hits from the reject rule in the logs
      LAN [2403:5801:13b9::220]:55984 [::1]:53 UDP

      Never Fear, A Geek is Here!

      GertjanG 1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan @aGeekhere
        last edited by Gertjan

        @aGeekhere

        The first image : I would (tm) re order the rules.
        First : the pass rule for "ok" traffic : DNS requests from a LAN IPv6 device to the pfSense LAN IPv6.
        So : place your second rule at the top.
        Next : If the traffic didn't match the first, the NAT rule will all TCP/UDP IPv6 destination port 53 to internal pfSense "::1:53"

        NAT rules :

        65bcf8e0-4106-48ed-96bc-405f5c085e34-image.png

        Btw : take note : I DNS redirect DNS on my captive portal, and a pfSense captive portal is 'IPv4' only, so my IPv6 DNS redirect rules is a demo here, as I can't really test it.
        Also, be ware of the "!" : DNS traffic that is send to the correct pfSense interface is not NATted as there is no need. This means obnly traffic from a device on your network LAN which sends DNS requests to a device not being member of the LAN interface, will get NATted.

        This probably explains why this first = IPv6 - LAN firewall rule :

        cdb2fc4e-8940-4222-857d-66a445074ba8-image.png

        which is the firewall rule attached to the NAT rule, doesn't trigger/match any traffic.
        All my devices that use IPv6 are behaving correctly, and ask "pfSense" for their DNS needs.
        ( I guess ) so the NAT rule doesn't get matched = not get used.

        @aGeekhere said in DNS Block and Redirect for IPv6:

        LAN [2403:5801:13b9::220]:55984 [::1]:53 UDP

        What rule was hit ?
        Not this one :

        fe316f34-ab80-493f-b51c-a9cc2d53f6d7-image.png

        as the counters are '0'.

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        A 1 Reply Last reply Reply Quote 0
        • A
          aGeekhere @Gertjan
          last edited by

          @Gertjan
          552556e9-a783-41f7-8d68-eabda544fe53-image.png

          Made the change

          This is what is getting hit
          fca2edc0-324c-494c-9280-2e9bb9f3df30-image.png

          and in the logs are lots of
          IP6 DNS Reject (1752636706) [2403:5801:13b9::220]:55984 [::1]:53 UDP

          Never Fear, A Geek is Here!

          GertjanG johnpozJ 2 Replies Last reply Reply Quote 0
          • GertjanG
            Gertjan @aGeekhere
            last edited by

            @aGeekhere

            f6550f05-b276-48aa-9333-d2bc837c9dbf-image.png

            The first rule gets used : this is the IPv6 DNS traffic send to pfSense, that's ok - no need to NAT this traffic.
            The second rule : the actual NAT rule, never gets used - the counters stay zero - ... that's puzzling. Can you show this NAT rule ?
            and because traffic isn't NATted, the third rule is reached, and starts rejecting.

            Btw : none of your IPv6 devices seem to use destination port '853'. That's ok, and normal.
            Some IPv4 capable devices do use DNS to port '853' (pfSense) .

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            A 1 Reply Last reply Reply Quote 0
            • A
              aGeekhere @Gertjan
              last edited by

              @Gertjan Been following the Doc, here are the NAT rules

              34e0f227-1874-415f-b08a-43aec90a7005-image.png

              I wonder why the ipv6 rule has this issue but not the ipv4 rules, did i make an error or is it a bug?

              Never Fear, A Geek is Here!

              A GertjanG 2 Replies Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator @aGeekhere
                last edited by johnpoz

                @aGeekhere said in DNS Block and Redirect for IPv6:

                IP6 DNS Reject (1752636706) [2403:5801:13b9::220]:55984 [::1]:53 UDP

                Do you have an ACL for this IPv6 source address?

                And a redirect for 853 isn't going to work because - not with any sane client, because it would validate the cert you provide - which isn't going to be valid for where they wanted to go.

                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

                1 Reply Last reply Reply Quote 0
                • A
                  aGeekhere @aGeekhere
                  last edited by aGeekhere

                  @johnpoz I have DHCPv6 Static Mappings

                  Never Fear, A Geek is Here!

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

                    @aGeekhere not talking about the IP - I am talking about unbound ACL list. Do you have it set for auto, or did you turn that off and manually set it. If you query pfsense IPv6 normally do you get answers?

                    Lets see a nslookup to pfsense IPv6 address - and then to something else. Your saying it works to pfsense IPv6 address but then you get a reject to something else that is redirected to loopback?

                    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

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      aGeekhere @johnpoz
                      last edited by aGeekhere

                      @johnpoz I do no have any Access Lists and in the doc https://docs.netgate.com/pfsense/en/latest/recipes/dns-redirect.html

                      Clients using DNS over TLS or DNS over HTTPS could circumvent this protection. Redirecting or blocking port 853 may help with DNS over TLS, depending on the clients.
                      
                      See Blocking External Client DNS Queries for additional advice.
                      

                      So far ipv4 as per the doc works, ipv6 seems to not work

                      Never Fear, A Geek is Here!

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

                        @aGeekhere - my point is that statement about the depending on the client - a sane client will validate the cert given back. If its not valid it won't work. One of the major points of both doh and dot is validation that your talking to who you think you are talking to - a dot client that doesn't validate the cert is utter shit.. what would use a shit client that doesn't validate the cert?

                        If you are getting a reject - points to unbound ACL not allowing the query.

                        Forget the dot redirect for a moment - and do a simple dig or nslookup query to pfsense IPv6, and then to some other IPv6 - do you get an answer when direct to ipv6 IP of pfsense, and then a reject on the redirect?

                        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

                        A 1 Reply Last reply Reply Quote 0
                        • GertjanG
                          Gertjan @aGeekhere
                          last edited by Gertjan

                          @aGeekhere said in DNS Block and Redirect for IPv6:

                          did i make an error or is it a bug?

                          I've tried to do the same thing as you : NAT IPv6 DNS traffic to "::1".
                          Guess what : for the usual reasons I could't make it work neither.
                          Reading this wasn't motivating :
                          be72b6c8-004e-43de-afc4-58ec2ff919e4-image.png

                          Anyway.

                          On my LAN, I added a IPv6 DNS NAT, NOT using "::1" , but the pfSense LAN IPv6.

                          9b34bcd0-6276-4c14-a3be-75a251ad5125-image.png

                          which produced this LAN firewall rule :

                          be8831a9-4966-465c-9b66-a7382790255c-image.png

                          Take note of the second rule that blocks all DNS IPv6 traffic.

                          Test on the console/ssh :

                          [25.07-RC][root@pfSense.brit-hotel-fumel.net]/root: dig @2001:4860:4860::8888 test-domaine.fr AAAA +short
                          2001:41d0:2:927b::15

                          ( means : I ask Google's IPv6 DNS, 2001:4860:4860::8888 to resolve test-domaine.fr for AAAA )
                          That worked out.

                          Now, from my PC :

                          C:\Users\Gauche>nslookup
                          Serveur par defaut :   pfSense.bhf.tld
                          Address:  2a01:cb19:abcd:a6e2:92ec:77ff:fe29:392c
                          > server 2001:4860:4860::8888
                          Serveur par defaut :   dns.google
                          Address:  2001:4860:4860::8888
                          
                          > test-domaine.fr
                          Serveur :   dns.google
                          Address:  2001:4860:4860::8888
                          
                          Réponse ne faisant pas autorité :
                          Nom :    test-domaine.fr
                          Addresses:  2001:41d0:2:927b::15
                                    5.196.43.182
                          

                          I asked nslookup to use "2001:4860:4860::8888" as the DNS server which is Google IPv6 DNS (the modern 8.8.8.8).

                          So .. I'm not sure. Redirecting to ::1 didn't worked.
                          When I redirect to the pfSense IPv6 LAN IP ( 2a01:cb19:abcd:a6e2:92ec:77ff:fe29:392c ), it worked.
                          So, we can't redirect to ::1 ?
                          Ok, so be it.

                          No "help me" PM's please. Use the forum, the community will thank you.
                          Edit : and where are the logs ??

                          1 Reply Last reply Reply Quote 0
                          • A
                            aGeekhere @johnpoz
                            last edited by aGeekhere

                            @johnpoz Here is some output
                            16292bc6-7695-43ed-9556-b8e3df8b6799-image.png

                            Both block 1 and 2 which is ipv4 seems to be working correctly as per the doc

                            Block 3 and 4 which is ipv6 does not look correct

                            Unless i have not understood the doc or missed something.

                            Update:
                            @Gertjan Ah so you were able to recreate the issue, could this be a bug?

                            Never Fear, A Geek is Here!

                            GertjanG 1 Reply Last reply Reply Quote 0
                            • GertjanG
                              Gertjan @aGeekhere
                              last edited by Gertjan

                              @aGeekhere said in DNS Block and Redirect for IPv6:

                              Ah so you were able to recreate the issue, could this be a bug?

                              Maybe, maybe not .. not sure. read above, as I got it working by not using ::1.

                              @johnpoz I wasn't even trying to use 853 is DNS over TLS, as I can't map out that rabbit hole right now ......
                              Just good old plain port 53 DNS UDP and TCP.

                              No "help me" PM's please. Use the forum, the community will thank you.
                              Edit : and where are the logs ??

                              A 1 Reply Last reply Reply Quote 0
                              • A
                                aGeekhere @Gertjan
                                last edited by aGeekhere

                                @Gertjan Because if you read here https://docs.netgate.com/pfsense/en/latest/recipes/dns-redirect.html

                                It uses 127.0.0.1 as the ipv4 loopback address so i would have though that for ipv6 you would use ::1 as the loop back address. If ::1 does not work what can be used for a loop back address for ipv6?

                                Never Fear, A Geek is Here!

                                GertjanG 1 Reply Last reply Reply Quote 0
                                • GertjanG
                                  Gertjan @aGeekhere
                                  last edited by

                                  @aGeekhere said in DNS Block and Redirect for IPv6:

                                  what can be used

                                  See above :

                                  @Gertjan said in DNS Block and Redirect for IPv6:

                                  When I redirect to the pfSense IPv6 LAN IP ( 2a01:cb19:abcd:a6e2:92ec:77ff:fe29:392c ), it worked.

                                  No "help me" PM's please. Use the forum, the community will thank you.
                                  Edit : and where are the logs ??

                                  A 1 Reply Last reply Reply Quote 0
                                  • A
                                    aGeekhere @Gertjan
                                    last edited by aGeekhere

                                    @Gertjan Ok going to try switching it from ::1 to pfsense LAN ipv6 address. Will report back with results.

                                    Update: More testing is needed but i think that worked.

                                    Never Fear, A Geek is Here!

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

                                      @aGeekhere might be related to having to be the same scope

                                      nat.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

                                      GertjanG 1 Reply Last reply Reply Quote 0
                                      • GertjanG
                                        Gertjan @johnpoz
                                        last edited by

                                        @johnpoz

                                        That's the same image / conclusion I posted above ^^

                                        But I'm not using link-local "fe80" stuff.
                                        I can see the IPv6 DNS port 53 traffic using packet capturing.
                                        It's the IPv6 GUA = the ddevice's LAN IPv6 being used.

                                        Anyway, redirecting to ::1 is not what worked before like using 127.0.0.1. ...

                                        Maybe I'll use AI for this one 😊

                                        No "help me" PM's please. Use the forum, the community will thank you.
                                        Edit : and where are the logs ??

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

                                          @Gertjan oh I missed that - my bad.

                                          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

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