Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- iptables -I INPUT -p tcp --dport 21 -j ACCEPT
- iptables -I INPUT -p tcp --dport 8123 -i tun0 -j ACCEPT
- iptables -I INPUT -p tcp --dport 30089 -j ACCEPT
- iptables -I INPUT -p udp --dport 30089 -j ACCEPT
- iptables -I INPUT -p tcp --dport 9001 -j ACCEPT
- iptables -I INPUT -p tcp --dport 9030 -j ACCEPT
- iptables -I INPUT -p tcp --dport 9050 -i tun0 -j ACCEPT
- iptables -I INPUT -p tcp --dport 9091 -j ACCEPT
- iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
- iptables -I INPUT -i tun0 -j ACCEPT
- killall -9 dhcp6c
- # no ppp session
- if [ -z "`ip a | grep "ppp0"`" ]
- then
- exit
- fi
- # prevent parallel run
- NUMP=`ps | grep "[p]ost-firewall" | wc -l`
- if [ $NUMP -gt 2 ]
- then
- exit
- fi
- while true
- do
- IP6=`ip a s ppp0 | grep "scope global dynamic" | sed 's#.*inet6 \(.*\)/64 scope.*#\1#'`
- if [ -z "$IP6" ]
- then
- if [ "`ip a s ppp0 | grep "scope global dynamic" | sed 's#.*inet6 \(.*\)/128 scope.*#\1#'`" ]
- then
- exit
- fi
- sleep 5
- else
- PREFIX=`echo $IP6 | sed 's#\([0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*\):.*#\1#'`
- ip -6 a f to 2a02:530::/32 dev br0
- ip -6 a f to 2a02:530::/32 dev ppp0
- ip a a $IP6/128 dev ppp0
- ip r a $PREFIX::/64 dev br0 metric 1
- ip a a $PREFIX::1/64 dev br0
- killall -9 radvd
- radvd
- break
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement