mirror of
https://github.com/Ysurac/openmptcprouter-vps.git
synced 2025-03-09 15:50:00 +00:00
Server scripts update
This commit is contained in:
parent
e87ff9af8e
commit
5cf11f2650
14 changed files with 104 additions and 42 deletions
29
omr-service
29
omr-service
|
@ -30,7 +30,10 @@ _glorytun_tcp() {
|
|||
[ "$(echo $intf | grep key)" = "" ] && /etc/glorytun-tcp/post.sh ${intf}
|
||||
done
|
||||
if [ -f /etc/openmptcprouter-vps-admin/current-vpn ] && [ "$(cat /etc/openmptcprouter-vps-admin/current-vpn)" = "glorytun_tcp" ]; then
|
||||
if [ "$(ping -c 5 -w 5 10.255.255.2 | grep '100%')" != "" ] && [ "$(expr $(date +%s) - $(stat -c %Y /proc/$(pgrep glorytun-tcp)/exe ))" -gt "300" ]; then
|
||||
localip="$(cat /etc/glorytun-tcp/tun0 | grep LOCALIP | cut -d '=' -f2)"
|
||||
[ -z "$localip" ] && localip="10.255.255.1"
|
||||
remoteip="$(echo $localip | sed 's/\.1/\.2/')"
|
||||
if [ "$(ping -c 5 -w 5 $remoteip | grep '100%')" != "" ] && [ "$(expr $(date +%s) - $(stat -c %Y /proc/$(pgrep glorytun-tcp)/exe ))" -gt "300" ]; then
|
||||
logger -t "OMR-Service" "No answer from VPN client end, restart Glorytun-TCP"
|
||||
systemctl restart glorytun-tcp@tun0
|
||||
fi
|
||||
|
@ -66,9 +69,9 @@ _gre_tunnels() {
|
|||
iface="$(basename $intf)"
|
||||
if [ "$(ip tunnel show $iface 2>/dev/null | awk '{print $4}')" != "$OMR_ADDR" ]; then
|
||||
ip tunnel del $iface 2>&1 >/dev/null
|
||||
ip tunnel add $iface mode gre local $INTFADDR remote $OMR_ADDR
|
||||
ip link set $iface up
|
||||
ip addr add $LOCALIP dev $iface
|
||||
ip tunnel add $iface mode gre local $INTFADDR remote $OMR_ADDR 2>&1 >/dev/null
|
||||
ip link set $iface up 2>&1 >/dev/null
|
||||
ip addr add $LOCALIP dev $iface 2>&1 >/dev/null
|
||||
ip route add $NETWORK dev $iface 2>&1 >/dev/null
|
||||
fi
|
||||
fi
|
||||
|
@ -77,23 +80,23 @@ _gre_tunnels() {
|
|||
|
||||
_openvpn_bonding() {
|
||||
if [ "$(ip link show ovpnbonding1)" != "" ] && ([ "$(ip link show ovpnbonding1 | grep SLAVE)" = "" ] || [ "$(ip link show omr-bonding | grep DOWN)" != "" ] || [ "$(ip link show | grep ovpnbonding | grep -c SLAVE | tr -d '\n')" != "8" ]); then
|
||||
echo 0 > /sys/class/net/omr-bonding/bonding/mode
|
||||
echo 0 > /sys/class/net/omr-bonding/bonding/mode 2>&1 >/dev/null
|
||||
ip link set ovpnbonding1 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding1 up
|
||||
ip link set ovpnbonding1 up 2>&1 >/dev/null
|
||||
ip link set ovpnbonding2 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding2 up
|
||||
ip link set ovpnbonding2 up 2>&1 >/dev/null
|
||||
ip link set ovpnbonding3 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding3 up
|
||||
ip link set ovpnbonding3 up 2>&1 >/dev/null
|
||||
ip link set ovpnbonding4 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding4 up
|
||||
ip link set ovpnbonding4 up 2>&1 >/dev/null
|
||||
ip link set ovpnbonding5 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding5 up
|
||||
ip link set ovpnbonding5 up 2>&1 >/dev/null
|
||||
ip link set ovpnbonding6 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding6 up
|
||||
ip link set ovpnbonding6 up 2>&1 >/dev/null
|
||||
ip link set ovpnbonding7 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding7 up
|
||||
ip link set ovpnbonding7 up 2>&1 >/dev/null
|
||||
ip link set ovpnbonding8 master omr-bonding 2>&1 >/dev/null
|
||||
ip link set ovpnbonding8 up
|
||||
ip link set ovpnbonding8 up 2>&1 >/dev/null
|
||||
ip link set omr-bonding up mtu 1440 2>&1 >/dev/null
|
||||
ip a add 10.255.248.1 dev omr-bonding 2>&1 >/dev/null
|
||||
ip r add 10.255.248.0/24 dev omr-bonding 2>&1 >/dev/null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue