我最近收到了 CentOS 7 的映像,但在解析主机时遇到问题。我目前使用的是公司的VPN,公司的所有资源都可供我使用。
问题是:没有其他可用的。我一直在尝试访问 google.com 和 github.com 等网站,但遇到如下错误
unknown host google.com
如何配置解析器来解决此问题?
我的内容/etc/resolv.conf
:
# Generated by NetworkManager
search vbox
nameserver 10.3.1.1
nameserver 10.3.1.2
nameserver 172.23.28.7
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 172.23.28.8
的结果host google.com 8.8.8.8
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases:
google.com has address 216.58.208.142
google.com has IPv6 address 2a00:1450:4009:803::200e
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
的结果dig @8.8.8.8 google.com
; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.3 <<>> @8.8.8.8 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57064
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 299 IN A 216.58.208.174
;; Query time: 25 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Dec 02 11:13:43 GMT 2016
;; MSG SIZE rcvd: 55
答案1
到目前为止,我刚刚nameserver 8.8.8.8
在/etc/resolv.conf
所有其他名称服务器行之前添加了行,这解决了问题。不过,我仍然担心此更改会被 NetworkManager 覆盖