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

    DHCP + TinyDNS + MultiLAN

    Scheduled Pinned Locked Moved DHCP and DNS
    2 Posts 2 Posters 3.8k 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.
    • L
      luisousa
      last edited by

      I have changed TinyDNS code to support MultiLAN. The problem with the original version is that it only register DHCP Static Leases from LAN interface and not others LAN interfaces (OPTX). So I have a modification made in tinydns.inc file which i would like to share with any one interested. The modification where made in version "tinydns.inc,v 1.86 2008/02/14 18:04:33 sullrich Exp".

      where in the file is:

      if($config['installedpackages']['tinydns']['config'][0]['regdhcpstatic']) {
                              if(is_array($config['dhcpd']['lan']['staticmap'])) {
                                      foreach($config['dhcpd']['lan']['staticmap'] as $dhcpdstatic) {
                                              $dhcpdhostname = $dhcpdstatic['hostname'];
                                              $dhcpdfqdn = "{$dhcpdhostname}.{$dhcpddomain}";
                                              $dhcpdlanip = $dhcpdstatic['ipaddr'];
                                              $dhcpda = "={$dhcpdfqdn}:{$dhcpdlanip}";
                                              if($dhcpdhostname)
                                                      fwrite($fd, $dhcpda . "\n");
                                      }
                              }
                      }

      replace by:

      if($config['installedpackages']['tinydns']['config'][0]['regdhcpstatic']) {
                              foreach($config['dhcpd'] as $zone_key => $zone ) {
                                      $dhcpdhostname = $config['system']['hostname'];
                                      if ($zone['ddnsdomain']) 
                                              $dhcpddomain = $zone['ddnsdomain'];
                                      else
                                              $dhcpddomain = $config['system']['domain'];
                                      $dhcpdlanip = $config['interfaces'][$zone_key]['ipaddr'];
                                      $dhcpdipmask = $config['interfaces'][$zone_key]['subnet'];
                                      $dhcpdfqdn = "{$dhcpdhostname}.{$dhcpddomain}";
                                      tinydns_complete_soa_record($fd, $dhcpdlanip, $dhcpdipmask, $dhcpdhostname, $dhcpddomain);

      if(is_array($zone['staticmap'])) {
                                              foreach($zone['staticmap'] as $dhcpdstatic) {
                                                      $dhcpdhostname = $dhcpdstatic['hostname'];
                                                      $dhcpdfqdn = "{$dhcpdhostname}.{$dhcpddomain}";
                                                      $dhcpdlanip = $dhcpdstatic['ipaddr'];
                                                      $dhcpda = "={$dhcpdfqdn}:{$dhcpdlanip}";
                                                      if($dhcpdhostname)
                                                              fwrite($fd, $dhcpda . "\n");
                                              }
                                      }
                              }
                      }

      This modification is working fine to me. It may have probs that i did not find. Working with 4 LAN'd each with Static DHCP Leases to register in.

      Hope this helps someone out there… and me if this goes to main line ;)

      Sorry for my bad english I'm Portuguese

      1 Reply Last reply Reply Quote 0
      • S
        sullrich
        last edited by

        Thanks, commited.

        In the future please submit patches through this process http://devwiki.pfsense.org/SubmittingPatches

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