mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
fix
This commit is contained in:
parent
903f8e19e7
commit
03e1981fe0
62 changed files with 1710 additions and 0 deletions
28
luci-app-zerotier/root/etc/zerotier.start
Executable file
28
luci-app-zerotier/root/etc/zerotier.start
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
zero_enable="$(uci get zerotier.sample_config.enabled)"
|
||||
|
||||
[ "${zero_enable}" -ne "1" ] && exit 0
|
||||
|
||||
[ -f "/tmp/zero.log" ] && {
|
||||
while [ "$(ifconfig | grep 'zt' | awk '{print $1}')" = "" ]
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
nat_enable="$(uci get zerotier.sample_config.nat)"
|
||||
zt0="$(ifconfig | grep 'zt' | awk '{print $1}')"
|
||||
echo "${zt0}" > "/tmp/zt.nif"
|
||||
|
||||
[ "${nat_enable}" -eq "1" ] && {
|
||||
for i in ${zt0}
|
||||
do
|
||||
ip_segment=""
|
||||
iptables -I FORWARD -i "$i" -j ACCEPT
|
||||
iptables -I FORWARD -o "$i" -j ACCEPT
|
||||
iptables -t nat -I POSTROUTING -o "$i" -j MASQUERADE
|
||||
ip_segment="$(ip route | grep "dev $i proto kernel" | awk '{print $1}')"
|
||||
iptables -t nat -I POSTROUTING -s "${ip_segment}" -j MASQUERADE
|
||||
done
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue