This repository contains the script for installing a DNS Bind Server on an Ubuntu Machine.
-
Editing
named.conf.options
file- Add all the private IPs in the
acl "trusted"
tag. An example is mentioned in the file. - Next, under the
options
tag find thelisten-on
option and update it with the Private IP for the primary DNS server. - If we have a secondary DNS server, we need to find the
allow-transfer
under theoptions
tag and replace thenone
with the Private IP address of the secondary DNS server.
- Add all the private IPs in the
-
Editing the
named.conf.local
file-
Configure Forward lookup zone
- Next we need to do is update the DNS zones.
named.conf.local
already has the instructions to update for the forward and backward zone. - For configuring the forward zone, replace the
nyc3.example.com
under the forward zone with your subdomain. - Next, we need to update the filename wrt the subdomain and update the same under the
file
option under the zone. - If we have a secondary DNS server, we need to find the
allow-transfer
under theoptions
tag and replace thenone
with the Private IP address of the secondary DNS server. Our forward zone is configured now.
- Next we need to do is update the DNS zones.
-
Configure the Reverse loopup zone
- Next we need to configure is our Reverse loopkup zone. Under the reverse zone change the
45.123
with the octet reversal of what your Private IP starts with. In the example the IP starts with123.45
, the octet reversal for which is45.123
- Next, we need to update the filename wrt the octet reversal IP and update the same under the
file
option under the zone. - If we have a secondary DNS server, we need to find the
allow-transfer
under theoptions
tag and replace thenone
with the Private IP address of the secondary DNS server. Our reverse zone is configured now.
- Next we need to configure is our Reverse loopkup zone. Under the reverse zone change the
-
-
Editing the Forward Zone file
- The forward zone file will be of the name
db.nyc3.example.com
. We need to update the filename wrt our subdomain. - Update
ns1.nyc3.example.com
with the Private FQDN of the DNS server. - Update
nyc3.example.com
with the subdomain. - Under
name server - NS records
update with the DNS server name. - Under
name server - A records
update with the DNS Servers name and IP. - Under
host server - A records
update with the Host servers name and IP.
- The forward zone file will be of the name
-
Editing the Reverse Zone File
- The reverse zone file will be of the name
db.45.123
. We need to update the filename wrt our octet reversal IP. - Update
ns1.nyc3.example.com
with the Private FQDN of the DNS server. - Update
nyc3.example.com
with the subdomain. - Under
name servers
update with DNS server name. - Under
PTR records
update with DNS and host servers name and IPs.
- The reverse zone file will be of the name
-
Editing the
00-private-nameservers.yaml
file- Update the name of the private network interface.
- Update the Private IP of the DNS server under
addresses
. - Update the subdomain under
search
.
-
Editing the
script.sh
file- Update the file paths for the respective files.
- Update the execution permission on the file using the following command.
sudo chmod +x script.sh
- Run the script using the following command
./script.sh