OpenSUSE Leap 42: Install bind for DNS server

Table of Contents

1 Install bind

Install bind and enable named.

> sudo zypper -n in bind> sudo systemctl enable named

Open port for bind.

> for t in FW_CONFIGURATIONS_EXT FW_CONFIGURATIONS_DMZ FW_CONFIGURATIONS_INT; do sudo sed -e “s/^${t}=”(.*)”/${t}=”1 bind”/g” -i /etc/sysconfig/SuSEfirewall2done> sudo systemctl restart SuSEfirewall2

2 Configuration

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

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

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

> cat <<EOF | sudo tee /var/lib/named/$TTL 86400@ IN SOA ( 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 /var/lib/named/ 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 ( 56(84) bytes of data.64 bytes from icmp_seq=1 ttl=64 time=0.224 ms— 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