Bind DNS configuration at Redhat Linux

Bind is standard DNS service for Redhat Linux

Install Binary Package

rpm –i bind.~.rpm
rpm –i caching-namingserver-~.rpm

Check named config file rpm –qf /etc/named.conf
Create Domain Modify /etc/named.conf

zone "sun.com" IN {
type master;
file "com.zone"; ← your zone file( /var/named )
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "reverse.com.zone";← your zone file( /var/named )
allow-update { none; };
};

Create Zone File Easy way to create Forward zone file is by copying localhost.zone. Rename with xxx.zone. Reconfigure for relevant domain name. In this example, sun.com is desired domain name.
@ 1D IN SOA sun.com. hostmaster.sun.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ 1D IN NS test.sun.com. ← hostname+Domain
@ 1D IN MX 10 test.sun.com. ← Mail Priority
@ 1D IN MX 20 test1.sun.com.
test 1D IN A 192.168.1.1 ← hostname
java 1D IN A 192.168.1.2
C1 1D IN A 192.168.1.10 │
C2 1D IN A 192.168.1.11 ←│ Add computers
C3 1D IN A 192.168.1.12 │
ftp CNAME test ← test is host
www CNAME test
mail CNAME test

Create reverse zone Copy named.local and rename as reverse.com.zone. Reconfigure it as below.
@ IN SOA com. root.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS test. ← hostname
1 IN PTR test. ← IP 192.168.1.1

Create Cache-Only Name Server

Modify /var/named/localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA test.sun.com hostmaster.test.sun.com (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS test.sun.com ← your name server
1D IN A 127.0.0.1
Modify /var/named/named.local
$TTL 86400
@ IN SOA test.sun.com. root.test.sun.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS test.sun.com. ← your name server
1 IN PTR localhost.
Modify /etc/resolv.conf to try local nameserver
search sun.com
nameserver 192.168.1.1
nameserver 127.0.0.1
DNS service management
service named start/stop/restart
/etc/rc.d/init.d/named start
rndc start/stop/reload
Testing tools
nslookup
host
dig

Comments