-
Notifications
You must be signed in to change notification settings - Fork 6
DNS setup
The old djbdns setup is being replaced with a BIND based system.
The key points (and differences to the former system) are as follows
- Server names:
dns0.lokun.is
anddns1.lokun.is
. - DNS servers both serve as DNS caches to VPN clients and as resolvers for the
lokun.is
domain - The resolver is dynamically updated with info from record. Currently via the REST api, but there have been experiments with using ZeroMQ.
- Zones such as
netflix.com
are being overridden and directed through a US based proxy
-
Install from apt and pip
# sudo apt-get install bind9 python-pip python-dev # pip install requests
-
Create
log/
anddns/
in/srv/
. Get theupdatebind.py
script fromlokun
(private) repo and store in/srv/dns
, also includeconfig.py
and fill out accordingly.# mkdir /srv/dns /srv/log # cp lokun/dns/updatebind.py lokun/dns/config.py /srv/dns
-
Create the zone file and
named.conf.options
# python /srv/dns/updatebind.py --update-zone --update-named-conf-options # /etc/init.d/bind9 restart
-
Copy the files to override zones from the private repo;
db.override
for the override zone itself andnamed.conf.local
for mapping domains to the override zone. Place them in/etc/bind
# cp lokun/dns/db.override lokun/dns/named.conf.local /etc/bind # /etc/init.d/bind restart
IMPORTANT: Remember to adjust the IP address in for the
NS
record (should be the IP of the DNS server) and for theA
record (proxy server)There are on secrets to this, see Tunlr-Clone if you want your own.
-
Put the following lines in cronjob:
*/5 * * * * /usr/bin/python /srv/dns/updatebind.py --update-zone -r > /dev/null 20 4 * * * /usr/bin/python /srv/dns/updatebind.py --update-named-conf-options > /dev/null
-
Update the following files to reflect the IP or FQDN of the current system
/etc/resolv.conf
/etc/bind/db.override
/etc/mailname
/etc/hosts
-
Restart bind
# /etc/init.d/bind9 restart