How to create a DNS server in Linux



How to create a DNS server in Linux: the environment is assumed

1 two machines, a LINUX, machines called LINUX, the domain name tongqiang.cnIP address is 192.168.0.5, the other machine as WIN98, machine named tongqiang, IP address from the DHCP server on LINUX obtained.

Second, to establish DNS server (assuming your DNS package is installed, and is installed in the installation of LINUX is to select the DNS server)

Only need to modify the DNS server to establish the following file.

1 named.boot or named.conf (Note: The following version of the RedHatlinux5.2 need to modify named.boot, or later in the RedHatlinux5.2 need to modify named.conf.

Amended as follows: (in front; that comment)

; Boot file for name server

directory / var / named (specify from / var / named directory, read the DNS database file, parse the file, such as forward, reverse lookup files, local files, cache files are in this directory)

primary tongqiang.cn tongqiang.cn.db (the primary DNS server specified in the analytical domain is tongqiang.cn, DNS database file is tongqiang.cn.db)

primary 0.0.127.in-addr.arpa db.127.0.0.0 (specify resolve internal DNS database file address translation)

primary 0.168.192.in-addr-arpa db.0.168.192 (reverse lookup DNS database file specified)

cache. db.cache (specify from the internet to get the "root" server address file)

Three database files were established in all

A positive resolution to establish DNS database file, enter the directory / var / named

vi tongqiang.cn.db

(The contents of the file)

@ IN SOA linux.tongqiang.cn. Root.linux.tongqiang.cn. (199511301

28800

7200

3600000

86400)

NS linux.tongqiang.cn.

Mx 10 support.tongqiang.cn

Localhost A 127.0.0.1

Linux A 192.168.0.5

WWW CNAME linux.tongqiang.cn.

In the above DNS database file, the first line were the name of the specified DNS server, DNS administrator's email address, behind the figures, pointing out the first version, each time you modify this file should increase the version number, that is,Simply add 1 above.NS records indicate the back of a domain name server's own domain name, MX record pointing out the e-mail address translation records, A record is a new address, specify the domain name to IP address from the corresponding relationship.CNAME is an alias record, the role is to www.tongqiang.cn corresponding linux.tongqiang.cn

Please note that the above relative and absolute domain name, ie some domain name followed by a dot (.), Some additional points not followed by (..)Is an alias record and MX record points to add the domain name back.

2. To establish a reverse database parse the file (db.0.168.192)

@ IN SOA linux.tongqiang.cn. Root.linux.tongqiang.cn. (

199,511,301

28800

7200

3600000

86400)

NS linux.tongqiang.cn.

5 PTR linux.tognqiang.cn.

Similar meaning and positive solutions of the above, only PTR record for reverse lookups.

3 Create db.127.0.0.0

@ IN SOA linux.tongqiang.cn. Root.linux.tongqiang.cn. (

199,511,301

28800

7200

3600000

86400)

NS linux.tongqiang.cn.

1 PTR localhost

Meaning and the same.

4 As db.cache file, you can download it from the ftp.rs.internic.net.Db.cache downloaded file can be changed.

IV. Start and test named

Ndc start with

Then use the nslookup command a command prompt, check the positive resolution, the direct input as well linux can check the reverse parsing, such as 192.168.0.5 to parse the input.Check the alias and MX records, enter set q = cname and set q = mx, and then enter the www.tongqiang.cn respectively, and e-mail address.

Five. Modifying database records after a certain increase in version number, do not forget to modify the reverse lookup file, then reload the database file with ndc reload.

VI. This experiment is very simple, if there is another in the domain of the network segment, as well as access to the Internet when connected through the ISP's DNS settings see "DNS complementary set."