Middlebox.sh


SUBMITTED BY: Guest

DATE: Aug. 26, 2014, 8:40 a.m.

FORMAT: Text only

SIZE: 525 Bytes

HITS: 1461

  1. #!/bin/sh
  2. # destinations you don't want routed through Tor
  3. NON_TOR="192.168.1.0/24"
  4. # Tor's TransPort
  5. TRANS_PORT="9040"
  6. # your internal interface
  7. INT_IF="vnet0"
  8. iptables -F
  9. iptables -t nat -F
  10. for NET in $NON_TOR; do
  11. iptables -t nat -A PREROUTING -i $INT_IF -d $NET -j RETURN
  12. done
  13. iptables -t nat -A PREROUTING -i $INT_IF -p udp --dport 53 -j REDIRECT --to-ports 53
  14. iptables -t nat -A PREROUTING -i $INT_IF -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT

comments powered by Disqus