LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-10-2012, 08:24 AM   #1
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Unable to block three particular websites through /etc/hosts


http://www.dpreview.com/
http://www.kodakgallery.com/gallery/welcome.jsp
http://www.fotolia.com/

All sites specified excluding these three have
been blocked successfully.

How to block these three too now?
Is there some particular way to specify certain
website names?

/etc/hosts:
Code:
#                                                                                                                            
# hosts         This file describes a number of hostname-to-address                                                          
#               mappings for the TCP/IP subsystem.  It is mostly                                                             
#               used at boot time, when no name servers are running.                                                         
#               On small systems, this file can be used instead of a                                                         
#               "named" name server.                                                                                         
# Syntax:                                                                                                                    
#                                                                                                                            
# IP-Address  Full-Qualified-Hostname  Short-Hostname                                                                        
#                                                                                                                            

127.0.0.1       localhost

# special IPv6 addresses                                                                                                     
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts
127.0.0.2       linux-y3pi.site linux-y3pi
192.168.16.86   linux-y3pi.site linux-y3pi
127.0.0.1       1x.com
127.0.0.1       photo.stackexchange.com
127.0.0.1       dpreview.com
127.0.0.1       camshotsindia.com
127.0.0.1       500px.com
127.0.0.1       photo.net
127.0.0.1       fotolia.com
127.0.0.1       deviantart.com
127.0.0.1       kodakgallery.com
and yes, I did run /etc/init.d/nscd restart
after saving the hosts file. Didn't help.

Code:
# uname -a && cat /etc/issue
Linux linux-y3pi 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/Linux
Welcome to openSUSE 11.3 "Teal" - Kernel \r (\l).

Last edited by TheIndependentAquarius; 05-10-2012 at 08:31 AM.
 
Old 05-10-2012, 08:36 AM   #2
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,385

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
You have listed dpreview.com not www.dpreview.com
 
1 members found this post helpful.
Old 05-10-2012, 09:51 AM   #3
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Original Poster
Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
But then shouldn't that apply to all other websites too?
Why only dpreview?
 
Old 05-10-2012, 10:42 AM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Put both in and see if it works.

I guess dns cache deals might be in effect. Might have to restart browser to take effect changes.

Test with nslookup or dig too both www and without.
 
1 members found this post helpful.
Old 05-10-2012, 10:47 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
You're blocking a site that's even in your own signature? Oh the irony... do as I say, don#'t do as I do, huh?

The other "www" domains may well be listed in DNS as CNAME for the non-www version.

Last edited by acid_kewpie; 05-10-2012 at 10:49 AM.
 
1 members found this post helpful.
Old 05-11-2012, 12:23 AM   #6
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,672
Blog Entries: 29

Original Poster
Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Putting www. in front of dpreview helped.

I curious to know why was it needed for the
dpreview and not for 500px?


Quote:
Originally Posted by acid_kewpie View Post
You're blocking a site that's even in your own signature? Oh the irony... do as I say, don#'t do as I do, huh?
Am doing this on my own computer in office.
Problems of addictions.
 
Old 05-11-2012, 07:47 PM   #7
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,385

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
As stated above, most likely www.500px.com is a cname to 500px.com so your dnsclient looks up www.500px.com, is redirected to 500px.com which it looks up and finds a match in your /etc/hosts to 127.0.0.1 = effectively blocked.
If www.500px.com was an A record pointing to a valid IP you would also resolve that normally.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to block ALL websites except 2 glenn69 Linux - Networking 7 09-21-2015 07:25 AM
How to block websites? cusri2004 Linux - Newbie 1 12-26-2010 11:07 PM
Blocking websites via /etc/hosts Deewanagan Linux - Networking 15 12-13-2009 02:13 PM
How To Block Websites? Maybe /etc/hosts (.deny maybe) How? aaron4katie Linux - Security 7 01-08-2007 05:58 PM
how to block websites .. huno Linux - Software 5 04-22-2004 09:31 PM


All times are GMT -5. The time now is 07:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration