The following is a forward resolution based on RedHat 5 or CentOS System (IP192.168.1.2 domain name is www.linuxidc.com). To ensure successful construction, do not miss any step. The following is a detailed step-by-step command can also ensure success! (For reverse resolution steps, refer to the next article)
1. Install related software packages: to ensure smooth operation, follow these steps to delete and reinstall all software packages.
[Root @ server ~] # Rpm-qa | grep bind // view bind related software packages
[Root @ server ~] # Rpm-e 'rpm-qa | grep bind' -- nodeps // Delete related software packages
[Root @ server ~] # Mount/dev/cdrom/media // mount the system disk to/media/
[Root @ server media] # cd/media/Server // enter the/media/Server/directory
[Root @ server Server] # rpm-vih bind-* // reinstall the Software Package
[Root @ server Server] # rpm-vih caching-nameserver-9.3.3-7.el5.i386.rpm
[Root @ server Server] # service named start // restart the named service
2. Modify the master configuration file
[Root @ server Server] # cd/var/named/chroot/etc // enter the/var/named/chroot/etc/directory
[Root @ server etc] # vim named. caching-nameserver.conf // modify the master configuration file
----------------------------------------------------------------------
Options {
Listen-on port 53 {any ;}; // modify it to any
Listen-on-v6 port 53 {: 1 ;};
Directory "/var/named ";
Dump-file "/var/named/data/cache_dump.db ";
Statistics-file "/var/named/data/named_stats.txt ";
Memstatistics-file "/var/named/data/named_mem_stats.txt ";
Query-source port 53;
Query-source-v6 port 53;
Allow-query {any ;}; // modify it to any
};
Logging {
Channel default_debug {
File "data/named. run ";
Severity dynamic;
};
};
View localhost_resolver {
Match-clients {any ;}; // modify it to any
Match-destinations {any ;}; // modify it to any
Recursion yes;
Include "/etc/named. rfc1912.zones ";
};
----------------------------------------------------------------------
3. Modify the extension file of the Host Configuration File
[Root @ server etc] # vim named. rfc1912.zones // modify the host configuration file extension and add it in the last line
----------------------------------------------------------------------
Zone "linuxidc.com" IN {// IN can be unavailable
Type master; // type-Based Domain
File "linuxidc.com"; // Domain Configuration file
};
---------------------------------------------------------------------
4. Create a domain configuration file for linuxidc.com
[Root @ server etc] # cd/var/named/chroot/var/named // enter the/var/named/chroot/var/named/directory
[Root @ server named] # cp named. local linuxidc.com // copy the domain configuration file
[Root @ server named] # vim linuxidc.com
--------------------------------------------------------------------
$ TTL 86400
@ In soa localhost. root. localhost .(
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
In ns localhost.
Www in a 192.168.1.2 // Modify the last line to... (this line)
--------------------------------------------------------------------
[Root @ server named] # bind-chroot-admin-s // automatically sets the group and permissions
[Root @ server named] # service named restart // restart the named service
5. test and verification
[Root @ localhost ~] # Nslookup // verify that the resolution is successful on the local machine
> Www.linuxidc.com
Server: 192.168.1.2
Address: 192.168.1.2 #53
Name: www.linuxidc.com
Address: 192.168.1.2
C: authentication ents and SettingsAdministrator> nslookup // The authentication is successful when the remote windows Server is lying.
* ** Cant find server name for address 219.244.93.2: Non-existent domain
* ** Default servers are not available
Default Server: UnKnown
Address: 219.244.93.2 // The original DNS is 219.244.93.2
> Server 192.168.1.2 // modify the DNS host
Default Server: [192.168.1.2]
Address: 192.168.1.2
> Www.linuxidc.com
Server: [192.168.1.2]
Address: 192.168.1.2
Name: www.linuxidc.com
Address: 192.168.1.2