I. Installation
Yum install bind-utils.x86_64
Yum install bind
Ii. Configuration
Vim/etc/named. conf
Edit the file content as follows:
######################################## ####################
Options {
Listen-on port 53 {127.0.0.1; 192.168.4.103 ;};
Directory "/var/named ";
Allow-query {Any ;};
};
Zone "." In {
Type hint;
File "named. ca ";
};
Zone "example.com" in {
Type master;
File "example.com. Zone ";
};
Include "/etc/named. rfc1912.zones ";
Include "/etc/named. Root. Key ";
######################################## ###################
[[Email protected] desktop] # cd/var/named/
[[Email protected] named] # cp named. localhost example.com. Zone-P
[[Email protected] named] # Vim example.com. Zone
To:
######################################## #######################
$ TTL 1d
@ In SOA @ root.server03.example.com .(
0; Serial
1D; refresh
1 h; retry
1 W; expire
3 H); Minimum
NS @
A 127.0.0.1
Server03 in a 192.168.4.103
######################################## ###########################
[[Email protected] named] #/etc/init. d/named restart
Specify DNS Server:
[[Email protected] named] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Add:
Dns1 = 192.168.4.254
Restart NIC:
[[Email protected] named] #/etc/init. d/network restart
Test:
[[Email protected] named] # NSLookup server03
Server: 192.168.4.103
Address: 192.168.4.103 #53
Name: server03.example.com
Address: 192.168.4.103
[[Email protected] named] # NSLookup server03.example.com
Server: 192.168.4.103
Address: 192.168.4.103 #53
Name: server03.example.com
Address: 192.168.4.103
3. resolve an IP address to a domain name
Edit the name. conf file:
Add content:
Zone "4.168.192.in-ADDR. Arpa" in {
Type master;
File "192.168.4.zone ";
};
[[Email protected] named] # pwd
/Var/named
[[Email protected] named] # cp example.com. Zone 192.168.4.zone-P
Edit the 192.168.4.zone file:
To:
$ TTL 1d
@ In SOA @ root.server03.example.com .(
0; Serial
1D; refresh
1 h; retry
1 W; expire
3 H); Minimum
NS @
A 127.0.0.1
103 in PTR server03.example.com.
Restart named
[[Email protected] named] #/etc/init. d/named restart
Test:
[[Email protected] named] # NSLookup 192.168.4.103
Server: 192.168.4.103
Address: 192.168.4.103 #53
103.4.168.192.in-ADDR. Arpa name = server03.example.com.
4. Make the DNS server secure
Install bind-chroot
!!! Stop the named service
[[Email protected] named] # service named stop
Installation:
[[Email protected] named] # Yum install bind-chroot
[[Email protected] named] # cd/var/named/chroot/etc/
[[Email protected] etc] # cp/etc/named *./-P
[[Email protected] etc] # CD ../var/named/
[[Email protected] named] # It is normal if LS is empty
[[Email protected] named] # cp-RP/var/named /*./
[[Email protected] named] # rm-RF chroot/
[[Email protected] named] # ls
192.168.4.zone dynamic named. Ca named. localhost slaves
Data example.com. Zone named. Empty named. loopback
Cannot have chroot
[[Email protected] named] # cd/var/named
[[Email protected] named] # pwd
/Var/named
[[Email protected] named] # rm-RF example.com. Zone
[[Email protected] named] # rm-RF 192.168.4.zone
Restart the service:
[[Email protected] etc] #/etc/init. d/named restart
Stopping named: [OK]
Starting named: [OK]
Verification:
[[Email protected] etc] # NSLookup server03.example.com
Server: 192.168.4.103
Address: 192.168.4.103 #53
Name: server03.example.com
Address: 192.168.4.103
[[Email protected] etc] # NSLookup 192.168.4.103
Server: 192.168.4.103
Address: 192.168.4.103 #53
103.4.168.192.in-ADDR. Arpa name = server03.example.com.
Now Named. comf uses/var/named/chroot/etc/named. conf
OK!
Configure DNS Server