Build a bind server in linux with source code

Source: Internet
Author: User
Tags domain name server to domain

Build the bind server in linux, compile and install bind [root @ YYzs tmp] # tar xvf bind-9.6.1.tar.gz [root @ YYzs tmp] # cd bind-9.6.1 [root @ YYzs bind-9.6.1] #. /configure? -- Prefix =/usr/local/named? -- Enable-threads // enable multi-thread processing capability [root @ YYzs bind-9.6.1] # make [root @ YYzs bind-9.6.1] # make install // because the installer does not automatically create a master configuration file, so we need to manually create // enter/usr/local/named to create the etc directory [root @ YYzs bind-9.6.1] # cd/usr/local/named [root @ YYzs named] # mkdir etc // from rndc. extract named from the conf file. keyroot @ linux for conf? Named] #? Cd? Sbin [root @ YYzs sbin] #. /rndc-confgen | tail-10 | head-9 | sed s/# \ // g>/usr/local/named/etc/named. conf // automatically generate a named in/usr/local/named/etc, conf file 2. Change the bind configuration file [root @ YYzs etc] # vi/usr/local/named/etc/named. conf // Add the following code options {# named file directory "/var/named"; # process id file name pid-file "named. pid ";}; controls {inet 127.0.0.1 allow {localhost ;}keys {rndckey ;};}; zone ". "IN {type hint; file" named. Root ";}; zone" localhost "IN {type master; file" localhost. zone "; allow-update {none ;};# specify the named as the 127.0.0 CIDR block to switch to the master server. # The named. local file contains the address-to-Domain Name conversion data in the format of 127.0.0. # (The 127.0.0 CIDR block address is the internal loopback address of the LAN interface) zone "0.0.127.in-addr. arpa "IN {type master; file" named. local "; allow-update {none ;};# specify named as the primary domain name server in the test.com domain. # The test. zone file contains all domain name conversion data in the form of * .test.com. Zone "test.com" IN {type master; file "test. zone"; allow-update {none ;};# specify the named as the master server for converting the IP address range of 192.168.1. # The test. local file contains all the conversion data from addresses in the form of 192.168.1. * to domain names. Zone "1.168.192.in-addr. arpa "IN {type master; file" test. local "; allow-update {none ;};}; 3. Create a partition file directory [root @ YYzs etc] # mkdir/var/named // enter/var/named www.2cto.com [root @ YYzs etc] # cd/var/named // /create localhost. zone file [root @ YYzs named] # vi localhost. zone $ TTL 86400 $ ORIGIN localhost. @ 1D in soa @ root (42; serial (d. adams) 3 H; refresh 15 M; retry 1 W; expiry 1D); minimum 1D in ns @ 1D in a 127. 0.0.1 // create named. local file [root @ YYzs named] # vi named. local $ TTL 86400 @ in soa localhost. root. localhost. (1997022700; Serial 28800; Refresh 14400; Retry 3600000; Expire 86400); Minimum in ns localhost. 1 in ptr localhost. // The dig command directly generates the named. root file [root @ YYzs named] # dig> named. root // create a forward resolution file for the test.com domain name [root @ YYzs named] # vi test. zone $ ttl 1D @ in soa test.com. root.test.com. (1053891162 3 H 15 M 1 W 1D) in ns test.com. in mx 5 test.com. www in a 192.168.1.107 // create A reverse resolution file for the test.com domain name [root @ YYzs named] # vi test. local $ TTL 86400 @ in soa test.com. root.test.com. (20031001; www.2cto.com 7200; 3600; 43200; 86400); @ in ns test.com. 82 in ptr dns.test.com. 4. Start the bind server [root @ YYzs named]/usr/local/named/sbin/named-c/usr/local/named/etc/named. conf & 5642 5. Test DNS [root @ YYzs named] # host 192.168.1.107 107.1.168.192.in-addr. arpa domain name pointer dns.test.com. // The above display indicates that dns reverse resolution is normal [root @ YYzs named] # ping www.test.com PING www.test.com (192.168.1.107) 56 (84) bytes of data. // The above display indicates that forward resolution is normal // DNS configuration is complete. From the movie month's injury Column

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.