for some reason generate_random_ip4() inside of this script stales when you are connected to the VPN. i don't know why, maybe because is_ip4_lan_range_available $random_ip4 && break loops and can't find available ip address.
solution is to specify gateway manually:
sudo lnxrouter -g 10.0.0.1 --ap wlp1s0 <ssid> -p <password>