DNS 检测
NS 对应DNS服务器
SOA 授权哪个服务器可以作为dns服务器
MX mailexchange 邮件交换记录
A address
CNAME 别名
TXT
PTR 反向解析
/etc/hosts
先往根域查找,再往.com域查找, 客户端发起请求,递归
服务器之间是迭代
.根域
递归
迭代
dnsmasq 服务
tcp 不安全网址
udp
host ns.example.com
nsupdate
host ns.example.com 127.0.0.1
dnssec-keygen -a HMAC-MD5 -b 512 -n HOST -r /dev/urandom example.com
dns.message 定义对象
dns.query.tcp(qm,'8.8.8.8')
pip install dnspython
import dns.tsigkeyring up = dns.update.Update('example.com',keyring=key) rdata_list = [dns.rdata.from_text(dns.rdataclass.IN,dns.rdatatype.A,'192.168.20.20')] rdata_set = dns.rdataset(60,rdata_list) up.replace('s.db',rdata_set) dns.query.tcp(up,'127.0.0.1') import dns.query import dns.message import dns.tsigkeyring key = dns.tsigkeyring.from_text({'example.com':'dLEdguf7yRdCg5rGUpX6bIo9Pm+tcUdJ5gyesQl2UZbBCzhvcsJDCaTA mocTo0lv9D4YPXGPx+Yv6gIuCjcsRA=='}) import dns.update up = dns.update.Update('example.com',keyring=key) rdata_list = [dns.rdata.from_text(dns.rdataclass.IN,dns.rdatatype.A,'192.168.20.20')] rdata_set = dns.rdataset.from_rdata_list(60,rdata_list) up.replace('s.db',rdata_set) dns.query.tcp(up,'127.0.0.1') !host s.db.example.com 127.0.0.1