[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reverse DNS Generator

Hello everyone,

    I wanted to announce the release of a program that will go through your
NorthStar 'networks' table and create reverse DNS for all your entries. This
program uses the "name" field of the /32 addresses as the reverse DNS.

    This works by querying the database for all networks with a mask length
between 1 and 24. It then starts with the shortest prefix it finds and
generates a list of all the /24 prefixes contained there-in. It works it's
way through longer and longer prefixes, matching them up with the prefixes
scanned earlier. When the program encounters a prefix it doesn't have it
expands it out to the appropriate number of /24s and adds them to the
internal table. After it has a list of all the networks in use, it cycles
through the table and queries the database one /24 at a time for all the
addresses within it. It then builds a table of all 256 addresses within the
/24 and then dumps it to a file. Memory is reclaimed and the process moves
to the next /24 in the list.

    Yes, it has the potential to be quite intensive in the time department,
as the program works in a linear fashon, but it is quite resource friendly.
Only one database connection is opened for the entire program, and the
largest persistant thing in memory will be the table of /24s.

    Currently the program is writen to be run once a day from the crontab.
Things on my todo list include:

    - Convert into a NorthStar Module (once the API is finalized and
    - Add code that reads the existing serial and makes sure the new one is
greater then the existing.

    Please feel free to read through the code and make suggestions for

    The file is attached, I will be working on getting a website up shortly.

Adam "Tauvix" Debus
Network Administrator, ReachONE Internet

Attachment: gen-reverse.tar.gz
Description: GNU Zip compressed data