How to run xx.sh script on every WAN ipv6 address change for GL-X3000?

hi, @alzhao @bruce @yuxin.zou
i want to run .sh script on every WAN ipv6 address change for GL-X3000.

so, how to do this?
Thank you,

Maybe need to write another script to monitor ipv6 changes. I am not sure if there is simpler method.

something like this?

  • /etc/hotplug.d/iface/07-any-script
#!/bin/sh
[ "$ACTION" = "ifupdate" -a "$INTERFACE" = "rmnet_mhi0" ] && {
.
.
.
}

I am not sure if ipv6 change can be captured by this script.

Have to test.

okay. by running this command ip -6 addr show dev rmnet_mhi0 scope global
show 2 ipv6, so, which one is currently in use and that show as ipv6 on internet tab of GL UI?
how to identify active ipv6 address?

5: rmnet_mhi0: <NOARP,UP,LOWER_UP> mtu 1400 qdisc fq_codel state UP group default qlen 1000
    inet6 2409:xxxx:xxxx:913f:d596:xxxx:8604:5f04/64 scope global noprefixroute
       valid_lft forever preferred_lft forever
    inet6 2409:xxxx:xxxx:913f:4b85:xxxx:fc4d:eff2/64 scope global dynamic mngtmpaddr stable-privacy
       valid_lft forever preferred_lft forever

Can you compare?

I'd like to help but I don't have IPv6 now.

showing fc4d:eff2 on internet tab. but not sure how to identify correctly active ipv6..

i think this will work.

  • /etc/hotplug.d/iface/07-my-script
#!/bin/sh
#
# ACTIONS = connected, disconnected, ifup, ifdow, ifupdate
# Check if the action is "ifupdate" and the interface is "modem_0001_6"
[ "$ACTION" = "ifupdate" -a "$INTERFACE" = "modem_0001_6" ] && {
    # Run curl in the background without capturing any output
	$(/usr/bin/curl -s -o /dev/null -X POST "http://domain.com/test" > /dev/null 2>&1 &)
}
echo "OK"
exit 0
1 Like

Looks good. But have to test to confirm.

I tested it, and it's working while modem connected. I am 99.99% sure it will also work if the IPv6 address changes. My ISP might assign a new IP address in 5 to 10 days, so let's see what happens.

1 Like