Ubuntu 20.04 /etc/network/interfaces 和 ifupdown 未連接到互聯網

Ubuntu 20.04 /etc/network/interfaces 和 ifupdown 未連接到互聯網

正如許多 AskUbuntu 論壇帖子中所述,我安裝了 ifupdown 並刪除/清除了 netplan.io。雖然現在從 /etc/network/interfacesifconfig產生ip a設定(從 2013 年左右的 Ubuntu 安裝複製而來,僅將檔案中的 eth0 更新為 enp4s0),但仍然沒有網路。不過,似乎確實存在一些連接,即它可以識別本地網路上的印表機。

ping google.com 

返回Temporary failure in name resolution。不過,ping 8.8.8.8效果很好。

系統:Ubuntu 20.04.3 LTS(Focal Fossa)

這裡可能發生了什麼事?

如果配置:

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.31  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a6ba:dbff:fe03:2e44  prefixlen 64  scopeid 0x20<link>
        inet6 2607:fea8:3e80:64a:a6ba:dbff:fe03:2e44  prefixlen 64  scopeid 0x0<global>
        ether a4:ba:db:03:2e:44  txqueuelen 1000  (Ethernet)
        RX packets 3128  bytes 483360 (483.3 KB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 482  bytes 84822 (84.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2836  bytes 217982 (217.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2836  bytes 217982 (217.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

答案1

/etc/resolv.conf 檔案設定不正確。只需從先前的 2013 Ubuntu 版本中複製 /etc/resolv.conf 檔案即可。即:

domain 'URL address'
search 'URL address'
nameserver 'IP address'
nameserver 'IP address'

相關內容