Hi to everybody,
after a few month of succesful work, i faced with problem:
1. AX86U fw
388.1
2. las dev wireguard
Problem:
...a few weeks ago I installed UPS on the whole house and now the blackouts are completely "invisible", but my ISP equipment loses power (on their side) for 1-2 minutes and reboots, thus temporarily losing connection with my router. After that, my rules for wg tunel stop to work ("unbound"s IP to wg11). Helps only wgmExpo "restart wg11" or full router reboot. (It doesn't matter if the dualWan is on or not), only "sh /jffs/addons/wireguard/Scripts/wg11-up.sh" doesn't work... in the same time peer wg11 in wg_manager shows that all as usual and should work.
nano /jffs/scripts/nat-start
Code:
#!/bin/sh
############################################################
# required for serialization when reentry is possible
LOCK="/tmp/$(basename $0).lock"
acquire_lock() { while ! mkdir $LOCK &>/dev/null; do sleep 2; done; }
release_lock() { rmdir $LOCK &>/dev/null; }
exit_0() { release_lock; exit 0; } # exit (any concurrent instance(s) may now run)
############################################################
acquire_lock # one instance at a time
logger -t $(basename $0) "Started"
##
## Put existing nat-start directives here
##
IPSET_LIST="unblockip" #List of ipsets to restore
DIR="/mnt/sd/entware/home" #directory for store ipset
MAX_TRIES=30 #Retries to find usb every second [MAX_TRIES] amount of times.
## Normally nothing need to be changed below ##
TRIES="0"
while [ "$TRIES" -lt "$MAX_TRIES" ]; do
if [ -d "$DIR" ]; then
for IPSET_NAME in $IPSET_LIST; do
if [ "$(ipset list -n "$IPSET_NAME" 2>/dev/null)" != "$IPSET_NAME" ]; then #if ipset does not already exist
if [ -s "$DIR/$IPSET_NAME" ]; then #if a backup file exists
ipset restore -! <"$DIR/$IPSET_NAME" #restore ipset
cru a "$IPSET_NAME" "0 2 * * * ipset save $IPSET_NAME > $DIR/$IPSET_NAME" >/dev/null 2>&1 # create cron job for autosave
logger -t $(basename $0) "IPSET restored: $IPSET_NAME"
fi
fi
done
break
else
sleep 1
TRIES=$((TRIES + 1))
if [ "$TRIES" -eq "$MAX_TRIES" ]; then
logger -t $(basename $0) "Warning: Failed to detect mounted USB-Drive within $MAX_TRIES seconds! IPSET not restored!"
fi
fi
done
############################################################
logger -t $(basename $0) "Completed [$@]"
exit_0
E:Option ==> peer wg11
Code:
Client Auto IP Endpoint DNS MTU Annotate
wg11 P X.X.X.X/24,X:X:X::X/64 X.X.X.X:63665 8.8.8.8,8.8.4.4 Auto # N/A
No RPDB Selective Routing/Passthru rules for 'client' Peer wg11
IPSet Enable Peer FWMark DST/SRC
unblockip Y wg11 0x1000 dst
WireGuard® ACTIVE Peer Status: Clients 1, Servers 1
nano /jffs/addons/wireguard/Scripts/wg11-up.sh
Code:
#!/bin/sh
iptables -t nat -I POSTROUTING -s 10.50.1.0/24 -o wg11 -j MASQUERADE -m comment --comment "WireGuard 'client wg21 to wg11'"
nano /jffs/addons/wireguard/Scripts/wg11-down.sh
Code:
#!/bin/sh
iptables -t nat -D POSTROUTING -s 10.50.1.0/24 -o wg11 -j MASQUERADE -m comment --comment "WireGuard 'client wg21 to wg11'"
Please advise how to proceed...