無法在 VirtualBox 中執行的 Fedora 中執行「yum update」

無法在 VirtualBox 中執行的 Fedora 中執行「yum update」

我剛剛在 VirtualBox 中全新安裝了 Fedora 20 作為虛擬機器。我將虛擬機器設定為使用 NAT 作為 VirtualBox 中網路配置的一部分。

起初我可以 ping 通 google.com,但無法使用 Firefox 瀏覽。當我嘗試執行時yum update出現以下錯誤:

Loaded plugins: langpacks, refresh-packagekit
Error: Cannot retrieve metalink for repository: fedora/20/x86_64. Please verify its path and try again

然後我在網路設定中停用了 IPv6,並且在 Firefox 中也停用了該選項。結果我可以使用 Firefox 瀏覽,但在執行yum update.

當我這樣做時,URLGRABBER_DEBUG=1 yum check-update我得到:

2013-12-20 11:33:35,612 attempt 1/10: https://mirrors.fedoraproject.org/metalink?repo=fedora-20&arch=x86_64
2013-12-20 11:33:35,612 opening local file "/var/cache/yum/x86_64/20/fedora/metalink.xml.tmp" with mode wb
* Adding handle: conn: 0x1c896d0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 9 (0x1c896d0) send_pipe: 1, recv_pipe: 0
* Could not resolve host: mirrors.fedoraproject.org
* Closing connection 9
2013-12-20 11:33:45,169 exception: [Errno 14] curl#6 - "Could not resolve host: mirrors.fedoraproject.org"
2013-12-20 11:33:45,169 retrycode (14) not in list [-1, 2, 4, 5, 6, 7], re-raising
Error: Cannot retrieve metalink for repository: fedora/20/x86_64. Please verify its path and try again

但是當我這樣做時ping mirrors.fedoraproject.org我得到:

ping mirrors.fedoraproject.org
PING wildcard.fedoraproject.org (209.132.181.16) 56(84) bytes of data.
64 bytes from wildcard.fedoraproject.org (209.132.181.16): icmp_seq=1 ttl=63 time=104 ms
64 bytes from wildcard.fedoraproject.org (209.132.181.16): icmp_seq=2 ttl=63 time=115 ms
64 bytes from wildcard.fedoraproject.org (209.132.181.16): icmp_seq=3 ttl=63 time=135 ms

的結果nslookup mirrors.fedoraproject.org是:

Server:     192.168.0.1
Address:    192.168.0.1#53

Non-authoritative answer:
mirrors.fedoraproject.org   canonical name = wildcard.fedoraproject.org.
Name:   wildcard.fedoraproject.org
Address: 209.132.181.16
Name:   wildcard.fedoraproject.org
Address: 67.203.2.67
Name:   wildcard.fedoraproject.org
Address: 213.175.193.206
Name:   wildcard.fedoraproject.org
Address: 140.211.169.197
Name:   wildcard.fedoraproject.org
Address: 152.19.134.146
Name:   wildcard.fedoraproject.org
Address: 80.239.156.215
Name:   wildcard.fedoraproject.org
Address: 66.35.62.166
Name:   wildcard.fedoraproject.org
Address: 66.135.62.201
Name:   wildcard.fedoraproject.org
Address: 85.236.55.6

我嘗試在 VirtualBox 中使用橋接適配器選項,但遇到了相同的錯誤。

我遵循了在NAT模式下啟用DNS代理的建議,但同樣的問題仍然存在(我仍然可以在Firefox中瀏覽,但yum無法解析主機mirrors.fedoraproject.org)。現在ifconfig命令顯示:

p2p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::a00:27ff:fea4:a4c6  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a4:a4:c6  txqueuelen 1000  (Ethernet)
        RX packets 723  bytes 695639 (679.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 628  bytes 77437 (75.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  base 0xd020 

顯示了這一點cat /etc/resolv.conf

nameserver 10.0.2.3

最後,我嘗試了“在NAT模式下使用主機的解析器作為DNS代理”,問題終於得到解決。

答案1

我遵循邁克爾提出的建議,使用以下兩個步驟:

NAT模式下啟用DNS代理

在 NAT 模式下使用主機的解析器作為 DNS 代理

現在我可以yum成功瀏覽和使用了。

相關內容