Below command will keep your desire DNS server to be first address to use for a domain query resolver. To apply this command root user privilege is require. # sed -i '1i nameserver 8.8.8.8' /etc/resolv.conf
In the above example IP address 8.8.8.8 is a google public DNS IP address which can be use by anybody. The nameserver is an option in resolve.conf file to mention DNS server IP address which will resolve domain to IP address which was queried by application. To change the nameserver IP address either you can be a root user to run this command as follow. $ su - # sed -i '1i nameserver 8.8.8.8' /etc/resolv.conf
Or you can use sudo tool if you are added in a sudoers list or in group that is already in sudoers list. $ sudo sed -i '1i nameserver 8.8.8.8' /etc/resolv.conf
|