如何获取用户DNS IP记录笔记
1.找一台开放53端口的vps
2.安装bind9软件
3.增加日志规则
options { directory "/var/cache/bind"; // If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113 // If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders. // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. // forwarders { // 0.0.0.0; // }; //======================================================================== // If BIND logs error messages about the root key being expired, // you will need to update your keys. See https://www.isc.org/bind-keys //======================================================================== dnssec-validation auto; auth-nxdomain no; # conform to RFC1035 //listen-v6 { any; }; }; logging { channel query_log { file "query.log" versions 3 size 20m; severity info; print-time yes; print-category yes; }; category queries { query_log; }; };
4.把域名二级域名或者顶级域名析到一个IP
5.然后访问域名,bind9生成查询日志
6.去 bind9所设置的directory目录下找到域名解析的log日志文件
例如:/var/cache/bind/query.log
7.查询所访问的域名的日志和所请求的IP例如:
- 27-Oct-2021 12:22:03.855 queries: client 59.297.249.148#54691 (xxxx.admin.com): query: xxxx.admin.com IN A -EDC (10.1.1.4)
其中59.297.249.148为用户的DNS,xxxx.admin.com为用户所访问的域名