If you want to change the DNS Configuration in Linux or Ubuntu, then follow the below steps :
1.Login as root user .
then mention DNS server for exa :
3.Press Esc then type :wq to save the configuration.
4.to check the DNS , use : cat /etc/resolv.conf
then you’ll see the DNS server names.