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

    Hostname Override for VPN Clients

    Scheduled Pinned Locked Moved DHCP and DNS
    13 Posts 3 Posters 896 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
      Brailyn
      last edited by Brailyn

      Is there a way I can make specific hostname resolve differently when asked from a different subnet than my LAN?

      For example 192.168.1.1 resolves to host1.example in the 192.168.1.0/24 LAN
      and for the same host it resolves to newname.example for clients in 192.168.2.0/24 LAN2

      I am using DNS resolver and have DNS forwarder disabled. All DNS hosts resolve on both LAN and LAN2.

      JKnottJ 1 Reply Last reply Reply Quote 0
      • JKnottJ
        JKnott @Brailyn
        last edited by

        @Brailyn

        What would be the purpose of that? I could understand a host name resolving to a different IP address, but not a host address returning a different host hame.

        PfSense running on Qotom mini PC
        i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
        UniFi AC-Lite access point

        I haven't lost my mind. It's around here...somewhere...

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          There isn't a GUI for it, but you can do that with Views in the DNS Resolver. There are examples around the forum for how to do that.

          Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • B
            Brailyn
            last edited by

            Based on Jknotts response, I think I asked wrong... This is what I intended:

            I am looking for host1.example to resolve to 192.168.1.1 from 192.168.1.0/24 and from 192.168.2.0/24 LAN2 host1.example resolves to a public IP address.

            JKnottJ 1 Reply Last reply Reply Quote 0
            • jimpJ
              jimp Rebel Alliance Developer Netgate
              last edited by

              https://forum.netgate.com/post/905712

              Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

              B 1 Reply Last reply Reply Quote 1
              • JKnottJ
                JKnott @Brailyn
                last edited by

                @Brailyn

                I do that, but I have an external DNS server I use. The external server has the public address and pfSense has the local address.

                PfSense running on Qotom mini PC
                i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                UniFi AC-Lite access point

                I haven't lost my mind. It's around here...somewhere...

                1 Reply Last reply Reply Quote 0
                • B
                  Brailyn @jimp
                  last edited by

                  @jimp very interesting. How do I keep viewA to use resolver normally?

                  Something like this?

                  server:
                  access-control-view: 10.0.0.0/24 viewa
                  access-control-view: 10.0.8.0/24 viewb
                  
                  view:
                  name: "viewa"
                  local-zone: "example1.com." dynamic
                  
                  view:
                  name: "viewb"
                  local-zone: "example1.com." static
                  local-data: "test1.example1.com. 90 IN A 10.10.10.10"
                  

                  Also, I have this config in my custom options for DNS over HTTPS... Is it okay to combine these options?

                  forward-zone:
                  name: "."
                  forward-ssl-upstream: yes
                  forward-addr: 1.1.1.1@853
                  forward-addr: 1.0.0.1@853
                  server:include: /var/unbound/pfb_dnsbl.*conf
                  
                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    Just don't make a second view. Only make a view for the non-default responses.

                    Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • jimpJ
                      jimp Rebel Alliance Developer Netgate
                      last edited by

                      And yes, you can add the view stuff after just make sure to include the server: bit on a new line first.

                      Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

                      Need help fast? Netgate Global Support!

                      Do not Chat/PM for help!

                      1 Reply Last reply Reply Quote 0
                      • B
                        Brailyn
                        last edited by Brailyn

                        This works for the single host, but no other LAN addresses resolve. Any ideas?

                        server:
                        access-control-view: 10.0.8.0/24 openvpn-view
                        
                        view:
                        name: "openvpn-view"
                        local-zone: "hostame.example." static
                        local-data: "hostname.example. 90 IN A X.X.X.X"
                        
                        1 Reply Last reply Reply Quote 0
                        • B
                          Brailyn
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • jimpJ
                            jimp Rebel Alliance Developer Netgate
                            last edited by

                            Change static to transparent, perhaps

                            Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

                            Need help fast? Netgate Global Support!

                            Do not Chat/PM for help!

                            1 Reply Last reply Reply Quote 0
                            • B
                              Brailyn
                              last edited by

                              Functionality seems the same. I should note that other addresses internal only end in "example" as well.

                              Since I only want to resolve to public address for this override, is there any way I can force hostname.example to use a public DNS server like 1.1.1.1? and all other hostname2.example, hostname3.example, etc. use pfsense resolver normally.

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