← ClaudeAtlas

dnslisted

DNS 配置与排查
ryukyagamilight/terminal-skills · ★ 1 · AI & Automation · score 75
Install: claude install-skill ryukyagamilight/terminal-skills
# DNS 配置与排查 ## 概述 DNS 配置、解析排查、BIND/CoreDNS 等技能。 ## DNS 查询工具 ### dig ```bash # 基础查询 dig example.com dig example.com A dig example.com AAAA dig example.com MX dig example.com NS dig example.com TXT dig example.com ANY # 简短输出 dig +short example.com # 指定 DNS 服务器 dig @8.8.8.8 example.com dig @1.1.1.1 example.com # 追踪解析过程 dig +trace example.com # 反向解析 dig -x 8.8.8.8 # 查询特定记录 dig example.com SOA dig example.com CNAME # 禁用递归 dig +norecurse example.com ``` ### nslookup ```bash # 基础查询 nslookup example.com nslookup example.com 8.8.8.8 # 查询特定类型 nslookup -type=mx example.com nslookup -type=ns example.com nslookup -type=txt example.com # 反向解析 nslookup 8.8.8.8 ``` ### host ```bash # 基础查询 host example.com host -t mx example.com host -t ns example.com # 反向解析 host 8.8.8.8 # 详细输出 host -v example.com ``` ## 本地 DNS 配置 ### /etc/resolv.conf ```bash # 查看配置 cat /etc/resolv.conf # 配置示例 nameserver 8.8.8.8 nameserver 8.8.4.4 search example.com options timeout:2 attempts:3 # 临时修改(可能被覆盖) echo "nameserver 8.8.8.8" > /etc/resolv.conf ``` ### /etc/hosts ```bash # 查看 cat /etc/hosts # 添加记录 echo "192.168.1.100 myserver.local" >> /etc/hosts # 格式 127.0.0.1 localhost 192.168.1.100 myserver myserver.local ``` ### systemd-resolved ```bash # 查看状态 systemd-resolve --status resolvectl status # 查询 resolvectl query example.com # 刷新缓存 systemd-resolve --flush-caches resolvectl flush-caches # 配置文件 /etc/systemd/resolved.conf ``` ## BIND DNS 服务器 ### 安装与管理 ```bash # 安装 apt install bind9 bind9