This guide will walk you through the process of setting a manual DNS server on Ubuntu. This method involves removing the etc/resolv.conf file (which is typically a symlink) and replacing it with a custom file.
resolv.conf FileFirst, you need to remove the existing resolv.conf file. Since this file is usually a symlink, you'll need to delete it to replace it with a static file.
sudo rm /etc/resolv.conf
resolv.conf FileNow, you'll create a new resolv.conf file with your specific DNS settings.
You can use the following script to create the new resolv.conf file with the specified content:
#!/bin/bash
# Create a new resolv.conf file with custom DNS settings
echo "nameserver 192.168.110.2
options edns0 trust-ad
search local" | sudo tee /etc/resolv.conf > /dev/null
# Set proper permissions
sudo chmod 644 /etc/resolv.conf
set_dns.sh.chmod +x set_dns.sh.sudo ./set_dns.sh.After running the script, you should verify that the resolv.conf file has been updated successfully.
cat /etc/resolv.conf
This command will display the contents of the new resolv.conf file, and you should see the DNS settings you specified.
You've successfully set a manual DNS server on your Ubuntu system. This method provides a static way to define DNS settings, bypassing automatic configuration. Always ensure that the DNS server you're pointing to is reliable and secure.