Today is: 8 January, 2012
Check todays hot topics

Generate DNS A/PTR Records from DHCPd config

Generate DNS A/PTR Records from DHCPd config

#!/usr/bin/perl
#
# Genreate A/PTR records off dhcpd config
# 
# Assumes the following layout
#
#  host host1-vlan1 {
#       hardware ethernet 00:16:3e:10:11:b3;
#       fixed-address 10.74.17.29;
#  }
# 
#  host host2-vlan2 {
#        hardware ethernet 00:16:3e:12:ee:79;
#        fixed-address 10.74.17.30;
#  }
 
use strict;
use warnings;
 
use constant DOMAIN => 'domain.com';
use constant LINES_BETWEEN_MATCHES => 2;
 
my $file = '/etc/dhcpd.conf';
 
if (( ! -e $file ) || ( ! -r $file ))
{
	print STDERR "Unable to read/open dhcpd config.\n";

Syndicate content