block the websites in your own pc

Status
Not open for further replies.

delta4

Right off the assembly line
This Is The Correct Way...end This Topic Now...

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
127.0.0.1 www.redif.com
 

mehulved

18 Till I Die............
Check the man page for hosts *unixhelp.ed.ac.uk/CGI/man-cgi?hosts
Though this one is for *nix, it should be similar windows too.
Host names may contain only alphanumeric
characters, minus signs ("-"), and periods ("."). They must begin with
an alphabetic character and end with an alphanumeric character.
Optional aliases provide for name changes, alternate spellings, shorter
hostnames, or generic hostnames (for example, localhost).
As far as my understanding goes, hosts are not determined by protocol eg. http as being used here. It will only contain the FQDN of the host.
fully qualified domain name (or FQDN) is an unambiguous domain name that specifies the node's position in the DNS tree hierarchy absolutely. To distinguish an FQDN from a regular domain name, a trailing period is added. ex: somehost.example.com. An FQDN differs from a regular domain name by its absoluteness; a suffix will not be added.
A FQDN is not the same as a Uniform Resource Locator (URL) as it lacks the protocol name to be used in communication with the host. A URL always starts with "<scheme>:", and so includes the communication protocol (like "http:", or "ftp:"), and includes information specific to the scheme, such as a directory path, a filename and a TCP port number.
Source: - *en.wikipedia.org/wiki/FQDN

Please check this out. And if I am right then the first post needs to be edited to remove the http part.
 

Pathik

Google Bot
^^ 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..
 
V

vaibhavtek

Guest
hey doesn't work...

I type:-

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost
127.0.0.1 hxxp://www.rediff.com

And when I enter www.rediff.com in my address bar and press enter it shows me rediff...

What is wrong..?????

Please reply.
 

mehulved

18 Till I Die............
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
Code:
hosts:  files dns
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).
 
V

vaibhavtek

Guest
hey why I am not able to block...??

Please look at my previous post..

Plzzzzz reply.
 

roxisayshi

Broken In
@vaibhavtek

Hey, it finally worked for me and can also work for you.
Just restart your browser for these changes to take effect.
That's it.
I was doing exactly what is mentioned in the very 1st post of this thread but did not able to block websites. Later on, I found that the changes will take effect only when the browser is closed and reopen again.

@batistabomb
Thanks
 
OP
Batistabomb

Batistabomb

Deadman Walking
Guys i thought you clearly restarts browser that's why i did not mentioned specially

Any how better restart your system instead of restarting the browser
 
Status
Not open for further replies.
Top Bottom