pathiks said:
^^ isnt it that wen u use the url, u r being more specific..
if u use the fqdn it blocks all the connections to that domain name be it http or ftp..
Nope. hostname doesn't have a protocol cos one host can serve many different services. I can run ftp, http, samba, dns and a hell lot more on my PC, while keeping one hostname.
The idea behind the hostname file is to uniquely identify the client within the domain and fqdn is to gather all hosts within one domain.
It wouldn't be uncommon to find, within a domain, one host running firewall and NAT, another running proxy and LDAP, another serving DNS, a couple of hosts running http, ftp, db servers.
fqdn is different from url as said in that wikipedia article.
Your domain *www.foo.bar may lead to the host loo.foo.bar where loo is a host within the domain foo.bar. Instead it could even be loo.abc.xyz. fqdn needn't be the same as the url. If the internal DNS is set up fine that it will all be routed properly within the internal network.
Now how does this matter?
By default, on whatever OS's I have used, hosts are read from local files first. On linux my hosts line in /etc/nsswitch.conf file look like this
So, firstly a host name will be checked up on local host file, which happens to be /etc/hosts. If it's not found it will fall back on the DNS server.
So, now when you will look up for a host name, irrespective of the protocol used - be it http, ftp, rsync, ldap whatever, first the /etc/hosts file will be looked up. Since, your
blocked host points to localhost it will try to connect the service on your own PC. And if it doesn't find any server running on that port it will give an error. If it finds any server running on your PC for the server, it will connect to it.
So, after blocking this if you run an apache server it will connect to your own PC on port 80.
But, if you specify *abc.xyz it becomes an invalid fqdn(see the wikipedia entry in my previous post).