I have to find a way to block porn sites on all browsers through something system-wide like iptables (just an idea)... Is there any way that I can do that.
7 Answers
You can also use the service openDNS, which limits the name resolution based on the pre-set filters. Compared to the solution proposed for the /etc/hosts file it allows you to not have to constantly update the list. Once you have set your own filters just use openDNS as name server. https://www.opendns.com/home-internet-security/
 
    
    - 2,027
There are several ways to do this
- Easiest, IMHO, is to use opendns
Opendns has been asked here:
Once it is configured you configure it here - https://www.opendns.com/welcome/
The advantage is that blacklists are then maintained by opendns.
- The second method is to install and configure a proxy server . You can do this with dansguardian, privoxy, or squid to name a few. You then configure iptables to route all traffic through the proxy or proxy chain.
http://blog.bodhizazen.com/linux/web-content-filtering-made-easy/
http://blog.bodhizazen.com/linux/how-to-transparent-proxy/
The disadvantage of this method is that you have to manually update and maintain the blacklist.
http://www.squidguard.org/blacklists.html or subscribe to a service.
- You can use iptables, but iptables is inefficient, and you again have to manually maintain a blacklist. 
- you can use a hosts file. You have to obtain and update the list yourself. 
http://winhelp2002.mvps.org/hosts.htm
The above link is more for adblock.
The "problem" is that these sites tend to change ip and host names ;)
 
    
    - 104,528
There's no such thing as "software that blocks porn" -- artifical intelligence is nowhere near up to the job. All you can get is software that blocks websites that someone has blacklisted -- they may be diligently identifying and blocking porn websites, in which case they'll block some (but far from all) porn, or they may be blacklisting their competitors' websites or sites that they object to ideologically.
 
    
    - 2,244
Various software like Net Nanny, etc. can be used. Alternatives of Net Nanny for linux users may be:
- Pluckeye: http://www.pluckeye.net/
- e2guardian: http://e2guardian.org/
- NxFilter :http://www.nxfilter.org/
Every tool and way fights only with the sites existing at the time of creation of that tool, which are already quite many (sadly). No software or black list can predict what is going to appear. So every tool will be a temporary remedy. It is impossible to solve such problems with software.
Find such a tool inside yourself and the people who use computer.
 
    
    - 5,677
Try adding an entry to the /etc/hosts file. Open up your terminal and type:
sudo -H gedit /etc/hosts
Add a line for every site you want to block, e.g.
127.0.0.1   www.example.com
Then save the file. You may need to restart in order for the changes to take effect.
Note: this will block access to the particular host from all software, not only the browsers.
You can do this easily by editing the file /etc/hosts. Simply add lines for sites you wish to block by referring the site to an IP address of 0.0.0.0, like this:
127.0.0.1   localhost
127.0.1.1   mycomputer
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
0.0.0.0 site.to.block.com
0.0.0.0 another.site.net
 
    
    - 61,330
 
     
     
     
     
    