RHEL5 + bind9 simple and quick DNS server construction

Source: Internet
Author: User
1. environment: System: rhle5.4 server IP: 192.168.191.3 test domain name: www.baidu.org. tw2, software package (with the installation disk comes with RPM Package installation): # rpm-ivhbind-libs-9.3.6-4.P1.el5.rpm # rpm-ivhbind-utils-9.3.6-4.P1.el5.rpm # rpm-ivhbi 1, environment:

System: rhle5.4

Server IP: 192.168.191.3

Test domain name: www.baidu.org.tw

2. software package (use the RPM package that comes with the installation disk ):

# Rpm-ivh bind-libs-9.3.6-4.P1.el5.rpm
# Rpm-ivh bind-utils-9.3.6-4.P1.el5.rpm


# Rpm-ivh bind-9.3.6-4.P1.el5.rpm


3. create the zone file directory used by bind.

# Mkdir/var/bind

4. after the program is installed, the rndc. conf and rndc. key files are generated.

#/Usr/sbin/rndc-confgen>/etc/rndc. conf

# Cat/etc/rndc. conf
# Start of rndc. conf
Key "rndckey "{
Algorithm HMAC-MD5;
Secret "kViQTHXyvhfaP8nZsb8kcg = ";
};

Options {
Default-key "rndckey ";
Default-server 127.0.0.1;
Default-port 953;
};
# End of rndc. conf


# Cat/etc/rndc. conf>/etc/rndc. key

(Delete the lines not commented in the previous rndc. conf file, leave the following comments, and cancel the comments)
# Cat/etc/rndc. key

# Start of rndc. conf

# Use with the following in named. conf, adjusting the allow list as needed:
Key "rndckey "{
Algorithm HMAC-MD5;
Secret "kViQTHXyvhfaP8nZsb8kcg = ";
};

Controls {
Inet 127.0.0.1 port 953
Allow {127.0.0.1;} keys {"rndckey ";};
};
# End of named. conf



5. create the/etc/named. conf file.

# Cat/etc/named. conf

Options {
Directory "/var/bind ";
Allow-query {any ;};
};

Zone "."{
Type hint;
File "named. ca ";
};

Zone "baidu.org.tw "{
Type master;
File "named.baidu.org.tw ";
Allow-update {none ;};
};

Zone "191.168.192.in-addr. arpa "{
Type master;
File "named.192.168.191 ";
};

Include "/etc/rndc. key ";


6. create a DNS root query address file

# Dig>/var/bind/named. ca

# Cat/var/bind/named. ca

; <> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <>-t NS
; Global options: printcmd
; Got answer:
;-> HEADER <-opcode: QUERY, status: NOERROR, id: 19763
; Flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 15

; Question section:
;. IN NS

; Answer section:
. 59186 in ns c.root-servers.net.
. 59186 in ns m.root-servers.net.
. 59186 in ns f.root-servers.net.
. 59186 in ns d.root-servers.net.
. 59186 in ns a.root-servers.net.
. 59186 in ns e.root-servers.net.
. 59186 in ns g.root-servers.net.
. 59186 in ns l.root-servers.net.
. 59186 in ns j.root-servers.net.
. 59186 in ns B .root-servers.net.
. 59186 in ns k.root-servers.net.
. 59186 in ns I .root-servers.net.
. 59186 in ns h.root-servers.net.

; Additional section:
A.root-servers.net. 145586 in a 198.41.0.4
B .root-servers.net. 145607 IN A 192.228.79.201
C.root-servers.net. 255305 in a 192.33.4.12
D.root-servers.net. 299927 in a 128.8.10.90
E.root-servers.net. 155401 in a 192.203.230.10
F.root-servers.net. 299837 in a 192.5.5.241
G.root-servers.net. 247679 in a 192.112.36.4
H.root-servers.net. 259378 in a 128.63.2.53
I .root-servers.net. 299747 IN A 192.36.148.17
I .root-servers.net. 479706 IN AAAA 2001: 7fe: 53
J.root-servers.net 259611 in a 192.58.128.30
J.root-servers.net. 145586 in aaaa 2001: 503: c27: 2: 30
K.root-servers.net. 153654 in a 193.0.14.129
K.root-servers.net. 153654 in aaaa 2001: 7fd: 1
L.root-servers.net. 151716 in a 199.7.83.42

; Query time: 5 msec
; SERVER: 211.162.78.1 #53 (211.162.78.1)
; WHEN: Tue Dec 14 12:42:31 2010
; Msg size rcvd: 504


7. create the following files in the/var/bind Directory

# Vi/var/bind/named.baidu.org.tw

$ TTL 600
@ In soa baidu.org.tw. root.baidu.org.tw .(
2003061800; serial
28800; refresh
14400; retry
3600000; expire
86400); minimum
@ In ns baidu.org.tw. // (note that there is a point at the end)
Www in a 192.168.191.3
Ftp in a 192.168.191.3
Mail in a 192.168.191.3
Baidu.org.tw in a 192.168.191.3
@ In mx 5 mail


# Vi/var/bind/named.192.168.191

$ TTL 600
@ In soa baidu.org.tw. root.baidu.org.tw .(
2003061800; serial
28800; refresh
14400; retry
3600000; expire
86400); minimum
@ In ns baidu.org.tw.
3 IN PTRwww.baidu.org.tw.
3 IN PTRftp.baidu.org.tw.
3 in ptr mail.baidu.org.tw.


8. start the named service.

# Service named start
 

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.