I. install the software package here using yum 1. configure the local yum source and install the required software package # mount/dev/cdrom/media # vim/etc/yum. repos. d/local. repo # Add the following content: [base] name = Server & nb 1. install the software package here using yum
1. Configure the local yum source and install the required software package
- # Mount/dev/cdrom/media
- # Vim/etc/yum. repos. d/local. repo # Add the following content:
- [Base]
- Name=Server
- Baseurl=File: /// Media/Server
- Enabled=1
- # Yum-y install bind. I * bind-devel bind-chroot caching-nameserver
2. Configure the DNS Service
1. Edit the dns master configuration file
- #cd /var/named/chroot/etc
- #cp -p named.caching-nameserver.conf named.conf
- #vim named.conf
-
- options {
- listen-on port 53 { 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";
-
- // Those options should be used carefully because they disable port
- // randomization
- // query-source port 53;
- // query-source-v6 port 53;
-
- allow-query { any; };
- allow-query-cache { any; };
- };
- logging {
- channel default_debug {
- file "data/named.run";
- severity dynamic;
- };
- };
- view localhost_resolver {
- match-clients { any; };
- match-destinations { any; };
- recursion yes;
- include "/etc/named.zones";
- };
2. Edit the region configuration file, that is, the above named. zones
- # Cp-p named. rfc1912.zones named. zones
- # Vim named. zones # content:
- Zone "linuxidc.com" IN {
- Type master;
- File "linuxidc. zone ";
- Allow-update {none ;};
- };
- Zone "155.16.172.in-addr. arpa" IN {
- Type master;
- File "155.16.172.local ";
- Allow-update {none ;};
- };
3. Edit the regional database file, that is, the forward and reverse resolution configuration files.
- # Cd/var/named/chroot/var/named
- # Cp-p localhost. zone linuxidc. zone
- # Vim linuxidc. zone can also be modified as needed.
- $ TTL 86400
- @ In soa dns.linuxidc.com. root.linuxidc.com .(
- 42; serial (d. adams)
- 3 H; refresh
- 15 M; retry
- 1 W; expiry
- 1D); minimum
- In ns dns.linuxidc.com.
- Dns in a 172.16.155.1
-
- # Cp-p named. local 155.16.172.local
- # Vim 155.16.172.local content can also be modified as needed
- $ TTL 86400
- @ In soa dns.linuxidc.com. root.linuxidc.com .(
- 2012062500; Serial
- 28800; Refresh
- 14400; Retry
- 3600000; Expire
- 86400); Minimum
- In ns dns.linuxidc.com.
- 1 in ptr dns.linuxidc.com.
3. Start the service and set it to enable self-Enable Firewall next time when the firewall is enabled, You need to allow udp port 53 to directly disable the firewall.
- #service iptables stop
- #chkconfig iptables off
- #service named start
- #chkconfig named on
4. test. The client needs to change the/etc/resolv. conf file. Here we will use the local tool for testing. The local server will use the tool to modify the file. It does not matter if it is modified here.
1. Modify the dns server of the client to point to the configuration file.
- # Vim/etc/resolv. conf:
- Nameserver 172.16.155.1
2. Test the command using nslookup followed by the Domain Name
- # Nslookup dns.linuxidc.com forward parsing Test
- Server: 172.16.155.1
- Address: 172.16.155.1 #53
-
- Name: dns.linuxidc.com
- Address: 172.16.155.1
-
- # Nslookup 172.16.155.1 reverse resolution Test
- Server: 172.16.155.1
- Address: 172.16.155.1 #53
-
- 1.155.16.172.in-addr. arpaName=Dns.Linuxidc.com.
The above shows that the IP address resolved by the domain name of dns.linuxidc.com is 172.16.155.1.
The domain name resolved by the IP address of 172.16.155.1 is dns.linuxidc.com.
OK testing is normal ....................