How do you know whether your hosts or resolv.conf are configured correctly?
A useful command for this purpose is dig. It is a command to let you to specifically query a particular DNS server for specific information about a specific domain name.
This command can be used to check the validity of a DNS server to be entered into /etc/resolv.conf. To learn more about this command, use man dig.