解決ubuntu突然無法聯網問題


一、問題描述

今天使用筆記本遠程辦公的時候,突然電腦無法聯網了,使用chrome瀏覽器訪問網頁出現如下錯誤

This site can’t be reachedwww.baidu.com’s server IP address could not be found.
Try:

Checking the proxy, firewall, and DNS configuration
DNS_PROBE_FINISHED_BAD_CONFIG

二、環境信息

筆記本的硬盤里安裝的是Ubuntu 21.04
使用無線WiFi鏈接網絡

三、定位問題

  1. 是不是WiFi的問題呢?

    將路由器的無線網絡信號分開為2G和5G的單獨頻段,分別單獨鏈接無法聯網;

    使用本地安裝的windows 10進行測試,可以正常聯網;

  2. 是不是Ubuntu本身出問題了?

    使用Ubuntu的recovery模式,嘗試修復網絡,還是無法正常聯網;

    使用Ubuntu U盤啟動盤,鏈接WiFi可以正常聯網;

  3. 是否可以ping通一些重要的ip?

光貓可以正常ping通
mango@mango-ubuntu:/etc$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=2.30 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=2.98 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=63 time=1.95 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=63 time=3.45 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=63 time=9.23 ms
^C
--- 192.168.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 1.950/3.981/9.229/2.675 ms

路由器可以正常ping通
mango@mango-ubuntu:/etc$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=2.30 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=2.98 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=63 time=1.95 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=63 time=3.45 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=63 time=9.23 ms
^C
--- 192.168.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 1.950/3.981/9.229/2.675 ms

google的DNS服務器可以ping通
mango@mango-ubuntu:/etc$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=110 time=373 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=110 time=397 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 2 received, 33.3333% packet loss, time 2000ms
rtt min/avg/max/mdev = 372.858/385.097/397.337/12.239 ms

百度無法ping通
mango@mango-ubuntu:/etc$ ping www.baidu.com
ping: www.baidu.com: Temporary failure in name resolution

通過以上分析可以知道是由於我筆記本發出的請求無法進行DNS的域名解析導致的。

四、解決方案

新建resolv.conf,並添加對應的DNS server即可

nameserver 114.114.114.114
nameserver 8.8.8.8
nameserver 192.168.1.1


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM