IPv4 Adress tool
From: https://www.zytrax.com/books/dns/ch3/#ipv4-tool-rev-del
The tool has two parts that are interrelated but are invoked separately. The
first part is essentially a simple IPv4 calculator and is invoked using the
IPv4 Info button. The second part will generate a skeleton IPv4 reverse
mapping file using the data supplied in the first part. This part is invoked
with the Generate IPv4 Reverse File button.
IPv4 Calculator: Enter an IPv4 address with its /Prefix ( or slash )
notation in the IPv4/Prefix: box and click IPv4 Info. The
calculator will populate No. of IPs ( covered by the /Prefix or slash
value ), IPv4 Netmask in dotted decimal format ( a dotted hex format is
also shown enclosed in [] ) represented by the /Prefix, IPv4 Range lists
the start and end IPv4 addresses covered by the /prefix ( a dotted hex format is
also shown enclosed in [] ). Finally, the reverse map zone name of the IPv4
address is calculated based on the /Prefix value and is shown in FQDN format
in Reverse Zone ( IPv4 addresses below - to the left of - this name will
be defined in the reverse zone file ).
Alternatively, enter a single IPv4 address ( that lies anywhere in the desired
range ) without the /prefix in IPv4/Prefix and the number of desired IP
addresses ( if it is not a power of 2 it will be rounded up to the nearest power
of 2 ) in No. of IPs then click IPv4 Info. The calculator will
populate IPv4/Prefix ( with the calculated /Prefix to cover the required
or calculated number of IP addresses ), No. of IPs will be updated if
needed ( due to any power of 2 rounding required ) and IPv4 Netmask,
IPv4 Range and Reverse Zone will be populated normally.
The Clear button zaps ALL entries in the IPv4 Calculator only.
Notes:
Validation and other errors are shown in the IPv4 Netmask box
for no very good reason.
When entering a /prefix IPv4 address you only need to enter as many
dotted elements as are required by the /prefix ( more is not a problem ), if
you enter less than the required number the calculator silently pads with zeros
on the right.
IPv4 Reverse Zone Generator:
This part generates a skeleton reverse zone which can be copy/pasted/edited to
create a suitable reverse zone file. It uses data supplied in the
IPv4/Prefix: box to calculate the entries and adds $TTL, $ORIGIN, SOA
and one or more NS RRs ( which you can always edit manually if required ). Each
PTR entry added will be of the form X[.X.X.X] PTR hostY.domain.name..
The IPv4 address part that appears inside the zone file ( X[.X.X.X] ) is
calculated from the /prefix value of IPv4/Prefix:, host is the
string that appears in Host Label: ( always without a dot ), Y is a
sequential number starting from 0 to the number calculated in No. of
IPs:, domain.name. is the value entered in Domain Label: and
should terminate with a dot.
Enter an IPv4 address with its /Prefix ( or slash ) notation in the
IPv4/Prefix: box ( there is no need to click the IPv4 Info button
if not required - but it does no harm to do so - since the generator will always
invoke it automatically ). Enter the Host Label: and Domain Label:
as explained above. Enter the name of the first NS server for this zone in
NS 1: ( this value must be present ) and should either be an FQDN or if
an name is entered without the trailing dot then the value of Domain Label:
will be appended. Enter the name of the second NS server ( a unqualified name
or a FQDN ) for this zone in NS 2: ( for externally visible domains this
is required, for private domains this is not essential, but is usually present
through habit or for resilience ). Since, by definition, the NS servers for this
zone lie in an out-of-zone domain no A/AAAA ( glue ) RRs are required. By
default the generator appends the Domain Label: to each PTR RR, entering
an alternative label in the PTR Label: box allows you control the
reversed map names. Thus, if the zone example.com maintains the reverse file
for the IPv4 addresses delegated to example.net placing example.net in
the PTR Label: box will generate the desired result. Click the
Generate IPv4 Reverse Zone to activate and the results will appear in
Reverse Zone.
The IPv4 Reverse Zone Generator can also be used to generate
a delegated reverse map zone file and the corresponding CNAME
or DNAME RRs for the delegater's reverse file ( the reverse file at the ISP or
whatever organization is delegating the reverse map ). Checking the Delegate:
box will generate a reverse map zone file in the Reverse File:
box as normal. In addition, the Delegation RRs ( CNAME or DNAME ) that
should be added to the ISP's ( or delegater's ) reverse map file, as
described in IPv4 Reverse Map Delegation, are generated in Delegation RRs:.
These RRs can be copied and pasted directly into the appropriate place
in the reverse zone file and do not include any ancilliary RRs ( such as
SOA, NS etc. ). By default if the /Prefix is > 24 the generator will
use CNAME RRs, if the /Prefix is < 24 the delegation will use DNAME
RRs. When the /Prefix is < /24 there may be a number of delegated
reverse zone files ( depending on architecture ) each of which can be very
big. To these avoid problems the generator does not generate the Reverse Files:
in these cases. See the notes section below for methods by which the
reverse zone files may be generated. The calculator will use the X/Y
format defined in IPv4 Reverse Map Delegation by default, by checking the Use X-Y:
box a - ( dash ) format will be used. There is little obvious point in
generating a reverse delegation zone if the /Prefix is any multiple of 8
( /24, /16, or /8 ), however, the calculator makes no checks.
Clear will zap all entries in the IPv4 Reverse Zone Generator part only.
Notes:
Where a trailing dot is essential for an FQDN ( Domain Label: and PTR Label: )
the calculator will silently add it, if required, to ensure a viable zone is
created. However, if you terminate either NS 1: or NS 2: without a
dot then Domain Label: will be added. This may work for you or against
you just like DNS. But it can save some typing if you get it right.
Validation or other errors will appear in Reverse Zone or IPv4 Netmask:
in neither case for very good reasons.
Reverse zone files can get very big, very quickly, however, to
prevent unintentional errors the calculator always prompts when more
than 4096 entries will appear in the reverse zone.
When generating delegated reverse zones with prefixes < /24 the
Delegated RRs are generated for the complete address block. Thus, if the
IPv4/Prefix: is 192.168.0/20 it assumes that 16 subnets ( each with a
reverse map zone file of 4096 IP Addresses ) are to be generated. If this is not
the case selected Delegated RRs: need to be cut and pasted as
appropriate. In such the < 24 prefix case the Reverse File: entries
are not generated ( due to potentially huge volumes involved ). To generate such
files, if required, after creating the Delegation RRs: simply uncheck
Delegate: and click Generate IPv4 Reverse Zone again. Edit the
$ORIGIN statement in the resulting Reverse File: to reflect that defined
in the appropriate DNAME RR. Repeat as many times as necesssary, modifying
IPv4/Prefix: as appropriate, to generate the required files.
-
To create a zone file, simply copy the contents of Reverse File:
to the clipboard and paste into any suitable text editor, make any
required changes ( you may want to review the $TTL value and the SOA
serial number ) and save to an appropriately named file. BIND is
completely agnostic about line ends ( CR+LF or LF ) so notepad on windows,
for example, will generate a useable zone file. You may also want to
verify the zone file using the BIND named-checkzone utility.