LinuxQuestions.org
Help answer threads with 0 replies.
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-11-2012, 12:34 AM   #1
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,679
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
How to block some parts of a website through /etc/hosts?


For example if a website has 10 sections,
I'd like to block 3 of them, only.

System admins here aren't willing to help in
this case. So, is there a way to do this through
/etc/hosts etc.?
 
Old 05-11-2012, 12:45 AM   #2
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
well, if that websites have different subdomain and different IP address for that domain, that you can make a wrong IP entry to those domain into /etc/hosts. that can work


for eg:

Code:
cat /etc/hosts

 127.0.0.1         www.google.com   
 127.0.0.1         www.facebook.com
 127.0.0.1         abc.test.com
so if browser query for dns name, it will get a loopback IP, and try to open it. hence websites will not open

Last edited by em31amit; 05-11-2012 at 12:51 AM.
 
Old 05-11-2012, 12:48 AM   #3
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,679
Blog Entries: 29

Original Poster
Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
For "example", LQ has sub forums, and if I'd like
to block 5 particular sub forums out of 10, then
what am I supposed to do?
 
Old 05-11-2012, 01:01 AM   #4
Slackyman
Member
 
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
You can't with /etc/hosts since it accepts only domains and ip addresses so you'll end up to block entire sites, not oly some pages.
For this purpose you use aproxy like squid and configure its policies.
 
1 members found this post helpful.
Old 05-11-2012, 01:02 AM   #5
em31amit
Member
 
Registered: Apr 2012
Location: /root
Distribution: Ubuntu, Redhat, Fedora, CentOS
Posts: 190

Rep: Reputation: 55
Code:
cat /etc/hosts

ACTUAL IP                 www.linuxquestions.org 
127.0.0.1                 iso.linuxquestions.org     #want to block so user can't download heavy iso files
127.0.0.1                 jobs.linuxquestions.org    #NO more job search here
 
1 members found this post helpful.
Old 05-11-2012, 01:05 AM   #6
Slackyman
Member
 
Registered: Mar 2011
Location: Rome - Italy
Distribution: Slackware 13.1
Posts: 347

Rep: Reputation: 44
If the url you want to block is an entire domain (even third level domain) it's ok and you can use /etc/hosts like you shown, but if you want to block a specific page or url like www.linuxquestions.org/reviews/ you have to find another way.
 
Old 05-11-2012, 01:09 AM   #7
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,679
Blog Entries: 29

Original Poster
Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
Quote:
Originally Posted by em31amit View Post
... iso.linuxquestions.org ... jobs.linuxquestions.org
Actually this worked, but I was talking about
sections like newbie, software, /General etc.

Quote:
Originally Posted by Slackyman View Post
You can't with /etc/hosts since it accepts only domains and ip addresses so you'll end up to block entire sites, not oly some pages.
For this purpose you use aproxy like squid and configure its policies.
Alright, will read upon those things.
Thanks.
 
Old 07-26-2012, 01:33 PM   #8
ukiuki
Senior Member
 
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Here you will find more info about how and why to block sites: http://pgl.yoyo.org/as/
I believe the 1st reason is the ads that come with most pages now days and it does require extra bandwidth to browse, it may effect more those who don't have fast connection, in any case to block ads is the one thing that concerns people more.
Personally I do hate ads, side, top, botton banners blinking only serve to distract. I do never ever click on them, so why not to block them.
Here my list of blocks:
Code:
127.0.0.1 doubleclick.net
127.0.0.1 ad.doubleclick.net
127.0.0.1 ad.ca.doubleclick.net
127.0.0.1 adremote.timeinc.net
127.0.0.1 adsremote.scripps.net
127.0.0.1 a.as-us.falkag.net
127.0.0.1 interclick.com
127.0.0.1 a1.interclick.com
127.0.0.1 media.fastclick.net
127.0.0.1 network.realmedia.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 ad.ad-flow.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 ad.bannerconnect.net
127.0.0.1 ww57.smartadserver.com
127.0.0.1 www3.smartadserver.com
127.0.0.1 partner.googleadservices.com
127.0.0.1 ad2.netshelter.net
127.0.0.1 a.collective-media.net
127.0.0.1 ad.103092804.com
127.0.0.1 ad.adperium.com
127.0.0.1 ad.yieldmanager.com
127.0.0.1 ads.youporn.com
127.0.0.1 partner.googleadservices.com
127.0.0.1 ads.justrelevant.com
127.0.0.1 ads.associatedcontent.com
127.0.0.1 ads.blogtalkradio.com
127.0.0.1 ads.fulldls.com
127.0.0.1 adserver.adreactor.com
127.0.0.1 adserver.zwame.pt
127.0.0.1 ads2.globo.com
127.0.0.1 adserv.legitreviews.com
127.0.0.1 adsrv.deviantart.com
127.0.0.1 ads.cnn.com
127.0.0.1 ad.zanox.com
127.0.0.1 ad.kickasstorrents.com
127.0.0.1 at-adserver.alltop.com
127.0.0.1 ads.trackitdown.net
127.0.0.1 cdn1.ads.contentabc.com
127.0.0.1 ads.crakmedia.com
127.0.0.1 data.ero-advertising.com
127.0.0.1 ads.trafficjunky.net
127.0.0.1 media.trafficjunky.net
127.0.0.1 media.adxpansion.com
127.0.0.1 a.tribalfusion.com
127.0.0.1 cs.adxpansion.com
127.0.0.1 ifa.camads.net
127.0.0.1 clickserv2.sitescout.com
127.0.0.1 infinityads.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 ads.ad4game.com
127.0.0.1 ads.adk2.com
127.0.0.1 ads.dothads.com
127.0.0.1 ads.e-planning.net
127.0.0.1 ads.pixfuture.net
127.0.0.1 ads.pubmatic.com
127.0.0.1 ads.supplyframe.com
127.0.0.1 ads.undertone.com
127.0.0.1 adsearch.adkontekst.pl
127.0.0.1 ads.cpxcenter.com
127.0.0.1 ads.lzjl.com
127.0.0.1 ads.pointroll.com
127.0.0.1 adserver.adtechus.com
127.0.0.1 adshuffle.com
127.0.0.1 adsrvr.org
127.0.0.1 adtech.de
127.0.0.1 advertising.com
127.0.0.1 adxpose.com
127.0.0.1 ero-advertising.com
127.0.0.1 d.adsbyisocket.com
127.0.0.1 ad.adserver01.de
127.0.0.1 ib.adnxs.com
127.0.0.1 d.afdads.com
127.0.0.1 click.adbrite.com
127.0.0.1 this.content.served.by.adshuffle.com
127.0.0.1 br.betclic.com
127.0.0.1 ib.adnxs.com
127.0.0.1 v2.afilio.com.br
127.0.0.1 pixel.mathtag.com
127.0.0.1 stats.sellbuyads.com
127.0.0.1 stats.buysellads.com
127.0.0.1 s3.buysellads.com
127.0.0.1 dspads.sitescout.netdna-cdn.com
Regards
 
  


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
Why can't I use /etc/hosts.deny to block a website? CJS Linux - Networking 8 08-29-2008 11:39 AM
in house website with virtual hosts. peonuser Linux - Enterprise 7 04-21-2008 07:31 AM
Who hosts your website ? coolb General 21 08-16-2007 12:29 PM
block ip address/hosts sohmc Linux - Security 3 09-19-2004 11:13 AM
Iptables to block everything except few hosts sysadmcse Linux - Security 1 09-16-2003 09:48 PM


All times are GMT -5. The time now is 09:45 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