Linux中查看和设置DNS服务器
·
查看dns服务器
方法一:cat /etc/resolv.conf
[root@6000m ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 172.16.1.1
nameserver 192.168.171.2
方法二:nslookup命令
[root@6000m ~]# nslookup www.baidu.com
Server: 172.16.1.1 //dns服务器IP地址
Address: 172.16.1.1#53 //dns服务器IP地址
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 61.135.169.121 //百度服务器IP
Name: www.a.shifen.com
Address: 61.135.169.125 //百度服务器IP
方法三:dig命令
[root@6000m ~]# dig | grep SERVER
;; SERVER: 172.16.1.1#53(172.16.1.1)
修改DNS服务器
修改配置文件/etc/resolv.conf,修改完以后可以直接生效
[root@6000m ~]# vim /etc/resolv.conf
# Generated by NetworkManager
search localdomain
nameserver 8.8.8.8
nameserver 114.114.114.114
通过nslookup查看
[root@6000m ~]# nslookup www.baidu.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
www.a.shifen.com canonical name = www.wshifen.com.
Name: www.wshifen.com
Address: 103.235.46.39
更多推荐
已为社区贡献4条内容
所有评论(0)