Automating DNS/DHCP [ was Re: MAC addresses, hostnames, and DHCP ]

Fred puissante at lrc.puissante.com
Sun Dec 4 22:10:01 EST 2005


On Friday 02 December 2005 09:24, Paul Lussier wrote:
> Fred <puissante at lrc.puissante.com> writes:
> > I have a possible suggestion:
> >
> > Use PowerDNS and scripting around your DHCP server.
> >
> > http://www.powerdns.com/
...
> Can you provide a little more insight as to how you're using it, and
> what site-specific hacks you've come up with to customize your DNS
> query results?

Since I create lots of websites, and don't want to be bothered with 
allocating the IPs for the domain names by hand, etc., I have all the zone 
info in a MySQL database, along with all available IP addresses.

I then use a script driven from a web interface to allocate domain names, 
create all the zone information (SOA, A, NS, MX, etc.) and even have it pick 
IPs at random to assign out of a pool of IPs. I break my IPs up into "pools" 
so I can just specify which pool to use with which zone.

In the case of setting things up for the enterprise, your set up will be 
similar, except if you are assigning IPs to machines, you won't be sharing 
them across zones like I do for websites. Still, with a few scrips and maybe 
a web interface you can fully automate the administration of this. 

As I said before, PowerDNS has a tool to allow you to convert existing zone 
files into a database schema. There are also a number of options of how you 
interface with a database. It has built-in interfaces for MySQL and 
Postgress database, but also a simple way to pipe queries to external 
script, such as perl, where you can croft a wrapper to any database schema 
-- or database for that matter -- to your heart's content. 

There are a couple of cavets. Firstly, it is an authorative-only name server, 
but it does have some facilities for recursive queries. I have not played 
with it in that configuration, so I can't say much about it. Secondly, you 
must restart it if you restart your database. But this may not be the case 
if you pipe to a custom script.

Some nice thing is that it has an option to automatically update the serial 
numbers on changed zones so you don't have to track that if you don't want 
to. And you can create multiple A records to point to the same IP address 
for simple load balancing approaches like you would with Bind.

But the best thing I like about it is that you don't have to restart anything 
when you make zone changes or additions -- the changes and additions become 
available immediately. So by using a few scripts interfacing to the 
database, you could implement more elaborate load-balancing schemes. 

Well, there you have it. If you have any other questions, feel free to ask.

-Fred



More information about the gnhlug-discuss mailing list