1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00
openmptcprouter-feeds/luci-app-zerotier/root/etc/zerotier.stop
2023-07-24 15:26:29 +08:00

15 lines
494 B
Bash
Executable file

#!/bin/sh
zt0="$(ifconfig | grep 'zt' | awk '{print $1}')"
[ -z "${zt0}" ] && zt0="$(cat "/tmp/zt.nif")"
for i in ${zt0}
do
ip_segment=""
iptables -D FORWARD -i "$i" -j ACCEPT 2>/dev/null
iptables -D FORWARD -o "$i" -j ACCEPT 2>/dev/null
iptables -t nat -D POSTROUTING -o "$i" -j MASQUERADE 2>/dev/null
ip_segment="$(ip route | grep "dev $i proto" | awk '{print $1}')"
iptables -t nat -D POSTROUTING -s "${ip_segment}" -j MASQUERADE 2>/dev/null
echo "zt interface $i is stopped!"
done