Linux Mint 18.1 Serena网络故障:可ping通8.8.8.8但无法访问google.com
Hey Elena, let's get that DNS resolution sorted out—since you can ping 8.8.8.8 but can't load google.com, the problem is definitely with how your system translates domain names into IP addresses. Let's walk through the steps to fix this:
1. Check Your Current DNS Configuration
First, let's see what DNS servers your system is using right now. Open a terminal and run:
cat /etc/resolv.conf
You'll probably notice this file is a symlink managed by resolvconf—that's why manually editing it didn't stick; resolvconf overwrites it automatically when network settings update.
2. Update resolvconf's Base Configuration
Instead of modifying /etc/resolv.conf directly, we'll edit the base file that resolvconf uses to build its active config:
- Open the base file with a text editor (like nano):
sudo nano /etc/resolvconf/resolv.conf.d/base - Add these lines to use Google's public DNS servers (or replace them with your router's DNS address if you prefer):
nameserver 8.8.8.8 nameserver 8.8.4.4 - Save and exit (for nano: press
Ctrl+O, hitEnter, thenCtrl+X). - Tell resolvconf to update the active DNS config:
sudo resolvconf -u
3. Make Sure Network Manager Isn't Overriding Settings
Network Manager can sometimes ignore resolvconf if it's set to auto-obtain DNS via DHCP. Let's adjust that:
- Click the Network Manager icon in your system tray, select your active connection (wired or WiFi), and choose "Edit Connections".
- Pick your connection from the list, click "Edit".
- Go to the IPv4 Settings tab.
- If the "Method" is set to "Automatic (DHCP)", switch it to "Automatic (DHCP) addresses only"—this lets your router assign an IP but uses the DNS servers we specified.
- Save the changes, then disconnect and reconnect your network to apply them.
4. Verify the Name Service Switch Config
Ensure your system prioritizes DNS for domain lookups:
- Open the nsswitch config file:
sudo nano /etc/nsswitch.conf - Find the line starting with
hosts:. It should includednslike this:hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 - If
dnsis missing, add it—this tells your system to check DNS after local files when resolving domains.
5. Test the Fix
After making these changes, test if domain resolution works by running:
nslookup google.com
Or try loading a website in your browser. If it still fails, restart Network Manager to apply all updates:
sudo systemctl restart network-manager
That should get your domain lookups working again!
内容的提问来源于stack exchange,提问作者Elena

