Time for action – adding DNS name servers
A list of IP addresses can be passed to this directive or several IP addresses can be written on different lines like the following:
dns_nameservers 192.0.2.25 198.51.100.25 dns_nameservers 203.0.113.25
The previous configuration lines will set the name servers to 192.0.2.25
, 198.51.100.25
, and 203.0.113.25
.
What just happened?
We added three DNS name servers to the Squid configuration file which will be used by Squid to resolve the domain names corresponding to the requests received from the clients.
Setting the hosts file
Squid can read the hostname and IP address associations from the hosts file generally found at /etc/hosts
. This file normally contains hostnames for the machines or servers in the local area network. We can specify the host's file location using the directive
hosts_file
as shown:
hosts_file /etc/hosts
If we don't want Squid to read the host's file, we can set the value to none
.
Default domain name for requests
Using the directive
append_domain...