sudo
05-22-2003, 09:30 PM
how to configure iptables so my proxy runs transparent?? both iptabels and squid are on same machine, squid is running perfect no probs...
eth0=10.0.0.20 gw:10.0.0.1 (my router)
eth1=192.168.1.1
the clients on the 192.168.1.0/24 net should be allowed access through the proxy server running on default port 3128.
how do i set up the script???
now it looks like this: (and doesnt work)
#!/bin/bash
iptables -F
iptables -t nat -F
iptables -P FORWARD DROP
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to 10.0.0.20
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -A FORWARD -i eth0 -p tcp -s 192.168.1.0/24 --sport 1024: --dport 80 -j ACCEPT
iptables -A FORWARD -i eth0 -p udp -s 192.168.1.0/24 --sport 1024: --dport 53 -j ACCEPT
iptables -A FORWARD -i eth1 -p tcp -d 192.168.1.0/24 --dport 1024: --sport 80 -j ACCEPT
iptables -A FORWARD -i eth1 -p udp -d 192.168.1.0/24 --dport 1024: --sport 53 -j ACCEPT
/etc/init.d/iptables save
if i remove the prerouting line and manualy writes the proxy settings in the browser it works fine!! what to do??? plz help me out here....
eth0=10.0.0.20 gw:10.0.0.1 (my router)
eth1=192.168.1.1
the clients on the 192.168.1.0/24 net should be allowed access through the proxy server running on default port 3128.
how do i set up the script???
now it looks like this: (and doesnt work)
#!/bin/bash
iptables -F
iptables -t nat -F
iptables -P FORWARD DROP
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to 10.0.0.20
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -A FORWARD -i eth0 -p tcp -s 192.168.1.0/24 --sport 1024: --dport 80 -j ACCEPT
iptables -A FORWARD -i eth0 -p udp -s 192.168.1.0/24 --sport 1024: --dport 53 -j ACCEPT
iptables -A FORWARD -i eth1 -p tcp -d 192.168.1.0/24 --dport 1024: --sport 80 -j ACCEPT
iptables -A FORWARD -i eth1 -p udp -d 192.168.1.0/24 --dport 1024: --sport 53 -j ACCEPT
/etc/init.d/iptables save
if i remove the prerouting line and manualy writes the proxy settings in the browser it works fine!! what to do??? plz help me out here....