How to install DNS server on CentOS 5.
In the first time, you must download core software of this service, that are
- bind
- caching-nameserver
- bind-chroot
You can download this software by this command,
# yum -y install bind caching-nameserver bind-chroot
After you downloaded , you can setup follow this instruction :
1. Check your hostname by this command :
# uname -n
dns.aoddy.com
2. Edit /etc/named.conf
| options { directory “/var/named”; forwarders {WWW.XXX.YYY.ZZZ;}; // IP of ISP // query-source address * port 53; allow-query { localhost; 192.168.0.0/24;}; // query range allow-transfer { localhost; 192.168.0.0/24;}; // transfer range allow-recursion { localhost; 192.168.0.0/24;}; // recursion range };controls { inet 127.0.0.1 allow { localhost; } keys { rndckey; }; };// here is the section for internal informationsview “internal” { match-clients { localhost; 192.168.0.0/24; }; zone “.” IN { type hint; file “named.ca”; }; zone “aoddy.com” IN { // for common resolving type master; file “aoddy.com.fwd”; allow-update { none; }; }; zone “0.168.192.in-addr.arpa” IN { // for reverse resolving *note type master; file “aoddy.com.rev”; allow-update { none; }; }; zone “localdomain” IN { zone “localhost” IN { zone “0.0.127.in-addr.arpa” IN { zone “255.in-addr.arpa” IN { zone “0.in-addr.arpa” IN { }; // here is the section for external informations zone “.” IN { zone “server-linux.info” IN { }; zone “80.0.16.172.in-addr.arpa” IN { |
2. Create /var/named/aoddy.com.fwd
$TTL 86400 @ IN SOA dns.aoddy.com. root.aoddy.com.( 1997022700 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS dns.aoddy.com. IN MX 10 dns.aoddy.com. IN MX 20 web.aoddy.com. IN A 192.168.0.2 dns IN A 192.168.0.2 web IN A 192.168.0.3 |
3. Create file /var/named/aoddy.com.rev
$TTL 86400 @ IN SOA dns.aoddy.com. root.aoddy.com.( 1997022700 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS dns.aoddy.com. IN MX 10 dns.aoddy.com. IN MX 20 web.aoddy.com IN PTR dns.aoddy.com. 2 IN PTR dns.aoddy.com. 3 IN PTR web.aoddy.com. |
4. Start service
# service named restart
5. Test this server can resolve domain&ip
| [root@dns named]# nslookup > dns.aoddy.com Server: 192.168.0.2 Address: 192.168.0.2#53Name: dns.aoddy.com Address: 192.168.0.2 > 192.168.0.2 2.0.168.192.in-addr.arpa name = dns.aoddy.com. |
6. If your service can’t resolve , you can check on your file config by this command :
# named-checkconf







Leave a comment