Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - thomas_4fdua8

#1
Hallo zusammen,

hier habe ein ähnliches Problem beobachtet (und gelöst): Ich betreibe OPNsense hinter einer FritzBox. Jedes mal, wenn sich die FritzBox nach der Zwangstrennung neu verbindet, bekommt sie einen neuen IPv6 Addressbereich, von dem OPNsense leider nichts mitbekommt.

Meine Lösung ist, die Gateways mit einem Cron-Script zu beobachten. Sobald WAN IPv4 up und WAN IPv6 down ist, wir einfach das WAN interface neu gestartet:


#!/bin/sh

##################################################
# This script checks if the WAN4 interface is up #
# and the WAN6 interface is down.                #
# In this case the WAN interface is restartet.   #
##################################################

# Put script in /usr/local/sbin/check_gatewayv6.sh
# Add action in /usr/local/opnsense/service/conf/actions.d/actions_check_gatewayv6.conf
# Add cron job under System -> Settings -> Cron

# Current time
curtime=$(date +%s)
# Bootime in seconds
uptime=$(sysctl kern.boottime | awk -F'sec = ' '{print $2}' | awk -F',' '{print $1}')
# Uptime in seconds
uptime=$(($curtime - $uptime))
# If uptime > 120 seconds:
if [ $uptime -gt 120 ]; then

        wan4status=$(pluginctl -r return_gateways_status | python3 -c 'import json, sys; print(json.loads(sys.stdin.read())["dpinger"]["WAN_DHCP"]["status"]);')
        #echo "WAN4 Status is: $wan4status"
        if [ "$wan4status" != "down" ]; then
                #echo "WAN4 is not down"
               
                wan6status=$(pluginctl -r return_gateways_status | python3 -c 'import json, sys; print(json.loads(sys.stdin.read())["dpinger"]["WAN_DHCP6"]["status"]);')
                #echo "WAN6 Status is: $wan6status"
                if [ "$wan6status" == "down" ]; then
                        #echo "WAN6 is down"
                       
                        /usr/local/etc/rc.configure_interface wan
                        sleep 2
                        /usr/local/sbin/pluginctl -s dpinger restart
                fi
        fi
fi


Bisher scheint alles wie gewünscht zu funktionieren.