DansGuardian is an open source web content filter which currently runs on Linux systems, including Ubuntu. It allows you to filter content on web pages based on phrases, text and URL. When configured correctly, it will block inappropriate content as well as content not suitable for children.
If you’re looking for a simple content filtering system in Ubuntu, then you may want to take a look at DansGuardian. In this tutorial, I’ll show you how to install and configure DansGuardian in Ubuntu.
Objectives:
- Install and configure DansGuardian in Ubuntu
- Enjoy!
To get started, press Ctrl – Alt – T on your keyboard to open Terminal. When it opens, run the commands below to install DansGuardian and Squid.
sudo apt-get install dansguardian squid
Next, run the commands below to open DansGuardian’s config file.
sudo gedit /etc/dansguardian/dansguardian.conf
Then find the highlighted line shown below and delete it. Or just comment it out by adding the ( # ) before the line. Save when done.
Next, run the commands below to open Squid config file
sudo gedit /etc/squid/squid.conf
Then find the line shown below and add the option ( transparent ). Save the file when done.
http_port 3128 transparent
Finally, open Firefox and click ‘Tool –> Preferences –> Advanced –> Network’ and choose Manual proxy configurations. Then add the IP address and port # shown.
127.0.0.1 8080
Restart your computer and test it.
Enjoy!
To start DansGuardian and Squid, run the commands below:
sudo service dansguardian startsudo service squid start



Great tutorial – thanks. A couple of things though – firstly a small typo (sudo dansquardian restart) and secondly that the iptables command is one time only and needs scripting for startup (which on 10.04 seems to be the tricky bit!)
great tutorial – i have just configured this on my friends icafe
i have a question regarding this,, since we edited the network connection in the browser, isnt it easy enough for the user to disable it? ….
not unless you have it installed in a ubuntu server right?( with 2 nics )
That's why you configure iptables to redirect all traffic through the proxy, so if someone changes the configuration settings in the browser, they will not be able to connect to anything except reconfigure proxy in the browser.
very nice!
i have a question: how can i use dansguardian to filter and control a windows machine?
dansgaurdian does not work on Windows machines. You probably want to read this post for Windows machines :http://www.liberiangeek.net/2010/03/protect-your-kids-online-with-k9-web-protection-for-free/
Hi
Great tutorial. I'd like to know if I can do this on Ubuntu server (old PC) for having a web filter in a little 10 PC company's lan…I want to block p2p, messengers, p0rn, MU, RS, etc.
Should I connect the ubuntu to dsl modem, and then make every pc browse through old pc? should I go through an additional guide for doing this? Thanks
It is possible but requires more work. I think this might be a good solution. http://www.liberiangeek.net/2010/04/how-to-setu…
This link also should help
http://www.liberiangeek.net/2010/04/opendns-the…
Thanks! will give a look
I'm having trouble. When I test it, it's not working. I had to replace 'sudo /etc/init.d/squid restart' with 'sudo service squid restart', but I don't believe that's the problem.
Any help?
Eric Nelson again. I had to reinstall Ubuntu (enough was going wrong, so I had to reinstall), so I tried again, and it worked.
Thanks for the excellent walkthrough!
For work on all PC in local network just run on clients:
sudo iptables -t nat -A OUTPUT -p tcp –dport 80 -j DNAT –to-destination 192.168.1.1:8080
wher 192.168.1.1 is serwer IP
for work after reboot add this line (without sudo) in file /etc/rc.local but bifore line: exit 0
hi…
i’m indonesian…
can any of you help me how to configure Dansguardian installed on UBUNTU 9.04 and mikrotik router OS running on Virtual box that installed in ubuntu 9.04 in one PC ? please help urgent thanks….