This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tech:linux:ubuntu:dns [2016/06/19 15:00] rk4n3 |
tech:linux:ubuntu:dns [2016/06/19 15:02] (current) rk4n3 |
||
---|---|---|---|
Line 3: | Line 3: | ||
[[https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-16-04|A nice reference for configuration of bind on Ubuntu server]] | [[https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-a-private-network-dns-server-on-ubuntu-16-04|A nice reference for configuration of bind on Ubuntu server]] | ||
- | === Config files are under ''/etc/bind'' === | + | **Config files are under:** ''/etc/bind'' |
- | In ''named.conf.options'': | + | **In** ''named.conf.options'': |
* Add an ACL section above the "options" section:<code>acl "trusted" { | * Add an ACL section above the "options" section:<code>acl "trusted" { | ||
192.168.0.123; | 192.168.0.123; | ||
Line 18: | Line 18: | ||
* Uncomment the "forwarders" section, and add upstream DNS servers to it | * Uncomment the "forwarders" section, and add upstream DNS servers to it | ||
- | In ''named.conf.local'': | + | **In** ''named.conf.local'': |
* Add zone(s) for local network/subnets:<code>zone "samudio.net" { | * Add zone(s) for local network/subnets:<code>zone "samudio.net" { | ||
type master; | type master; | ||
Line 30: | Line 30: | ||
};</code> | };</code> | ||
- | Create forward zone file: | + | **Create forward zone file:** |
* ''cd /etc/bind ; mkdir zones ; cp db.local zones/db.samudio.net'' | * ''cd /etc/bind ; mkdir zones ; cp db.local zones/db.samudio.net'' | ||
* Edits to forward zone file (''/etc/bind/zones/db.samudio.net'')<code>@ IN SOA ns1.samudio.net. admin.samudio.net. ( | * Edits to forward zone file (''/etc/bind/zones/db.samudio.net'')<code>@ IN SOA ns1.samudio.net. admin.samudio.net. ( | ||
Line 41: | Line 41: | ||
host2.samudio.net. IN A 192.168.0.102</code> | host2.samudio.net. IN A 192.168.0.102</code> | ||
- | Create reverse zone file(s): | + | **Create reverse zone file(s):** |
* ''cd /etc/bind/zones ; cp ../db.127 ./db.168.192'' | * ''cd /etc/bind/zones ; cp ../db.127 ./db.168.192'' | ||
* Edits to reverse zone file(s):<code>@ IN SOA ns1.samudio.net. admin.samudio.net. ( | * Edits to reverse zone file(s):<code>@ IN SOA ns1.samudio.net. admin.samudio.net. ( | ||
Line 54: | Line 54: | ||
102.0 IN PTR host2.samudio.net. ; 192.168.0.102</code> | 102.0 IN PTR host2.samudio.net. ; 192.168.0.102</code> | ||
- | Check BIND configuration syntax, zone(s), and reverse zone(s): | + | **Check BIND configuration syntax, zone(s), and reverse zone(s):** |
* ''named-checkconf'' | * ''named-checkconf'' | ||
* ''named-checkzone samudio.net db.samudio.net'' | * ''named-checkzone samudio.net db.samudio.net'' | ||
* ''named-checkzone 168.192.in-addr.arpa /etc/bind/zones/db.168.192'' | * ''named-checkzone 168.192.in-addr.arpa /etc/bind/zones/db.168.192'' | ||
- | Restart BIND: ''systemctl restart bind9'' | + | **Restart BIND:** ''systemctl restart bind9'' |
- | Secondary DNS server differences: | + | **Secondary DNS server differences:** |
* The forwarders section in named.conf.options should contain 8.8.8.8 and similar | * The forwarders section in named.conf.options should contain 8.8.8.8 and similar | ||
* In named.conf.local, type should be "slave", with masters pointing to primary<code>zone "samudio.net" { | * In named.conf.local, type should be "slave", with masters pointing to primary<code>zone "samudio.net" { | ||
Line 73: | Line 73: | ||
};</code> | };</code> | ||
- | If using UFW firewall, remember to update rules (on all DNS servers): ''ufw allow Bind9'' | + | **If using UFW firewall, remember to update rules (on all DNS servers):** ''ufw allow Bind9'' |
- | On clients, in ''/etc/network/interfaces'':<code> dns-nameservers 192.168.0.123 192.168.0.125 8.8.8.8 | + | **On clients, in** ''/etc/network/interfaces'':<code> dns-nameservers 192.168.0.123 192.168.0.125 8.8.8.8 |
dns-search samudio.net</code> | dns-search samudio.net</code> | ||
- | Refresh network interface (on clients): ''ifdown --force eth0 && ip addr flush dev eth0 && ifup --force eth0'' | + | **Refresh network interface (on clients):** ''ifdown --force eth0 && ip addr flush dev eth0 && ifup --force eth0'' |
- | Check /etc/resolv.conf on client for correct update, should look like: | + | **Check /etc/resolv.conf on client for correct update, should look like:** |
<code> | <code> | ||
nameserver 192.168.0.123 | nameserver 192.168.0.123 |