Fedora 25: Install bind for DNS server

Table of Contents

1 Install bind

Install bind and enable named.

$ sudo dnf install -y bind$ sudo systemctl enable named

Open port for bind.

$ sudo firewall-cmd –add-service=dns –permanent$ sudo firewall-cmd –reload

2 Configuration

Make /etc/named.conf to load zone file of private network.

$ cat <<EOF | sudo tee -a /etc/named.confzone “hiroom2.com” in { type master; file “hiroom2.com.zone”;};EOF

Allow query from

$ sudo sed -e “s:allow-query.*:allow-query {; localhost; };:g” -e “s:listen-on port .*:listen-on port 53 {;; };:g” -i /etc/named.conf

Create zone file of private network. Append “A record” for hostname.

$ cat <<EOF | sudo tee /var/named/hiroom2.com.zone$TTL 86400@ IN SOA hiroom2.com root.hiroom2.com ( 2017010302 3600 900 604800 86400)@ IN NS serverserver IN A

Restart bind.

$ sudo systemctl restart named

2.1 Validation

named-checkconf validates /etc/named.conf.

$ named-checkconf

named-checkzone validates zone file.

$ named-checkzone hiroom2.com /var/lib/named/hiroom2.com.zonezone hiroom2.com/IN: loaded serial 2017010302OK

3 Execution result

/etc/resolv.conf is as below. is for resolving private network. is for resolving internet.

$ cat /etc/resolv.conf<snip>search hiroom2.comnameserver

Run ping command to “server”.

$ ping -c 1 server.hiroom2.comPING server.hiroom2.com ( 56(84) bytes of data.64 bytes from icmp_seq=1 ttl=64 time=0.224 ms— server.hiroom2.com ping statistics —1 packets transmitted, 1 received, 0% packet loss, time 0msrtt min/avg/max/mdev = 0.224/0.224/0.224/0.000 ms

Android | Linux | SDL - Narrow Escape