Tuntenfisch
New Around Here
Hello,
I have a GT-BE98 running the "GT-BE98_3006_102.1_1-gnuton0_beta1_nand_squashfs.pkgtb" firmware found here. The router is connected via its WAN 10G port to a network socket inside a university campus. In order to gain access to the university campus network (and internet), I have set up a VPN client (client 1 to be specific) through the router's web interface and I've configured the router to route all internet traffic through the VPN. One issue I've encountered is that the VPN won't restart when the router restarts. But I was able to resolve this issue by creating a watchdog script under
Contents of
Contents of
The watchdog successfully ensures that the VPN is up reliably.
Besides the VPN, I've also configured a DDNS service. Initially I've attempted to get the asuscomm.com DDNS running since the setup is easy. But it doesn't work in conjunction with a VPN because the router still has a private IP and the builtin functionality isn't smart enough to rely on the VPN to update the DDNS. I then saw that you can also opt for a custom DDNS update and specifically this section of the wiki in conjunction with the ASUS sample script got me this script:
Contents of
Note the deviations from the original scripts in the first if condition, and the different IP being used. Anyways, this script results in a HTTP response of 200, so everything should be good? Wrong! For some reason the DDNS update works but when actually attempting to ping the supposedly updated domain, I get no reply. I also cannot SSH into the router via the domain, or access the web interface. I did make sure to enable the relevant settings in the router's web interface, e.g. "Enable Web Access from WAN" in the case of the web interface. So my first question is, did I do anything wrong in my DDNS setup?
I've also saw in the Merlin wiki that Merlin switched to In-a-dyn to manage the DDNS related functionality. It even has a custom plugin for the ASUS DDNS service, the source code of which probably resides here. So I switched to the In-a-dyn setup and followed the instructions here. But I didn't manage to get it to work. My main issue was that I didn't know what the
Moving on, I decided to use DuckDNS with the script approach (not the In-a-dyn) approach. This works to the extend that I can ping the router and SSH into it from outside. But for some reason I still cannot acces the web interface even tho I enabled the option mentioned previously. So my final question is, why can I not access the web interface from outside and what would the steps be to resolve this? One suspicion I have is that I'm technically not attempting to access the web interface via the WAN, since the WAN IP is a private IP (192.168...). I'm accessing it through the public IP I get from the VPN connection.
I know this is a long post. But I hope someone can assist me with this.
I have a GT-BE98 running the "GT-BE98_3006_102.1_1-gnuton0_beta1_nand_squashfs.pkgtb" firmware found here. The router is connected via its WAN 10G port to a network socket inside a university campus. In order to gain access to the university campus network (and internet), I have set up a VPN client (client 1 to be specific) through the router's web interface and I've configured the router to route all internet traffic through the VPN. One issue I've encountered is that the VPN won't restart when the router restarts. But I was able to resolve this issue by creating a watchdog script under
/jffs/scripts/ovpnclient1-watchdog
which is registered via /jffs/scripts/services-start
and called automatically every minute. Just for completeness sake, here are the contents of the corresponding scripts:Contents of
/jffs/scripts/ovpnclient1-watchdog:
Bash:
#!/bin/sh
if [ -z "$(pidof vpnclient1)" ]
then
service restart_vpnclient1
fi
Contents of
/jffs/scripts/services-start
:
Code:
#!/bin/sh
LOG_TAG="Services start script"
#Add cron entry for vpnclient1 watchdog.
if [ -z "$(cru l | grep CheckOpenVPNClient1)" ]
then
cru a CheckOpenVPNClient1 "* * * * * /jffs/scripts/ovpnclient1-watchdog"
logger -t "$LOG_TAG" -p 2 "Added OpenVPN Client 1 watchdog to cron utility."
fi
The watchdog successfully ensures that the VPN is up reliably.
Besides the VPN, I've also configured a DDNS service. Initially I've attempted to get the asuscomm.com DDNS running since the setup is easy. But it doesn't work in conjunction with a VPN because the router still has a private IP and the builtin functionality isn't smart enough to rely on the VPN to update the DDNS. I then saw that you can also opt for a custom DDNS update and specifically this section of the wiki in conjunction with the ASUS sample script got me this script:
Contents of
/jffs/scripts/openvpn-event
:
Bash:
#!/bin/sh
if [ "$script_type" = "route-up" ] && [ "$dev" = "tun11" ]; then
# OpenVPN tunnel won't open until openvpn-event script is finished, run the rest in a background shell
(
# Loop until VPN tunnel is established or the timeout limit is reached
COUNTER=0
LIMIT=10
while [ "$COUNTER" -le "$LIMIT" ] && ! ifconfig | grep -Fq "tun11"; do
sleep 1
COUNTER=$((COUNTER + 1))
done
# Set the host name, ending with .asuscomm.com is optional
HOSTNAME='redacted'
# The IP address to use
IP=$(ifconfig tun11 | grep 'inet addr' | awk '{print $2}' | cut -d ':' -f 2)
# Asus DDNS server
ASUS_SERVER='nwsrv-ns1.asus.com'
# Router MAC address location is hardware dependent
for LAN_MAC_NAME in et0macaddr et1macaddr et2macaddr; do
MAC_ADDR="$(nvram get "$LAN_MAC_NAME")"
if [ -n "$MAC_ADDR" ] && [ "$MAC_ADDR" != '00:00:00:00:00:00' ]; then
break
fi
done
# Use openssl to generate the password
PASSWORD="$(printf '%s' "${MAC_ADDR//:/}${IP//./}" | openssl md5 -hmac "$(nvram get secret_code)" 2>/dev/null | awk '{print toupper($2)}')"
# Try to update
HTTP_RESULT="$(curl -fs -w '%{http_code}' -o /dev/null -u "${MAC_ADDR//:/}:$PASSWORD" "http://$ASUS_SERVER/ddns/update.jsp?hostname=${HOSTNAME%.asuscomm.com}.asuscomm.com&myip=$IP")"
# Full code list https://github.com/RMerl/asuswrt-merlin.ng/blob/master/release/src/router/inadyn/plugins/asuscomm.c#L293
case "$HTTP_RESULT" in
200|220|230)
/sbin/ddns_custom_updated 1
;;
*)
/sbin/ddns_custom_updated 0
;;
esac
) &
fi
Note the deviations from the original scripts in the first if condition, and the different IP being used. Anyways, this script results in a HTTP response of 200, so everything should be good? Wrong! For some reason the DDNS update works but when actually attempting to ping the supposedly updated domain, I get no reply. I also cannot SSH into the router via the domain, or access the web interface. I did make sure to enable the relevant settings in the router's web interface, e.g. "Enable Web Access from WAN" in the case of the web interface. So my first question is, did I do anything wrong in my DDNS setup?
I've also saw in the Merlin wiki that Merlin switched to In-a-dyn to manage the DDNS related functionality. It even has a custom plugin for the ASUS DDNS service, the source code of which probably resides here. So I switched to the In-a-dyn setup and followed the instructions here. But I didn't manage to get it to work. My main issue was that I didn't know what the
/jffs/inadyn.conf
was supposed to look like when ussing the ASUS DDNS service. I also am unsure which DDNS provider url to use for the ASUS DDNS service. There are different ones mentioned in different examples throughout the wiki/codebase. This leads me to my second question, what does the setup for the ASUS DDNS service with In-a-dyn look like and can someone give me a comprehensive example?Moving on, I decided to use DuckDNS with the script approach (not the In-a-dyn) approach. This works to the extend that I can ping the router and SSH into it from outside. But for some reason I still cannot acces the web interface even tho I enabled the option mentioned previously. So my final question is, why can I not access the web interface from outside and what would the steps be to resolve this? One suspicion I have is that I'm technically not attempting to access the web interface via the WAN, since the WAN IP is a private IP (192.168...). I'm accessing it through the public IP I get from the VPN connection.
I know this is a long post. But I hope someone can assist me with this.