2015-12-03 21:01:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Stop tunneldigger until bat0 is up
|
2015-12-06 20:41:30 +00:00
|
|
|
#/usr/sbin/service tunneldigger stop
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
# Set unreachable for table 200
|
2015-12-06 20:41:30 +00:00
|
|
|
#/bin/ip route add unreachable 0.0.0.0/0 table iffy
|
2015-12-03 21:01:23 +00:00
|
|
|
|
2015-12-06 20:41:30 +00:00
|
|
|
#while ! ping -c 1 -W 1 {{ sn_iffy_traffic }}; do
|
|
|
|
# echo "Waiting for {{ sn_iffy_traffic }} - network interface might be down..."
|
|
|
|
# sleep 5
|
|
|
|
#done
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Activate IP forwarding
|
|
|
|
/sbin/sysctl -w net.ipv6.conf.all.forwarding=1
|
|
|
|
/sbin/sysctl -w net.ipv4.ip_forward=1
|
2015-12-06 20:41:30 +00:00
|
|
|
/sbin/sysctl kernel.panic=10
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
# Routing table 200 for traffic above port 1023
|
2015-12-06 20:41:30 +00:00
|
|
|
#/bin/grep 200 /etc/iproute2/rt_tables || /bin/echo 200 iffy >> /etc/iproute2/rt_tables
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
# Set table for traffice with mark 4
|
2015-12-06 20:41:30 +00:00
|
|
|
#/bin/ip rule add fwmark 0x4 table iffy
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
# Set mark 4 to traffic above port 1023
|
2015-12-06 20:41:30 +00:00
|
|
|
#/sbin/iptables -t mangle -A PREROUTING -p tcp --dport 1024:65535 -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j MARK --set-mark 4
|
|
|
|
#/sbin/iptables -t mangle -A PREROUTING -p udp --dport 1024:65535 -s 10.0.0.0/8 ! -d 10.0.0.0/8 -j MARK --set-mark 4
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
# NAT on eth0
|
|
|
|
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
|
|
|
|
|
|
|
# Allow MAC address spoofing
|
|
|
|
/sbin/sysctl net.ipv4.conf.bat0.rp_filter=0
|
|
|
|
|
|
|
|
# Set gateway for table 200
|
2015-12-06 20:41:30 +00:00
|
|
|
#/bin/ip route replace default via {{ sn_iffy_traffic }} table iffy
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
# Start tunneldigger
|
2015-12-06 20:41:30 +00:00
|
|
|
#/usr/sbin/service tunneldigger start
|
2015-12-03 21:01:23 +00:00
|
|
|
|
|
|
|
exit 0
|