I want to administer a tomato router remotely. This was working well for several weeks, until I got a new IP from my ISP, and I could no longer log into the remote router. I had an idea to update it automatically via a script. I found a similar script on the DD-WRT wiki, and modified it a bit for tomato. Here's what I have so far:
logger "Checking if admin access IP address needs to be updated." REMOTE_DNS=<my dns> REMOTE_IP=`ping -c 1 $REMOTE_DNS | grep "^PING" | cut -f3 -d" " | cut -f2 -d"(" | cut -f1 -d")"` #determine the current IP address that's used for remote management CURRENT_ADMIN_IP=`nvram get rmgt_sip` ### If the remote IP has changed, then change the admim IP setting if [ "$CURRENT_ADMIN_IP" != "$REMOTE_IP" ]; then #configure WAP to allow this IP address to connect remotely nvram set rmgt_sip="$REMOTE_IP" #save nvram settings nvram commit > /dev/null 2>&1 logger "Updated admin access IP address." fi
This does indeed update the address in nvram and on the admin access page. However, it doesn't take effect until restarting the router, or pressing "OK" on the Admin Access page. I'm guessing that pressing OK on the admin access page restarts the admin web server process, or something similar. Does anybody know what else I'd have to do to get this working the rest of the way?