How to configure DNS on a Linux Server

Source: Internet
Author: User
Article Title: How to set up DNS on a Linux server. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Author: Wu aiting
  
Background:
---- The company uses a leased line to connect to Chinanet and obtains a section of class c ip address space (for example, 16). At the same time, it applies to ChinaNIC for the Company domain name yourdomain.com, And now sets up a machine as the DNS server, it is also set as a firewall.
  
Object:
---- Internet leased line users
  
Software:
---- Redhat Linux 5.2
  
Implementation process:
  
The server is equipped with two NICs. The internal interface eth1 address is 192.168.11.5, and the external interface eth0 address is 202. a. B. c. The machine name is set to dns.yourdomain.com. The installation and configuration process is omitted.
  
Redhat Linux 5.2 comes with the bind 8. X version with CD. below is my Configuration:
----------
[Root @ dns jephe] # more/etc/named. conf
Options {
Directory "/var/named ";
Forward first;
Forwarders {
202.96.199.20;
};
};
Zone "."{
Type hint;
File "root. hints ";
};
Zone "0.0.127.in-addr. arpa "{
Type master;
File "127.0.0 ";
};
Zone "11.168.192.in-addr. arpa "{
Type master;
File "192.168.11 ";
};
Zone "yourdomain.com "{
Y no;
Type master;
File "yourdomain.com ";
};
---------
  
---- Note:
  
202.96.199.133 is a Chinanet DNS server (ns.sta.net.cn ).
  
Root. hints contains the address of a group of root servers on the Internet, which can be downloaded from the Internet, (ftp://ftp.internic.net/domain/named.ca), and then renamed root. hints, you can also choose another name. The information in this area is very important and must exist. To keep it up-to-date, it is generally updated every month. You can also set a script file, which is automatically updated each time.
  
127.0.0 is the reverse resolution file of the Local interface of the machine. After this file is set, it almost does not need to be changed.
  
192.168.11 is the reverse resolution information of some servers in the Intranet segment.
  
The yourdomain.com file is the forward parsing file of the domain you applied. When you apply for a domain name yourdomain from ChinaNIC, you also need to provide a DNS server to manage the domain. You can use dns.yourdomain.com (202. a. B. c ).
---------
[Root @ dns named] # more 127.0.0
@ In soa dns.yourdomain.com. root.dns.yourdomain.com .(
1999092501 86400 3600 3600000 86400)
NS dns.yourdomain.com.
1 PTR localhost.
[Root @ dns named] # more 192.168.11
@ In soa dns.yourdomain.com. root.dns.yourdomain.com .(
1999092501 86400 3600 3600000 86400)
NS dns.yourdomain.com.
1 PTR host1.yourdomain.com.
2 PTR host2.yourdomain.com.
4 PTR host4.yourdomain.com.
[Root @ dns named] # more yourdomain.com
@ In soa dns.yourdomain.com. root.dns.yourdomain.com .(
1999092501 86400 3600 3600000 86400)
NS dns.yourdomain.com.
Dns A 202. a. B. c
MX 5 dns.yourdomain.com.
Www CNAME dns
Ftp CNAME dns
[Root @ dns named] # more/etc/resolv. conf
Search yourdomain.com
Nameserver 127.0.0.1
Nameserver 202.96.199.20.
[Root @ dns named] # more/etc/hosts
127.0.0.1 localhost. localdomain
202. a. B. c dns.yourdomain.com dns
192.168.11.5 dns.yourdomai.com dns
192.168.11.1 host1.yourdomain.com host1
192.168.11.2 host2.yourdomain.com host2
------------
  
---- Note:
  
You need to contact your ISP for Reverse Domain resolution settings. Generally, you do not need reverse resolution, but some applications may use it. Also, when you access some websites on the Internet, the website will check your connected IP address to see if you can find the corresponding domain name. If not, it will reject connection such as ftp.tis.com. If you get a class c ip address space, only 16 of them 202. a. b. c and 202. a. b. c2: you are using it, but your ISP may not hand over the 16 address subdomains to you for management. For simplicity, the ISP will simply ask you which machines to add, you can provide them with the following information:
---- You need to provide the relevant information, such
$ ORIGIN B. a.202.in-addr. arpa
C PTR dns.yourdomain.com.
C2 PTR host2.yourdomain.com.
  
  
  
After each DNS information update, you can use killall-HUP named to re-read the changed configuration file. You can run tail-f/var/log/messages in another window to check for any error information, to check whether your settings are correct.
  
Finally, you can use nslookup to check your DNS settings, check the forward and reverse domain settings in sequence, and check whether the external sites can be resolved.
References:
ISC Bind homepage: http://www.isc.org/view.cgi? /Products/BIND/index. phtml
  
Bind guide: http://howto.linuxberg.com/LinuxGuide/index.html
  
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.