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

    Can't get DNS Wildcarding to work properly

    Scheduled Pinned Locked Moved DHCP and DNS
    7 Posts 3 Posters 571 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.
    • B
      bryon
      last edited by

      Hi,
      I have been following this doco (https://docs.netgate.com/pfsense/en/latest/services/dns/wildcards.html#dns-resolver-unbound) to configure DNS wildcarding for an app on my internal network and it is not working for me.
      I've scanned the forums and I think I am following all the advice that has been previously given so I am at a loss... Any suggestions would be more than welcome. pfSense version is: 2.7.2.

      Background:
      I have an application that sits at the address sno.mydomain.net. mydomain.net is the top-level domain.
      I have configured the following in the DNS Resolver:

      server:
        local-zone: "apps.sno.mydomain.net" redirect
        local-zone: "*.apps.sno.mydomain.net" redirect
        local-data: "*.apps.sno.mydomain.net 3600 IN A 10.10.10.254"
        local-data: "api.sno.mydomain.net 3600 IN A 10.10.10.254"
      

      To be sure I am first flushing the DNS cache on my laptop:

      $ sudo systemctl restart systemd-resolved.service
      

      I then test the DNS resolution as follows. You can see that the api.myomain.net resolves fine, but the wildcard does not.

      $ dig api.sno.mydomain.net
      
      ; <<>> DiG 9.18.26 <<>> api.sno.mydomain.net
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38057
      ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
      
      ;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 65494
      ;; QUESTION SECTION:
      ;api.sno.mydomain.net.		IN	A
      
      ;; ANSWER SECTION:
      api.sno.mydomain.net.	3600	IN	A	10.10.10.254
      
      ;; Query time: 1 msec
      ;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
      ;; WHEN: Wed Jun 12 22:29:03 AEST 2024
      ;; MSG SIZE  rcvd: 66
      

      Then I test the wildcarded domain:

      $ dig test.apps.sno.mydomain.net
      
      ; <<>> DiG 9.18.26 <<>> test.apps.sno.mydomain.net
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55
      ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
      
      ;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 65494
      ;; QUESTION SECTION:
      ;test.apps.sno.mydomain.net.	IN	A
      
      ;; Query time: 1 msec
      ;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
      ;; WHEN: Wed Jun 12 22:29:10 AEST 2024
      ;; MSG SIZE  rcvd: 56
      
      V 1 Reply Last reply Reply Quote 0
      • V
        viragomann @bryon
        last edited by

        @bryon
        Try this order in the custom options:

        server:
          local-zone: "*.apps.sno.mydomain.net" redirect
          local-data: "*.apps.sno.mydomain.net 3600 IN A 10.10.10.254"
          local-data: "api.sno.mydomain.net 3600 IN A 10.10.10.254"
          local-zone: "apps.sno.mydomain.net" redirect
        
        B 1 Reply Last reply Reply Quote 0
        • B
          bryon @viragomann
          last edited by

          @viragomann said in Can't get DNS Wildcarding to work properly:

          Thanks for the tip. I tried this but without success. Based on my reading of the doco the order is not important. local-zone is always evaluated before local-data and the order is only for readability, but it was worth a shot for sure.

          Because apps.sno.mydomain.net is not a url I will ever use I have also tried this configuration without success.

          server:
            local-zone: "*.apps.sno.mydomain.net" redirect
          
            local-data: "*.apps.sno.mydomain.net 3600 IN A 10.10.10.254"
            local-data: "api.sno.mydomain.net 3600 IN A 10.10.10.254"
          

          Again, api.sno.mydomain.net resolves just fine but test.apps.sno.mydomain.net does not.

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

            @bryon you wouldn't put a * in the zone. nor would you use a . in the front of it.

            What exactly are you trying to accomplish exactly?

            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

            B 1 Reply Last reply Reply Quote 1
            • B
              bryon @johnpoz
              last edited by

              @johnpoz
              Thanks. That got it working, but it seems to contradict the doco I found. Everything I have read indicates you need to include the *. in the config. I think I tried every combination but the one you suggested! :)

              What I am trying to do is have ofSense front a Kubernetes cluster (Single Node OpenShift that is sitting at 10.10.10.254).

              There are two ingresses:
              The API interface which uses api.<cluster base domain>
              The web UI and routes interface/ingress at *.apps.<cluster base domain>

              The cluster will then handle the internal routing

              Question, given there is no use for apps.snd.mydomain.net, can you set up a rule where that specific url will not resolve? I.e. I want *.apps.sno.mydomain.net to resolve, but not apps.sno.mydomain.net

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

                @bryon *. is a bind thing, not unbound

                Not sure where you were looking but here it is in the pfsense docs

                https://docs.netgate.com/pfsense/en/latest/services/dns/wildcards.html#creating-wildcard-records-in-dns-forwarder-resolver

                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

                B 1 Reply Last reply Reply Quote 1
                • B
                  bryon @johnpoz
                  last edited by

                  @johnpoz Got it. Thanks.

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