在 Ubuntu 上“检测域名”通常指检查域名是否可达、解析是否正常、DNS 是否生效、证书是否有效等。下面按常见场景给你一套实用方法。
nslookupnslookup example.com
✅ 正常示例:
Name: example.com
Address: 93.184.216.34
❌ 如果提示 NXDOMAIN 或 no answer,说明 DNS 解析有问题。
dig(推荐)dig example.com
重点看:
ANSWER SECTION:是否有 IPQUERY TIME:解析速度SERVER:使用的 DNS 服务器只查看 IP:
dig +short example.com
hosthost example.com
ping 检测ping example.com
✅ 能 ping 通说明:
⚠️ 注意:
curl 检测curl -I https://example.com
看返回状态码:
200 OK ✅301 / 302 重定向403 被拒绝404 不存在500 服务器错误查看详细过程:
curl -v https://example.com
wget 检测wget --spider https://example.com
openssl s_client -connect example.com:443
只看证书信息:
openssl s_client -connect example.com:443 | openssl x509 -noout -text
或使用:
curl -vI https://example.com
systemd-resolve --status
或:
cat /etc/resolv.conf
dig @8.8.8.8 example.com
dig @114.114.114.114 example.com
判断是否 DNS 缓存问题。
dig example.com
curl -I https://example.com
cat /etc/resolv.conf
openssl s_client -connect example.com:443
whois example.com
如果你能具体说明:
我可以直接给你针对性排查方案。