Wednesday, 2 November 2022

network ubuntu /etc/resolv.conf vs /etc/hosts

 https://serverfault.com/questions/118923/difference-between-etc-hosts-and-etc-resolv-conf

  • /etc/resolv.conf: Lists nameservers that are used by your host for DNS resolution. If you are using DHCP, this file is automatically populated with DNS record issued by DHCP server.
  • /etc/hosts/: It is just a static lookup method for resolution. (adds more custom dns to the /etc/resolv.conf, like 172.168.11.10 test.com)
  • /etc/nsswitch.conf: It defined order of resolution. Who should it consult first for resolution, a DNS or a host file? For example, if the file has following configuration hosts: files dns then /etc/hosts file will be checked first for resolution, if domain is still un-resolvable, DNS will then be consulted.

No comments:

Post a Comment