For details, see forward lookup
Juejin. Cn/post / 684490…
Forward lookup: Domain name to IP Address Reverse lookup: IP address to domain nameCopy the code
The reverse parsing structure is from the top-level domain ARPA, which is specifically used for reverse parsing, toinFor example, to reverse resolve 10.0.0.7, the domain is 10->0->0->7. The DNS of the host managing 7 is 0.0.10.in-addr.arpaCopy the code
1. Modify the configuration file
vim /etc/named.rfc1912.zones
zone "ARPA 0.0.10. The in - addr." IN {
type master;
file "10.0.0. Zone"; }; Write the domain file vim /var/named/10.0.0.zone$TTL1d@ IN SOA master.wyjn.icu.3555409634.qq.com. (202012091d 1H 1W 3H) NS master.wyjn.org.master.wyjn.icu.a 10.0.0.8 7 PTR www.wyjn.org. 8 PTR master.wyjn.org.The # PTR type stands for reverse parsing
3 PTR websrv.wyjn.org.
Cp -p named. Loopback 10.0.0.zone cp -p named. Loopback 10.0.0.zoneAnd then you can modify itCopy the code
2. Load the configuration file to test
[root@localhost named]# rndc reload
server reload successful
# test
[root@localhost named]# dig -t ptr 3.0.0.10.in-addr.arpa; < < > > DiG 9.11.4 - P2 - RedHat - 9.11.4-26. P2. El8 < < > > -t PTR 3.0.0.10. The in - addr. ARPA;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22106 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE: 96463b4ee726ee55e76c085b5e70fcbbe0a851b18ef77ee2 (good) ;; QUESTION SECTION: ; 3.0.0.10. The in - addr. ARPA. PTR; in; ANSWER SECTION: 3.0.0.10.in-addr.arpa.86400 in PTR websrv.wyjn.org.; ; AUTHORITY SECTION: 0.0.10.in-addr.arpa.86400 in NS master.wyjn.org.; Query time: 0 msec ;; SERVER: 10.0.0.8# 53 (10.0.0.8)
;; WHEN: Wed Mar 18 00:37:15 CST 2020
;; MSG SIZE rcvd: 128
[root@localhost named]# dig - 10.0.0.7 x; < < > > DiG 9.11.4 - P2 - RedHat - 9.11.4-26. P2. El8 < < > > - x 10.0.0.7;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22623 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE:fc2d79c78a9fd1126b0ab8995e70fd0fd8c9c15ca390d47f (good) ;; QUESTION SECTION: ; 7.0.0.10. The in - addr. ARPA. PTR; in; ANSWER SECTION: 7.0.0.10.in-addr.arpa.86400 in PTR www.wyjn.org.; ; AUTHORITY SECTION: 0.0.10.in-addr.arpa.86400 in NS master.wyjn.org.; Query time: 0 msec ;; SERVER: 10.0.0.8# 53 (10.0.0.8)
;; WHEN: Wed Mar 18 00:38:39 CST 2020
;; MSG SIZE rcvd: 125
Copy the code
3. The application of
# Reverse resolution is rarely used for DNS inside the enterprise
# Mainly used for spam detectionFor example, someone claims to have sent me an email from the smtp.qq.com email server and we reverse resolve its IP, if it matches the domain name then it's really from that server otherwise it's spam, reject it, disconnectCopy the code
4. The optimization
Similar to forward lookup DNS server optimization, mainly load balancingCopy the code