BIND DNS configuration #2

-CONTRIBUTED TOOL: ALPHA status-

Through the following scripts, it is possible to generate dynamic updates to bind (a.k.a. named), for a single domain.

There a separate set of scripts for managing DNS via static zones.

The 'ip' table contains a list of IP addresses with a reference to names in the systems table.Names are not stored in the'ip' table to avoid duplication. These means that if a hosts is to appear in DNS, but is not automatically detected by FreeNAC, it must be manualyl entered into the systems table.

| Field      | Type            | Comment
| id         | int(10) unsigned | index
| address    | int(10) unsigned | IP address, use INET_NTOA to convert
| subnet     | int(10) unsigned | Subnet adress
| status     | tinyint(4)       |
| comment    | varchar(255)     |
| system     | int(11)          | reference to an index in the systems table
| source     | varchar(32)      | ?
| dns_update | tinyint(4)       | ?
| lastupdate | timestamp        |
| lastchange | timestamp        |

So, next a query to pull an IP to name mapping:

SELECT ip.id as id, INET_NTOA(ip.address) as ip, systems.name as name, ip.dns_update as dns_update, systems.dns_alias as cname FROM ip LEFT JOIN systems ON ip.system = systems.id WHERE ip.system != 0; 

Configuration options

The configuration options are in the freenac database and can be configured by the windows GUI 

  • web_showdns (true/false) : show the dns-related fields in the web interface
  • ddns_server
  • dns_domain = general domain
  • ddns_ttl
  • dns_ns = comma separated list of name servers (no space).
    These servers must be resolvable.
  • dns_mx = comma separated list of mail servers (no space).
    This is an ordered list (primary server first)
  • dns_primary = primary name server where this host file will be used (used in SOA)
  • dns_mail = email address for the DNS administrator (used in SOA)
  • dns_outdir = directory where the zone files will be written (existing files will be overwritten without confirmation)
  • dns_forwardzone = name of the generated zone file (forward).
  • dns_subnet = subnet for which a reverse dns zone file will be generated

generate_dns2.php

Using ip.address and systems.name from the FreeNAC 'ip' DB, generate a list of dynamic DNS updates. The DNS update commands are written to a temporary file, once the file has been written, the dns_update flag is reset for each field.

generate_dns_reverse2.php