Find the answer to your Linux question:
Results 1 to 7 of 7
Hello guys, I have several computers at home and I was trying to block off some websites by using Code: nano /etc/hosts I tried to block one website and was ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,272

    How to block using /etc/hosts for home network


    Hello guys,

    I have several computers at home and I was trying to block off some websites by using

    Code:
    nano /etc/hosts
    I tried to block one website and was successful in doing so in my laptop. However, when I checked on our PC, the website can still be accessed.

    I thought that since we are sharing one router to access the web, we therefore share the same ip address. So what I block in my laptop is also blocked in our home network. Now I realize that I am wrong.

    Can somebody please be so kind to share how I may be able to do so? I mean to block websites without doing it one by one on all our PCs and lappys?

    Thank you very much!
    Last edited by nujinini; 12-06-2009 at 01:31 AM. Reason: grammar :(
    nujinini
    Linux User #489667

  2. #2
    Just Joined! claudiu's Avatar
    Join Date
    Dec 2009
    Location
    Bucharest, Romania
    Posts
    16
    What kind of router do you have?
    If you have a linux router then it's easy, use iptables, if you don't know how, here it is a example:
    iptables -A FORWARD -d IP_OF_WEB_SITE -j DROP

    This was not tested so I may be wrong.
    Another way is to install a proxy on your router and this way you will be able to block web sites from squid(if you will be using squid as a proxy).

  3. #3
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Each computer you want to protect must have the entry in
    its own hosts file. It does not block them from contacting
    you but blocks you from contacting them, by the bogus
    address you put in the hosts file, such as 127.0.0.1

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    most routers have the ability to block websites built in, you should just poke around the router configuration page, i'm sure its there

  5. #5
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,272
    Quote Originally Posted by rcgreen View Post
    It does not block them from contacting
    you but blocks you from contacting them, by the bogus
    address you put in the hosts file, such as 127.0.0.1
    This is interesting... Thanks
    nujinini
    Linux User #489667

  6. #6
    Linux Engineer nujinini's Avatar
    Join Date
    Apr 2009
    Posts
    1,272
    Quote Originally Posted by coopstah13 View Post
    most routers have the ability to block websites built in, you should just poke around the router configuration page, i'm sure its there
    Hi!

    May I please ask where can I find this "configuration page" please? I mean...is it in the manual that goes with the router when I got it? Or is it a web page? Thanks guys!
    nujinini
    Linux User #489667

  7. #7
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    it should be a web page, every router runs a webserver, i don't know what router you have so I can't tell you and i'm not about to go and look it up even if I did know, it should be like 192.168.0.1 or 192.168.1.1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •