resolv.conf is used by Linux servers for specifying DNS servers used to domain name resolution.
Location of the file is
root@maps:~# cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 18.104.22.168 root@maps:~#
In above example, google public name servers 22.214.171.124 will be used for DNS resolution.
If you edit this file, it get reset every time your reboot.
Editing resolv.conf on CentOS
On CentOS/RHEL, you can directly edit /etc/resolv.conf, it won’t get overwritten
Editing resolv.conf on Ubuntu/Debian
If you need to set DNS resolver, you need to edit file
echo "nameserver 126.96.36.199" > /etc/resolvconf/resolv.conf.d/base