Dell Inspiron 3567(Ubuntu16.04)连WiFi能ping但无法上网求解
Hey there, let's work through this odd problem you're facing—being able to ping Google's servers and domain but having no luck with apt-get update or browsers. This usually points to issues with proxy settings, DNS caching, or application-specific network configurations. Here are the steps to troubleshoot:
1. Check System-Wide Proxy Settings
First, make sure your system isn't stuck with an incorrect proxy configuration, which can block both browsers and APT:
- Graphical Interface: Go to System Settings > Network > Network Proxy. Set it to "None" if you aren't using a proxy, or verify the proxy details if you are.
- Command Line: Check for proxy environment variables with:
If you see unexpected values, clear them with:echo $http_proxy $https_proxy
Then try runningunset http_proxy https_proxysudo apt-get updateagain to test.
2. Reset DNS Cache & Network Manager
Even though you can resolve domains, a corrupted DNS cache might interfere with application-level requests:
- Restart Network Manager to refresh network configurations:
sudo service network-manager restart - Flush DNS cache (Ubuntu 16.04 uses
dnsmasqby default):sudo /etc/init.d/dns-clean restart sudo systemctl restart dnsmasq
3. Verify APT Proxy Configuration
APT might have its own proxy settings that override system defaults. Check these files:
- Open
/etc/apt/apt.confwith a text editor (e.g.,sudo nano /etc/apt/apt.conf) and look for lines like:
Delete or comment out these lines (add aAcquire::http::Proxy "http://proxy.example.com:8080/";#at the start) if you don't need a proxy. - Also check files in
/etc/apt/apt.conf.d/—any file with "proxy" in the name might contain similar settings.
4. Check Browser Proxy Settings
Browsers sometimes use their own proxy configs, even if system settings are correct:
- For Chrome/Firefox: Go to the browser's settings, search for "proxy", and ensure it's set to "Use system proxy settings" or "No proxy" (whichever applies to your network).
- Avoid manual proxy entries unless you're certain they're correct.
5. Verify Firewall Rules
The default UFW firewall might be blocking HTTP/HTTPS traffic by mistake:
- Check current firewall status:
sudo ufw status - If you see rules denying 80/tcp (HTTP) or 443/tcp (HTTPS), allow them:
sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw reload
6. Adjust MTU Value
A mismatched MTU (Maximum Transmission Unit) can cause large packets to fail, even if ping works:
- Check your WiFi interface's current MTU (replace
wlan0with your actual interface name fromip link show):ip link show wlan0 - Try lowering the MTU to 1400:
Testsudo ip link set wlan0 mtu 1400apt-get updateand your browser after this change.
7. Reset Network Manager Configuration
If all else fails, reset Network Manager to default settings:
sudo service network-manager stop sudo rm /var/lib/NetworkManager/NetworkManager.state sudo service network-manager start
Then reconnect your WiFi network and test again.
内容的提问来源于stack exchange,提问作者RAMESH Pqr

