What's new

NVRAM Variable not updating.

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Asad Ali

Very Senior Member
Hello All,

Ok so I'm using a sendmail script to email me every time by OpenVPN instance is connected and I use this string " nvram get vpn_client1_rip " to get my VPN public IP but the problem is that variable is not updating on its own when the router connects to OpenVPN and I receive an empty field in my email where it should show IP address.

I did some testing and what I find out is that variable is only updating when I go to the routers OpenVPN statistics page and after that whenever I execute the sendmail script I see the Public IP as it should.

I'm not sure if its the default behavior or if its a bug in the implementation but is there any way I can force update that variable directly from the script before fetching it?
 
On my RT-AC87U it takes about 10 seconds to connect to the VPN Server. After this nvram get vpn_client1_rip is populated.
Try adding a sleep command of about 15 secs to the script to delay sending the email.
You can place the sleep 15 at the top of the file, just below the shebang.
 
I've already added sleep command but no matter how long i wait ( even hours ) that variable is not populating automatically for me and I need to manually visit the statistics page for it to populate.

Using Asus RT-Ac68U
Firmware: 380.68_4
 
How does it connect to the VPN?
Via a script or the router UI?
 
How does it connect to the VPN?
Via a script or the router UI?

I'm using Group Policy and openvpn up scripts to only send traffic on a specific port via VPN.

So the VPN itself is configured via Router UI.


Sent from my iPhone using Tapatalk
 
Last edited:
Looks like that enabling VPN in the UI is different from what your script does.
 
Looks like that enabling VPN in the UI is different from what your script does.

I will try after disabling the scripts and only using the router UI but John's reply above means that I'm not the only one reported this issue. Let's see what RMerlin has to say on it.


Sent from my iPhone using Tapatalk
 
I will try after disabling the scripts and only using the router UI but John's reply above means that I'm not the only one reported this issue. Let's see what RMerlin has to say on it.


Sent from my iPhone using Tapatalk
Right beside the On slider a text is shown changing from connecting... to connected in the UI.
This takes about 10 secs, then nvram is populated the same time the Connected is shown.
 
Not for me. The text shows connected, VPN works as expected but that variable is not populating until I manually visits Statistics page and after that whenever I run the script manually I get the public IP in my email.


Sent from my iPhone using Tapatalk
 
Not for me. The text shows connected, VPN works as expected but that variable is not populating until I manually visits Statistics page and after that whenever I run the script manually I get the public IP in my email.


Sent from my iPhone using Tapatalk
I see, seems to be router model related, mine's also on 380.68_4, always works fine.
 
Rip is only updated when accessing the webui, it doesn't get updated on client connect. You will have to manually run the gettunnelip.sh script.

Sent from my Nexus 5X using Tapatalk
 
Rip is only updated when accessing the webui, it doesn't get updated on client connect. You will have to manually run the gettunnelip.sh script.

Sent from my Nexus 5X using Tapatalk

Ok thanks but where I can find that script and I run it from openvpn up event?

Like sh "script path" ?


Sent from my iPhone using Tapatalk
 
Ok thanks but where I can find that script and I run it from openvpn up event?

Like sh "script path" ?


Sent from my iPhone using Tapatalk
Script is probably in /usr/sbin (I'm not at home so I can't check) and takes the instance number as parameter. Look the content of the script it's fairly simple.

Sent from my Nexus 5X using Tapatalk
 
Script is probably in /usr/sbin (I'm not at home so I can't check) and takes the instance number as parameter. Look the content of the script it's fairly simple.

Sent from my Nexus 5X using Tapatalk

Ok thanks I'll check there.


Sent from my iPhone using Tapatalk
 
Running the /usr/sbin/gettunnelip.sh script at the prompt in a shell, does not return a result on my RT-AT68P running 380.68_4 with VPN Client 3 connected.

The Public IP field on the WEB UI VPN Status page is also blank.
 
Running the /usr/sbin/gettunnelip.sh script at the prompt in a shell, does not return a result on my RT-AT68P running 380.68_4 with VPN Client 3 connected.

The Public IP field on the WEB UI VPN Status page is also blank.

You need to pass the client number as an argument ( 3 in your case )

BTW if the IP is not even shown in the Web UI then its the issue in your VPN settings.

Sent from my iPhone using Tapatalk
 
Yes, I looked at the script and saw that after running it and getting no result.

I did pass 3 as an arg but it doesn't return a result.

I even tried running the ministun commands individually:

/usr/sbin/ministun -t 1000 -c 1 -i tun13 stun.l.google.com:19302
Response read #0 timeout, retry

/usr/sbin/ministun -t 1000 -c 1 -i tun13 stun.stunprotocol.org
Response read #0 timeout, retry
 
Is the VPN functional as expected?


Sent from my iPhone using Tapatalk
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top