🤖 Ai回答: DNS (Domain Name System) is crucial for the internet as it translates human-readable domain names into IP addresses that computers can understand and use to communicate with each other.
In Ubuntu, you typically don't need to manually configure DNS settings because your system uses NetworkManager or another network manager by default which handles this automatically based on information provided in `/etc/resolv.conf`.
However, if there's an issue where your machine isn’t resolving domains correctly despite having proper networking setup:
1、Check /etc/hosts: Ensure no conflicting entries exist.
2、Verify resolvconf configuration:
bash
sudo cat /etc/resolv.conf Check contents of resolver file directly managed via resolvconf package
OR
sudo dpkg-reconfigure frontend=noninteractive dnsutils Reconfigures all related packages including resolvconf
3、Network Manager Configuration:
If using `nmcli` command-line tool,
sh
sudo nmcli con show | grep -i ip4.dns List current IPv4 DNS servers used by any active connection
To modify these values temporarily during troubleshooting,
For single entry modification within one specific interface:
sudo nmcli c mod <connection-name ipv4.dns 8.8.8.8
Replace `<connection-name` above with actual name returned from previous step.
For permanent changes across multiple connections:
This will add Google’s public DNS server at address *8\.8\.8\.8* but remember to replace according to preference like Cloudflare etc., depending upon requirement.
Remember always test connectivity after making such modifications before committing them permanently!