Talk:Transparent web proxy
From DD-WRT Wiki
(Difference between revisions)
Revision as of 22:23, 28 December 2005 (edit) 72.56.40.206 (Talk) ← Previous diff |
Revision as of 22:24, 28 December 2005 (edit) (undo) 72.56.40.206 (Talk) Next diff → |
||
Line 1: | Line 1: | ||
- | Sure the script will not work with the PASTE EDITED SCRIPT HERE portion because of the double quotes.... | ||
- | The first lines would look like this: | ||
- | nvram rc_firewall=" | ||
- | #!/bin/sh | ||
- | INTERNAL_NETWORK="192.168.0.0/24" | ||
- | ROUTER_IP="192.168.0.1" | ||
- | .... | ||
- | " | ||
- | |||
- | which would read like: | ||
- | nvram rc_firewall="\n#!/bin/sh\nINTERNAL_NETWORK=" | ||
- | |||
- | Shouldn't the "'s be replaced with ' where possible? I submit that is should be: | ||
- | #!/bin/sh | ||
- | INTERNAL_NETWORK='192.168.0.0/24' | ||
- | ROUTER_IP='192.168.0.1' | ||
- | PROXY_SERVER='192.168.0.10' | ||
- | PROXY_PORT='3128' | ||
- | if [ -z $TRANSPARENT_PROXY ]; then | ||
- | /usr/sbin/iptables -t nat -A PREROUTING -i br0 -s $INTERNAL_NETWORK \ | ||
- | -d $INTERNAL_NETWORK -p tcp --dport 80 -j ACCEPT | ||
- | /usr/sbin/iptables -t nat -A PREROUTING -i br0 -s ! $PROXY_SERVER -p tcp --dport 80 \ | ||
- | -j DNAT --to $PROXY_SERVER:$PROXY_PORT | ||
- | /usr/sbin/iptables -t nat -A POSTROUTING -o br0 -s $INTERNAL_NETWORK -p tcp -d \ | ||
- | $PROXY_SERVER -j SNAT --to $ROUTER_IP | ||
- | /usr/sbin/iptables -t filter -I FORWARD -s $INTERNAL_NETWORK -d $PROXY_SERVER -i br0 \ | ||
- | -o br0 -p tcp --dport $PROXY_PORT -j ACCEPT | ||
- | export TRANSPARENT_PROXY=1 | ||
- | else | ||
- | echo 'This script has already run!' | ||
- | echo 'If it has not, unset \$TRANSPARENT_PROXY manually via the shell.' | ||
- | fi | ||
- | |||
- | |||
- | |||
- | -GIN |