Friday, June 17, 2011

Transparent Squid Setup Firewall Script

#!/bin/bash

echo 1 > /proc/sys/net/ipv4/ip_forward

# Flush rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -s 10.10.10.0/255.255.255.0 -d 0.0.0.0/0.0.0.0 -j MASQUERADE

1 comment:

Squidblacklist said...

Great article! Only one problem, Free Blacklists Suck!


We specialize in serving intelligent network administrators high quality blacklists for effective, targeted inline web filtering.
There is a demand for a better blacklist. And with few alternatives available, we intend to fill that gap.

Signed,

Benjamin E. Nichols
http://www.squidblacklist.org