DNS: Domain name resolution (Nmae System)
Forward parsing:
Based on the host name (domain name) to find its corresponding IP address, which is the most basic, most commonly used features
Reverse parsing:
Find its corresponding host name (domain name) based on IP address, anti-spam/security protection and other areas used
DNS Distributed architecture
Full qualified Domain name fully qualified host name
Site name. domain name suffix
The site name. 。。。 Second-level domain. First-level domain
DNS Domain name Management
LANA (Internet digital Distribution Agency)
The entire domain Name system of the highest authority, the head of the DNS root,. int,.arpa and other internationalized domain names
CNNLC (China Internet Network Information Center)
Competent national top-level domain. CN
Domain Name agent/Registration/Purchase service provider
New Net: www.xinnet.com
Million Net: www.net.cn
China Internet: hulian.top
————————————————————————————————————————————
BLND Domain Name Service
Berkeley Internet domain Name Service, official site: www.isc.org
[[email protected] ~]# yum-y install bind (Domain Name Service)
[[email protected] ~]# yum-y install Bind-chroot (provides virtual root support)
BLND Service-side program
Main execution procedure:/usr/sbin/named
Service script:/erc/init.d/named
Default port: TCP/UDP 53
Virtual root environment at runtime:/var/named/chroot
Master configuration file:/etc/named.conf
Address library file (zone data file):/var/named/. Provide ' domain-ip address ' record.
NAMED.CONF Configuration Resolution
Global configuration section: Set the listening address/port, address inventory placement, etc.
[Email protected] named]# vim/etc/named.conf
Options {
Listen-on Port 53 {127.0.0.1;}; (Listening address and port)
Listen-on-v6 Port 53 {:: 1;};
Directory "/var/named"; (default location for address files)
allow-query {localhost;}; (Allow any client query)
.............
Include "/etc/named.rfc1912.zones"; (Other configuration files can be loaded)
.......................
Zone "." In {(Define forward region)
Type hint; (Zone type is primary DNS)
File "named.ca";(address library files)
};
Address Library file parsing
Global TTL configuration items and SOA records
$TTL (Time to live lifetime)
SOA (Start of authority licensing information)
The part representing the beginning of the semicolon represents the comment
[Email protected] ~]# Vim/var/named/named.localhost
$TTL 1D//valid record lifetime, no units default seconds (D-Day, H-hour, W-week, M-minute)
@ in SOA @ rname.invalid. (
0; Serial//Update sequence number, integer within 10 bits
1D; Refresh//Refreshed time
1H; Retry//Retry interval
1W; Expire//Expiry time
3H); Minimum//Invalid record life cycle
NS @
A 127.0.0.1
AAAA:: 1
(SOA zone name. Zone Administrator mailbox: Within the current file, the region name can be abbreviated to @. )
Domain Name resolution record
@ in NS xx.xx.xx
NS in A 192.168.1.1
www in A 192.168.1.254
(NS, domain name server record, a address record, used in forward parsing zone)
——————————————————————————————————————————————————————
Building a single-zone DNS server
Ideas:
Establish the master configuration directory/etc/named.conf
Options {
Directory "/var/named";
};
Zone "anonymous.org" in{
Type master;
File "Anonymous.org.zone"; (Address library files)
};
~
Create address library file/var/named/anonymous.org.zone (enter address library file configuration)
$TTL 86400
@ in SOA @ 595.qq.com. (
201706291150; Serial
3H; Refresh
15M; Retry
1W; Expire
1D); minimum
@ NS DNS. Anonymous.org.
DNS A 192.168.4.30 (domain name, IP address)
www A 192.168.4.2
Hydra A 192.168.4.205
Start the named service, query the test
[Email protected] ~]# service named restart
[[Email protected] ~]# host Hydra. Anonymous.org (Visit Hydra)
Hydra. Anonymous.org has address 192.168.4.205
DNS Client
[[email protected] ~]# yum-y install bind-utils (Installation Test tool)
[[email protected] ~]# vim/etc/resolv.conf (config)
NameServer 192.168.4.30 (Specified DNS server)
——————————————————————————————————————
One DNS server supports multiple DNS zones at the same time, reverse query
[[email protected] ~]# vim/etc/named.conf (enter config file)
Options {
Directory "/var/named";
};
Zone "anonymous.org" in{
Type master;
File "Anonymous.org.zone";
};
Zone "hydra.com" in{(add a new address library file)
Type master;
File "Hydra.com.zone";
};
Zone "4.168.192.in-addr.arpa" in{(reverse region Lookup)
Type master;
File "192.168.4.arpa";
};
[[email protected] ~]# cd/var/named/(create Hydra.com.zone file in directory)
[[email protected] named]# vim hydra.com.zone (write config)
$TTL 1D
@ in SOA @ rname.invalid. (
0; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); minimum
@ NS dns.tedu.cn.
Hydra.com A 192.168.4.1
www A 192.168.4.254
XXX A 192.168.4.2
[Email protected] named]# vim 192.168.4.arpa
$TTL 1D
@ in SOA @ rname.invalid. (
0; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); minimum
@ NS dns.tedu.cn.
192.168.4.1 PTR hydra.tedu.cn (reverse query IP write front, domain name write back)
192.168.4.2 PTR xxx.tedu.cn
[[Email protected] named]# service named restart (restart services)
————————————————————————————————————————
DNS Special parsing records
DNS Polling (load balancing, one domain name, multiple IPs)
[[email protected] named]# vim tedu.cn.zone (change address library record)
$TTL 1D
@ in SOA @ rname.invalid. (
0; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); minimum
@ NS dns.tedu.cn.
DNS A 192.168.4.30
www A 192.168.4.254 (three server www response)
www A 192.168.4.110
www A 192.168.100
pc205 A 1.2.3.4
DNS Universal Domain Name resolution
Site names are regular (multiple domain names, multiple IPs)
[Email protected] named]# vim Tedu.cn.zone (forward address library)
......
$GENERATE 10-80 station$ A 192.168.4.$
[[email protected] named] #vim/var/named/192.168.4.arpa (reverse address library file)
...........
$GENERATE 10-80 $ PTR station$. tedu.cn.
Site name arbitrary (multiple domain names, one IP)
[Email protected] named]# vim Tedu.cn.zone
*a192.168.1.1
————————————————————————————————————————
Building Master-Slave DNS
Primary Domain Name server:
An official server for a specific DNS zone, unique
Responsible for maintaining all "domain name <--->ip addresses" in the area
[Email protected] named]# vim/etc/named.conf
Options {
Directory "/var/named";
Allow-transfer {192.168.4.205;}; (only 205 of this host can be from my address library)
};
Zone "anonymous.org" in{
Type master;
File "Anonymous.org.zone";
};
[Email protected] named]# vim Anonymous.org.zone
@ NS DNS. Anonymous.org.
@ NS Hydra. Anonymous.rog.
DNS A 192.168.4.30
www A 192.168.4.2
Hydra A 192.168.4.205
TTS9 A 118.45.29.31
* A 192.168.4.100
$GENERATE 10-80 station$ A 192.168.4.$
From a domain name server:
Also known as a secondary name server, you can not
The maintained domain name <--->IP address record depends on the primary domain name server
[[email protected] ~]# vim/etc/named.conf (enter from server configuration)
Options {
Directory "/var/named";
};
Zone "anonymous.org" in {
Type slave;
File "Slaves/anonymous.org.zone"; (Give permissions from server)
Masters {192.168.4.30;}; (Write the primary server address)
};
[Email protected] ~]# service named restart
Stop named:. Determine
Start named: [OK]
[[email protected] ~]# ls/var/named/slaves/(check will find automatically downloaded from the main server)
Anonymous.org.zone
——————————————————————————————————————
Linux Fundamentals 14