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

    Add host overides in DNS resolver from CLI

    Scheduled Pinned Locked Moved DHCP and DNS
    3 Posts 2 Posters 207 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.
    • D
      DomiX
      last edited by

      Hi,

      I need to add several host overides (~190 hosts) in DNS resolver on multiple pfsense, is this possible to add them from CLI ?
      I've read a thread for 2.2 maybe it's now possible for 2.4.

      Thanks,
      Regards

      1 Reply Last reply Reply Quote 0
      • NogBadTheBadN
        NogBadTheBad
        last edited by NogBadTheBad

        You could do what pfBlocker does and use include in the custom options:-

        server:include: /var/unbound/pfb_dnsbl.*conf

        [2.4.4-RELEASE][admin@pfsense]/root: more /var/unbound/pfb_dnsbl.conf
        local-data: "0.r.msn.com 60 IN A 172.16.255.2"
        local-data: "0.start.bz 60 IN A 172.16.255.2"
        local-data: "000dom.revenuedirect.com 60 IN A 172.16.255.2"
        local-data: "005.free-counter.co.uk 60 IN A 172.16.255.2"
        local-data: "006.free-counter.co.uk 60 IN A 172.16.255.2"
        local-data: "007.free-counter.co.uk 60 IN A 172.16.255.2"
        local-data: "008.free-counter.co.uk 60 IN A 172.16.255.2"
        local-data: "008.free-counters.co.uk 60 IN A 172.16.255.2"
        local-data: "008k.com 60 IN A 172.16.255.2"
        local-data: "00hq.com 60 IN A 172.16.255.2"
        local-data: "00inkjets.com 60 IN A 172.16.255.2"

        Screenshot 2020-01-22 at 16.24.06.png

        If you need a decent text editor to manipulate the text file check out notepad++

        Andy

        1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

        1 Reply Last reply Reply Quote 0
        • D
          DomiX
          last edited by

          Thanks for your response @NogBadTheBad .

          I was thinking more like a command to add an host overides from pfsense developper shell (option 12).
          Like you suggested, I will use custom options, I tested with 250 lines

          local-data: "foo A x.x.x.x"
          

          I can backup and restore without touching file systems ☺

          Regards

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