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

Is there a way to control dns ttl value of dynamic updates?

Scheduled Pinned Locked Moved DHCP and DNS
5 Posts 3 Posters 1.9k 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.
  • I
    ivarh
    last edited by Dec 3, 2017, 6:01 AM

    I have followed the guides here on how to set up my dns server running on pfsense to update a zone on my dns server with the host <-> ip mappings and it is working great. The only minor problem is that the dns entries created by dhcpd use a TTL of 3600 seconds. Is there a way to set this to another value. I personally want to set it to 120. Does anyone know if it is possible to change this value and if so how?

    -Ivar

    1 Reply Last reply Reply Quote 0
    • I
      ivarh
      last edited by Dec 6, 2017, 2:57 AM

      I have found a way to set the ttl used by dhcpd when updating the dns server. It is a big hack and really should be added to pfsense.

      I edited /etc/services.inc to change
                              if ($dhcpifconf['ddnsdomain'] <> "") {
                                      $newzone['domain-name'] = $dhcpifconf['ddnsdomain'];
                                      $dnscfg .= "    ddns-domainname "{$dhcpifconf['ddnsdomain']}";\n";
                              } else {
                                      $newzone['domain-name'] = $config['system']['domain'];
                              }

      to
                              if ($dhcpifconf['ddnsdomain'] <> "") {
                                      $newzone['domain-name'] = $dhcpifconf['ddnsdomain'];
                                      $dnscfg .= "    ddns-domainname "{$dhcpifconf['ddnsdomain']}";\n";
                                      $dnscfg .= "    ddns-ttl 120;\n";
                              } else {
                                      $newzone['domain-name'] = $config['system']['domain'];
                              }

      $dnscfg .= "    ddns-ttl 120;\n"; is what is added.

      1 Reply Last reply Reply Quote 0
      • J
        johnpoz LAYER 8 Global Moderator
        last edited by Dec 6, 2017, 10:35 AM

        What is the lease time your getting from the dhcp server on your interface?  Setting a ttl of 120 seconds is going to generate a bit more dns traffic than a 3600 ttl..  Why would you need it so short.. Does your IP actually change that often?

        Normally dhcp is renewed and will stay the same IP for years!!!  Unless it goes offline for extended period and that lease expires and someone else gets it.

        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
        • I
          ivarh
          last edited by Dec 8, 2017, 2:29 PM

          The domain i do the dynamic updates to is hosted by bind on pfsense itself. This means that there is not much extra internet traffic generated by a low ttl as the clients are set to use pfsense as it's dns server.

          The reason I want a low ttl is that when I get a new device I assign a static ip address as soon as it has gotten a dynamic address fromt he dhcp server so that I can be lazy and use the view dhcp leases in pfsense to assign a static address saving to enter the mac address manually with a 1hour ttl it will then take a long time until i can use the hostname to reach the device as it will point to the dynamic address it got originally.

          1 Reply Last reply Reply Quote 0
          • J
            JKnott
            last edited by Dec 8, 2017, 3:02 PM

            ????

            The DNS TTL only affects devices that have queried the name.  If a device hasn't requested an IP for the host name it will not have the address in it's cache.  So, let the new device boot up, get it's MAC, create the static entry and point the host name to it.  Then, when some other device queries that name, it will get the static address.

            I think you may be imaging problems that don't exist.  You'd only have to worry about DNS TTL if a host name had been in use and then the address changed.  The TTL only affect pfSense for host names learned from elsewhere.  When you control the host names on a local DNS, for local devices, there's no cache in pfSense to worry about, as it will rely on what's saved in /etc/hosts.

            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
            5 out of 5
            • First post
              5/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received