Advertisement
Guest User

Untitled

a guest
May 18th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.36 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. iptables -I INPUT -p tcp --dport 21 -j ACCEPT
  4. iptables -I INPUT -p tcp --dport 8123 -i tun0 -j ACCEPT
  5. iptables -I INPUT -p tcp --dport 30089 -j ACCEPT
  6. iptables -I INPUT -p udp --dport 30089 -j ACCEPT
  7. iptables -I INPUT -p tcp --dport 9001 -j ACCEPT
  8. iptables -I INPUT -p tcp --dport 9030 -j ACCEPT
  9. iptables -I INPUT -p tcp --dport 9050 -i tun0 -j ACCEPT
  10. iptables -I INPUT -p tcp --dport 9091 -j ACCEPT
  11. iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
  12. iptables -I INPUT -i tun0 -j ACCEPT
  13.  
  14. killall -9 dhcp6c
  15.  
  16. # no ppp session
  17. if [ -z "`ip a | grep "ppp0"`" ]
  18. then
  19.     exit
  20. fi
  21.  
  22. # prevent parallel run
  23. NUMP=`ps | grep "[p]ost-firewall" | wc -l`
  24. if [ $NUMP -gt 2 ]
  25. then
  26.     exit
  27. fi
  28.  
  29. while true
  30. do
  31.     IP6=`ip a s ppp0 | grep "scope global dynamic" | sed 's#.*inet6 \(.*\)/64 scope.*#\1#'`
  32.     if [ -z "$IP6" ]
  33.     then
  34.         if [ "`ip a s ppp0 | grep "scope global dynamic" | sed 's#.*inet6 \(.*\)/128 scope.*#\1#'`" ]
  35.         then
  36.             exit
  37.         fi
  38.         sleep 5
  39.     else
  40.         PREFIX=`echo $IP6 | sed 's#\([0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*\):.*#\1#'`
  41.         ip -6 a f to 2a02:530::/32 dev br0
  42.         ip -6 a f to 2a02:530::/32 dev ppp0
  43.         ip a a $IP6/128 dev ppp0
  44.         ip r a $PREFIX::/64 dev br0 metric 1
  45.         ip a a $PREFIX::1/64 dev br0
  46.         killall -9 radvd
  47.         radvd
  48.         break
  49.     fi
  50. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement