暂停后 DNS 不工作(19.04)

暂停后 DNS 不工作(19.04)

关闭并重新打开笔记本电脑盖后,我的系统从挂起状态唤醒,连接到 wifi 后,我可以 ping 到 8.8.8.8,但无法 ping 到 google.com,并且显示错误名称解析暂时失败

为了解决这个问题,我需要重新启动系统,但是当我尝试重新启动甚至关闭电源时,我的系统会进入黑屏并带有闪烁的光标。

为了找出系统无法重新启动的原因,我删除了安静的飞溅从 grub 配置中看到重启时的错误无法卸载所有文件系统如图所示 屏幕快照

输出sudo lshw-类网络

*-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: eno1
       version: 15
       serial: ec:8e:b5:a2:8d:39
       size: 10Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 duplex=half firmware=rtl8168h-2_0.0.2 02/26/15 latency=0 link=no multicast=yes port=MII speed=10Mbit/s
       resources: irq:32 ioport:2000(size=256) memory:f1004000-f1004fff memory:f1000000-f1003fff
  *-network
       description: Wireless interface
       product: BCM43142 802.11b/g/n
       vendor: Broadcom Inc. and subsidiaries
       physical id: 0
       bus info: pci@0000:05:00.0
       logical name: wlp5s0
       version: 01
       serial: 44:1c:a8:a9:86:43
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=wl0 driverversion=6.30.223.271 (r587334) ip=192.168.1.201 latency=0 multicast=yes wireless=IEEE 802.11
       resources: irq:36 memory:f0300000-f0307fff

答案1

在终端中运行 sudo nano /etc/resolv.conf。将 IP 地址更改nameserver8.8.8.8另一个 DNS 服务器地址。如果您想在一个命令中更改 DNS,请尝试此命令

echo "nameserver 8.8.8.8">>resolv.conf

echo "sudo cp resolv.conf /etc/">>dns.sh.

您已创建 dns.sh。您可以运行它dns.sh./dns.sh轻松更改 dns。

相关内容