Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    Different DNS host overrides based on IP addr or interface of client?

    Scheduled Pinned Locked Moved DHCP and DNS
    4 Posts 4 Posters 5.4k 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.
    • T
      tzalmaves
      last edited by

      Hello all,

            I'm wondering if there's a way to do conditional host overrides with DNS Resolver.  For example:

            Client #1 at 192.168.20.100 pings foo.com, gets 204.65.44.1
            Client #2 at 192.168.20.101 pings foo.com, gets 204.65.44.2

            If it can't be done by IP address, can it be conditional based on which interface is querying?  If this can't be done with DNS resolver, is there another way to accomplish this?

            -TM

      1 Reply Last reply
      Reply Quote 0
      • K
        kpa
        last edited by

        Not possible with Unbound or dnsmasq. You would need the BIND package and use the views feature to match a specific client IP or a set of IPs.

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

          Since the update to unbound 1.6 there are views now…

          Doesn't look any support for them in the gui as of yet that I see.. But you can for sure do it in the optional box.

          So

          in the option box I created a view called testview

          
          server:
          access-control-view: 192.168.9.100/32 testview
          view:
          name: "testview"
          local-zone: "local.lan" static
          local-data: "test.local.lan. 90 IN A 10.10.10.10"
          
          

          So you can see when I bounce the query off my internal dns that forwards to pfsense, so the query will actually come from 192.168.3.10 vs my box on 192.168.9.100..  I get what I put in as a host override for test.local.lan.  When I do the query to unbound from the access-control-view list I created called "testview" I get the entries I put in there.  My normal local domain is local.lan - and this is the host override I created for the test.local.lan

          You can create the control view to either be a single IP with /32 or any cidr to include the IPs you want.  You then just need to create the entries under that view name..  See the above for example

          
          > dig test.local.lan
          
          ; <<>> DiG 9.11.0-P3 <<>> test.local.lan
          ;; global options: +cmd
          ;; Got answer:
          ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28904
          ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
          
          ;; OPT PSEUDOSECTION:
          ; EDNS: version: 0, flags:; udp: 4096
          ;; QUESTION SECTION:
          ;test.local.lan.                        IN      A
          
          ;; ANSWER SECTION:
          test.local.lan.         3600    IN      A       192.168.100.100
          
          ;; Query time: 7 msec
          ;; SERVER: 192.168.3.10#53(192.168.3.10)
          ;; WHEN: Mon Mar 06 15:55:55 Central Standard Time 2017
          ;; MSG SIZE  rcvd: 59
          
          > dig @192.168.9.253 test.local.lan
          
          ; <<>> DiG 9.11.0-P3 <<>> @192.168.9.253 test.local.lan
          ; (1 server found)
          ;; global options: +cmd
          ;; Got answer:
          ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16525
          ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
          
          ;; OPT PSEUDOSECTION:
          ; EDNS: version: 0, flags:; udp: 4096
          ;; QUESTION SECTION:
          ;test.local.lan.                        IN      A
          
          ;; ANSWER SECTION:
          test.local.lan.         90      IN      A       10.10.10.10
          
          ;; Query time: 1 msec
          ;; SERVER: 192.168.9.253#53(192.168.9.253)
          ;; WHEN: Mon Mar 06 15:56:14 Central Standard Time 2017
          ;; MSG SIZE  rcvd: 59
          
          

          hostoverrides.png_thumb
          hostoverrides.png

          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 26.07 | Lab VMs 2.9.0, 26.07

          1 Reply Last reply
          Reply Quote 0
          • lexxaiL
            lexxai
            last edited by

            Thanks, it work.
            only need remember about "server:" in first line of custom options.
            I post my screenshot of GUI https://lexxai.blogspot.com/2017/11/pfsense-dns-views.html

            –
            We have what we have. Everything that happens - for the better.

            1 Reply Last reply
            Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.
            Privacy Policy · Cookie Policy