Simple DNS resolution on RHEL5.x

Source: Internet
Author: User
Tags nslookup
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
 
 
  1. # Mount/dev/cdrom/media
  2. # Vim/etc/yum. repos. d/local. repo # Add the following content:
  3. [Base]
  4. Name=Server
  5. Baseurl=File: /// Media/Server
  6. Enabled=1
  7. # Yum-y install bind. I * bind-devel bind-chroot caching-nameserver

2. Configure the DNS Service
1. Edit the dns master configuration file

 
 
  1. #cd /var/named/chroot/etc 
  2. #cp -p named.caching-nameserver.conf named.conf 
  3. #vim named.conf 
  4.  
  5. options { 
  6.         listen-on port 53 { any; }; 
  7.         listen-on-v6 port 53 { ::1; }; 
  8.         directory       "/var/named"; 
  9.         dump-file       "/var/named/data/cache_dump.db"; 
  10.         statistics-file "/var/named/data/named_stats.txt"; 
  11.         memstatistics-file "/var/named/data/named_mem_stats.txt"; 
  12.  
  13.         // Those options should be used carefully because they disable port 
  14.         // randomization 
  15.         // query-source    port 53;      
  16.         // query-source-v6 port 53; 
  17.  
  18.         allow-query     { any; }; 
  19.         allow-query-cache { any; }; 
  20. }; 
  21. logging { 
  22.         channel default_debug { 
  23.                 file "data/named.run"; 
  24.                 severity dynamic; 
  25.         }; 
  26. }; 
  27. view localhost_resolver { 
  28.         match-clients      { any; }; 
  29.         match-destinations { any; }; 
  30.         recursion yes; 
  31.         include "/etc/named.zones"; 
  32. }; 

2. Edit the region configuration file, that is, the above named. zones

 
 
  1. # Cp-p named. rfc1912.zones named. zones
  2. # Vim named. zones # content:
  3. Zone "linuxidc.com" IN {
  4. Type master;
  5. File "linuxidc. zone ";
  6. Allow-update {none ;};
  7. };
  8. Zone "155.16.172.in-addr. arpa" IN {
  9. Type master;
  10. File "155.16.172.local ";
  11. Allow-update {none ;};
  12. };

3. Edit the regional database file, that is, the forward and reverse resolution configuration files.

 
 
  1. # Cd/var/named/chroot/var/named
  2. # Cp-p localhost. zone linuxidc. zone
  3. # Vim linuxidc. zone can also be modified as needed.
  4. $ TTL 86400
  5. @ In soa dns.linuxidc.com. root.linuxidc.com .(
  6. 42; serial (d. adams)
  7. 3 H; refresh
  8. 15 M; retry
  9. 1 W; expiry
  10. 1D); minimum
  11. In ns dns.linuxidc.com.
  12. Dns in a 172.16.155.1
  13.  
  14. # Cp-p named. local 155.16.172.local
  15. # Vim 155.16.172.local content can also be modified as needed
  16. $ TTL 86400
  17. @ In soa dns.linuxidc.com. root.linuxidc.com .(
  18. 2012062500; Serial
  19. 28800; Refresh
  20. 14400; Retry
  21. 3600000; Expire
  22. 86400); Minimum
  23. In ns dns.linuxidc.com.
  24. 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.

 
 
  1. #service iptables stop 
  2. #chkconfig iptables off 
  3. #service named start 
  4. #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.

 
 
  1. # Vim/etc/resolv. conf:
  2. Nameserver 172.16.155.1

2. Test the command using nslookup followed by the Domain Name

 
 
  1. # Nslookup dns.linuxidc.com forward parsing Test
  2. Server: 172.16.155.1
  3. Address: 172.16.155.1 #53
  4.  
  5. Name: dns.linuxidc.com
  6. Address: 172.16.155.1
  7.  
  8. # Nslookup 172.16.155.1 reverse resolution Test
  9. Server: 172.16.155.1
  10. Address: 172.16.155.1 #53
  11.  
  12. 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 ....................

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.