DNS
Related Concepts
DNS (domain Name System), a distributed database of domain names and IP addresses that are mapped to each other on the Internet, makes it easier for users to access the Internet without remembering the number of IP strings that can be read directly by the machine. The process of obtaining the IP address of the host name through the hostname is called Domain name resolution (or hostname resolution). The DNS protocol runs on top of the UDP protocol, using the port number 53.
Function: Resolve domain name Zone: Forward zone, reverse zone record: a record MX record: Build mail server PTR record: Reverse record, appear in reverse area CNAME record: Alias record NS records: DNS licensing server type: master server, slave server
Linux
Build
DNS
Server
Software: bind-9.8.2**** bind-chroot**** service Name: named Port number: UDP- TCP- config-file: Master profile:/var/named/ chroot/etc/named.conf record file:/var/named/chroot/var/named/record filename
Build the main
DNS
Server
Requirements: XX company exists a Web server, The site name is www.bj.com, and the IP address of the Web server is 192.168.1.1; There is an FTP server with an FTP name of ftp.bj.com,ftp server with IP 192.168.1.2; You now want all employees to access the site server and FTP server by domain name
1. Install bind software
# RPM-IVH bind-9.8.2-0.10.rc1.el6.i686.rpm# RPM-IVH bind-chroot-9.8.2-0.10.rc1.el6.i686.rpm
2. Generate named.conf Master profile, set up the zone
# vim/var/named/chroot/etc/named.confoptions { directory "/var/named";}; Zone "bj.com" { type master; File "Bj.com.zone";};
3. Generate record files, create records
# cp/usr/share/doc/bind-9.8.2/sample/var/named/named.localhost/var/named/chroot/var/named/bj.com.zone# vim/var/ Named/chroot/var/named/bj.com.zone
$TTL 1d@ in SOA bj.com. qq.bj.com. ( 0 127.0 . 0.1 AAAA:: 1 www A 192.168 . 1.1 ftp A 192.168 . 1.2 ~
Recording
4. Start the DNS service, test
# rndc-confgen-r/dev/urandom-a#/etc/init.d/named Start
Native test:
# Vim/etc/resolv.confnameserver 10.1.1.1
# nslookup
>Serverdefault Server:10.1.1.1Address:10.1.1.1# ->Www.bj.comServer:10.1.1.1Address:10.1.1.1# -Name:www.bj.comAddress:192.168.1.1>Ftp.bj.comServer:10.1.1.1Address:10.1.1.1# -Name:ftp.bj.comAddress:192.168.1.2>
content
5. Set the DNS service to boot automatically
# chkconfig--level 2345 named on# chkconfig--list namednamed 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enabled 6: Off
6, establish the reverse region, test the reverse analysis
1) Set up the reverse zone in the named.conf master configuration file
Zone "1.168.192.in-addr.arpa" { type master; File "192.168.1.zone"; };
2) generate reverse zone-related log files
Vim 192.168.1.zone
$TTL 1d@ In SOA bj.com. qq.bj.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H) ; minimum NS @ A 127.0. 0.1 AAAA ::11 PTR www.bj.com. 2 PTR ftp.bj.com. ~
Record
3) Restart the DNS service, test
#/etc/init.d/named Restart stop named:. [OK] start named: [OK]
>Serverdefault Server:10.1.1.1Address:10.1.1.1# ->192.168.1.1Server:10.1.1.1Address:10.1.1.1# - 1.1.168.192.inch-addr.arpa name =www.bj.com.>192.168.1.2Server:10.1.1.1Address:10.1.1.1# - 2.1.168.192.inch-addr.arpa name =ftp.bj.com.> Exit
View Code
Build from
DNS
Server
Requirements: Existing two servers, IP addresses are 10.1.1.1 and 10.1.1.2 respectively. Where 10.1.1.1 is the primary DNS service, in order to avoid the main DNS service downtime, build from DNS server on 10.1.1.2, use as Backup
1. Modify the configuration file of the primary DNS server, specifying the IP from the DNS server
#vim/var/named/chroot/etc/named.conf
Options {Directory"/var/named"; }; Zone"bj.com"{type Master; File"Bj.com.zone"; allow-transfer {10.1.1.2; }; }; Zone"1.168.192.in-addr.arpa"{type Master; File"192.168.1.zone"; allow-transfer {10.1.1.2; }; };
configuration file
2. Install the BIND software from the DNS server
# mount/dev/cdrom/mnt/# rpm-ivh/mnt/packages/bind-9.8.2-0.10.rc1.el6.i686.rpm# rpm-ivh/mnt/packages/ bind-chroot-9.8.2-0.10.rc1.el6.i686.rpm
3. Configure the DNS configuration file from the DNS server to specify the IP of the primary DNS server in the configuration file
# vim/var/named/chroot/etc/named.conf
Options {Directory"/var/named";}; Zone"bj.com"{type slave; Masters {10.1.1.1; }; File"Slaves/bj.com.zone";}; Zone"1.168.192.in-addr.arpa"{type slave; Masters {10.1.1.1; }; File"Slaves/192.168.1.zone";};
configuration file
4. Start the service from the DNS server to test whether the files are synchronized
#/etc/init.d/named Startgenerating/etc/rndc.key: [OK] start named: [OK] effect:
# ls/var/named/chroot/var/named/slaves/
192.168.1.zone Bj.com.zone
Windows Resolution nslookup view
C:\users\administrator>nslookup default server: unknownaddress:0.0.0.0> Server10.1.1.2default server: [10.1.1.2]address:10.1.1.2>www.bj.com server: [10.1.1.2]address:10.1.1.2Name: www.bj.comAddress:192.168.1.1>ftp.bj.com server: [10.1.1.2]address:10.1.1.2Name: ftp.bj.comAddress:192.168.1.2>192.168.1.1server: [10.1.1.2]address:10.1.1.2Name: www.bj.comAddress:192.168.1.1>192.168.1.2server: [10.1.1.2]address:10.1.1.2Name: ftp.bj.comAddress:192.168.1.2>
View Code
Recursive query:
Options {
Directory "/var/named";
forwarders {8.8.8.8; 4.4.4.4;};
};
Linux Build DNS Server