无法连接到网络

无法连接到网络

由于某种原因,我无法访问除我的网络上托管的本地站点之外的任何内容 - 我确实连接到了路由器,但 WiFi 图标显示为?而不是显示信号强度。

除此之外,我无法从不在我的网络上的任何站点获取数据 - DNS 检查失败。

我已确认这不是路由器无线连接的问题,因为通过以太网连接不起作用,使用手机的 USB 网络共享和常规移动热点也不起作用。我网络上的所有其他设备都可以与路由器完美配合。

我的机器无法访问互联网还有其他原因吗?或者我是否必须重新安装操作系统并希望将来不会发生这种情况?

dig输出:

$ dig example.com
;; communications error to ::1#53: connection refused
;; communications error to ::1#53: connection refused
;; communications error to ::1#53: connection refused
;; communications error to 127.0.0.1#53: connection refused

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> example.com
;; global options: +cmd
;; no servers could be reached

$ dig @8.8.8.8 example.com

; <<>> DiG 9.18.18-0ubuntu0.22.04.1-Ubuntu <<>> @8.8.8.8 example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY; status: NO ERROR, id: 48924
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;example.com.             IN        A

;; ANSWER SECTION:
example.com.        15478 IN        A      93.184.216.34

;; Query time: 111 msec
;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP)
;; WHEN: Tue Feb 20 18:47:38 GMT 2024
;; MSG SIZE  rcvd: 56

答案1

您的/etc/resolv.conf坏了。它不应该连接到127.0.0.1#53,而应该连接到127.0.0.53#53。让我们修复它:

  1. sudo systemctl enable systemd-resolved
  2. sudo systemctl start systemd-resolved
  3. sudo unlink /etc/resolv.conf
  4. sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
  5. 验证它是否包含“nameserver 127.0.0.53”。如果没有,请重新启动以重新生成它

相关内容