VPN access behind Router

Good morning Kyle,
just doing a follow up to check if you had time to look at this?

thanks

I have been looking into it, but haven’t had time to finish.

For the route, one thing I was looking into was the possibility of using the Add-VpnConnectionRoute command.

As far as the VPN address, they weren’t able to give me a variable that I can use in the config, so we’ll have to figure out another way.

Last week we had trainings on 3 of the mornings and were playing catch up all afternoon on tickets, and it was a very busy week. If this is something that you needed for a deadline, you could book some dev hours with our Solution Center, but if not, I’ll continue to research it when I have time. I am hoping that I’ll have more time this week.

Kyle

No problem Kyle!
Like I’ve said, I was just doing a follow up to see if there is still hope and developement.
It seems the case.
I’ll wait for some more good news soon.

regards

@jfortier,

I have found why the the route persists after disconnecting. It’s due to the line

persist-tun

If you comment that out, it will delete the route when you disconnect. I’ve tested and it doesn’t seem to effect anything else, but I’ll run by the developers just in case.

I think we should be able to create a PowerShell script like this and execute it by using ‘route-up’ in the .ovpn config, and then a similar command to delete the route upon disconnect. Will test tomorrow.

$VPNIP = (Get-NetIPAddress -InterfaceAlias Talk2m-eCatcher -AddressFamily IPv4).IPAddress

$INTIDX = (Get-NetIPAddress -InterfaceAlias Talk2m-eCatcher -AddressFamily IPv4).InterfaceIndex

New-NetRoute -DestinationPrefix "10.20.30.0/24" -InterfaceIndex $INTIDX -NextHop $VPNIP

So I was able to get the powershell script working to create the route automatically. I will have to work on the script to tear the route down though, because it creates a persistent route.

Here is what needs to be added to the .ovpn:

script-security 2 system
route-up "'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe' -ExecutionPolicy Bypass -File 'C:\\Program Files (x86)\\eCatcher-Talk2M\\Talk2mVpnService\\conf\\new_route.ps1'" 

And here is new_route.ps1 (which I stored in the same file):

#!"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy ByPass -File
#EXT ps1

$VPNIP = (Get-NetIPAddress -InterfaceAlias Talk2m-eCatcher -AddressFamily IPv4).IPAddress

$INTIDX = (Get-NetIPAddress -InterfaceAlias Talk2m-eCatcher -AddressFamily IPv4).InterfaceIndex

New-NetRoute -DestinationPrefix "10.213.19.0/24" -InterfaceIndex $INTIDX -NextHop $VPNIP
1 Like

we are getting closer and closer to a solution.
keep up the good work! :slight_smile:

Good morning,
just doing a follow up, have you had a chance to do some more test?

thanks,
Jonathan

Hi @jfortier,

I haven’t had much time to work on this, but I did come up with a way to automatically pull the Ewon’s VPN address. I don’t think my last script will always work because it’s using the PC VPN address. I hope to have this finished soon!

In this example, your gateway’s IP address is 10.1.10.1/24. We will create a tag to acquire the VPN IP address to use in a script that adds a static route on your PC to the gateway on your Ewon’s LAN.

1. Create a MEM tag ‘VpnIpAddr’ of type String and enable Historical Logging

2. Place the following code in the BASIC IDE:

VPNIPADDR@ = GETSYS PRG, "VPNIP"

3. In Setup > System > Main > Net Services > Data Management enable Historical Data for the Talk2M API.

4. Test your API call (you must have Developer ID) using the following URL:

https://data.talk2m.com/getdata?t2maccount=YourAccount&t2musername=admin&t2mpassword=P@$$word&t2mdevid=xxx-your_dev_id_xxx&ewonId=12345&tagId=678910

5. Create a text file called “new_route.ps1” in the eCatcher conf directory:

#!"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy ByPass -File
#EXT ps1
$j = Invoke-WebRequest https://data.talk2m.com/getdata?t2maccount=YourAccount&t2musername=admin&t2mpassword=P@$$word&t2mdevid=xxx-your_dev_id_xxx&ewonId=12345&tagId=678910| ConvertFrom-Json
$VPNIP = $j.ewons.tags
New-NetRoute -DestinationPrefix "10.1.10.0/24" -NextHop $VPNIP

6. Add the following lines to Talk2MClient.ovpn file:

script-security 2 system

route-up "'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe' -ExecutionPolicy     Bypass -File 'C:\\Program Files (x86)\\eCatcher-Talk2M\\Talk2mVpnService\\conf\\new_route.ps1'"

Good morning Kyle,
sorry to bother you again.
Just doing a follow up as you seems to be close to a solution and the time fly on my side.
I will soon need a working solution.

Thanks!

Good morning,
just taking news on that case.

thanks,
Jonathan

Unable to complete this at this time. Will possibly revisit at a later date.