DNS Configuration Tool

Download hosts2dns-0.95.tar.gz (09/19/11)
See the Change Log.

New! Added support for Mac OSX Lion.


This program makes it easy to maintain a DNS server by just using the entries in your /etc/hosts file.

Special comment markers (shown in red below) set the domain name, and 'START' and 'END' markers set which entries in the /etc/hosts file will be added to DNS.

Setting Up A New DNS Server

Here's an example of how to set up a new DNS server on a Mac OSX machine:

When you run 'hosts2dns -update', the hostnames between the START/END markers will be added to DNS; the script handles updating the zone file's hostnames and serial numbers, and handles re-starting the DNS daemon. Hostname aliases are automatically converted into DNS 'CNAME's.

Adding/Removing Hosts

When you need to add or remove hosts from DNS, just edit your /etc/hosts file, then re-run 'hosts2dns -update' to make the changes take effect. The DNS files will be rebuilt, and the server will be updated.

Intended Use

This script is intended *only* for maintaining a simple, single internal fictitious DNS domain (such as for a small home or business network) on an internal DNS server that is inside a firewall. The DNS server will act as an authoritative server for your internal domain, and will also resolve internet domain names through the root servers, the way any regular DNS server would. (ie. it does *not* depend on your ISP's name server to resolve internet names)

This script overwrites any previous DNS installation on the local machine; no attempt is made to preserve any previous DNS server configuration. This script assumes it is free to completely manipulate the local DNS server and all its related files.

The purpose of this script is to be as simple to operate as possible, and thus, is dedicated to a very specific configuration. For this reason, the script does handle multiple subnets, or complex DNS configurations where eg. security is an issue.

By having your DNS server /inside/ a NAT'ing firewall, it will be completely secure from the outside, and your local 'fictitious' domain will be completely limited to your internal network.

Help Output

The following is what you get when you run 'hosts2dns' without any arguments, or with the -help flag:


This script is licensed under the GPL. See the script and the LICENSE.txt file in the tar file you downloaded for details.

To report bugs, see the instructions in the comment header at the top of the script.

Back to my home page.
You can send me mail.