Newbie question - network drive mapping on connection of VPN
Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Newbie question - network drive mapping on connection of VPN
Hi All
Very new to OpenVPN, so feeling my way through. Have a pretty newbie question, but have searched the forum and cannot find anything that really points me in the right direction, so hoping to get some help.
Where I am at the moment is: I have the OpenVPN server software running on my remote machine. Not sure of version as it part of a third party application supplied via Synology on their Diskstation NAS. This runs what I believe is a custom version of Linux as it's underlying OS. I have set up the OpenVPN client on my client computer, which is running Win7. Client software is the OpenVPN GUI version 1.03, with OpenVPN version 2.2.2 underlying. After trial and error I can now connect to my network remotely via vpn using OpenVPN, and access my network drives. My network drives are permanent, and show an error when there is no connection to the network host.
Where I want to get to: is for the network drives to be mapped only after a network connection to the host is available. Specifically remotely when the VPN is connected. Having searched found that this is possible by calling a user script in the OpenVPN client configuration file, with the user script being a batch file with a "net use..." command to map the drive.
My problem: The batch file when run on its own works. Analysing the connection logs the client config file is correctly calling the user script. However this is where it all goes wrong. I get an error message saying system error 53...network path not found, and further down one up/down error 2. My thinking is that the mapping script is running to early before the connection script has completed? Working on this I have tried adding "up-delay" in the config file, and "timeout" in the batch file with no success.
Anyone have and idea's. I have placed the line in the config file which calls the user script at the end of the config script such that it is the last action. I have named my batch file the same as the config file, with the suffix "_up". I call the user script in the config file with UP and then the user script filename. The batch file is in the same folder as the config file.Script security is set to 2.
Haven't posted my config script or user script here, but will do if anyone wants to check them for me.
Any pointers would be greatly appreciated
Thanks in advance
Very new to OpenVPN, so feeling my way through. Have a pretty newbie question, but have searched the forum and cannot find anything that really points me in the right direction, so hoping to get some help.
Where I am at the moment is: I have the OpenVPN server software running on my remote machine. Not sure of version as it part of a third party application supplied via Synology on their Diskstation NAS. This runs what I believe is a custom version of Linux as it's underlying OS. I have set up the OpenVPN client on my client computer, which is running Win7. Client software is the OpenVPN GUI version 1.03, with OpenVPN version 2.2.2 underlying. After trial and error I can now connect to my network remotely via vpn using OpenVPN, and access my network drives. My network drives are permanent, and show an error when there is no connection to the network host.
Where I want to get to: is for the network drives to be mapped only after a network connection to the host is available. Specifically remotely when the VPN is connected. Having searched found that this is possible by calling a user script in the OpenVPN client configuration file, with the user script being a batch file with a "net use..." command to map the drive.
My problem: The batch file when run on its own works. Analysing the connection logs the client config file is correctly calling the user script. However this is where it all goes wrong. I get an error message saying system error 53...network path not found, and further down one up/down error 2. My thinking is that the mapping script is running to early before the connection script has completed? Working on this I have tried adding "up-delay" in the config file, and "timeout" in the batch file with no success.
Anyone have and idea's. I have placed the line in the config file which calls the user script at the end of the config script such that it is the last action. I have named my batch file the same as the config file, with the suffix "_up". I call the user script in the config file with UP and then the user script filename. The batch file is in the same folder as the config file.Script security is set to 2.
Haven't posted my config script or user script here, but will do if anyone wants to check them for me.
Any pointers would be greatly appreciated
Thanks in advance
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Re: Newbie question - network drive mapping on connection of
Client config file, essentially the basic file as exported from the Synology OpenVPN set-up. Very new to this so if there is anything else in-correct please advise
User script for mapping the drives
Thanks for any help
Code: Select all
dev tun
tls-client
remote myhost.com 1194
# The "float" tells OpenVPN to accept authenticated packets from any address,
# not only the address which was specified in the --remote option.
# This is useful when you are connecting to a peer which holds a dynamic address
# such as a dial-in user or DHCP client.
# (Please refer to the manual of OpenVPN for more information.)
#float
# If redirect-gateway is enabled, the client will redirect it's
# default network gateway through the VPN.
# It means the VPN connection will firstly connect to the VPN Server
# and then to the internet.
# (Please refer to the manual of OpenVPN for more information.)
redirect-gateway
# dhcp-option DNS: To set primary domain name server address.
# Repeat this option to set secondary DNS server addresses.
#dhcp-option DNS DNS_IP_ADDRESS
pull
proto udp
ca ca.crt
comp-lzo
reneg-sec 0
auth-user-pass
auth-nocache
#up-delay
script-security 2 system
up openvpn_up.bat
Code: Select all
net use t: \\host IP\share /persistent:no
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Re: Newbie question - network drive mapping on connection of
Hi
Thanks for that, unfortunately still getting the same error, connection log file as follows
Thanks for that, unfortunately still getting the same error, connection log file as follows
Sun Apr 06 15:23:44 2014 OpenVPN 2.2.2 Win32-MSVC++ [SSL] [LZO2] [PKCS11] built on Dec 15 2011
Sun Apr 06 15:23:54 2014 IMPORTANT: OpenVPN's default port number is now 1194, based on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earlier used 5000 as the default port.
Sun Apr 06 15:23:54 2014 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Sun Apr 06 15:23:54 2014 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Sun Apr 06 15:23:54 2014 NOTE: --script-security method='system' is deprecated due to the fact that passed parameters will be subject to shell expansion
Sun Apr 06 15:23:54 2014 LZO compression initialized
Sun Apr 06 15:23:54 2014 UDPv4 link local (bound): [undef]:1194
Sun Apr 06 15:23:54 2014 UDPv4 link remote: my host:1194
Sun Apr 06 15:23:56 2014 [Snake_Oil_CA] Peer Connection Initiated with my host:1194
Sun Apr 06 15:23:58 2014 TAP-WIN32 device [Local Area Connection 2] opened: \\.\Global\{EA199453-58DD-4C3D-9FC7-D840B5A6D3AF}.tap
Sun Apr 06 15:23:58 2014 Notified TAP-Win32 driver to set a DHCP IP/netmask of 10.8.0.6/255.255.255.252 on interface {EA199453-58DD-4C3D-9FC7-D840B5A6D3AF} [DHCP-serv: 10.8.0.5, lease-time: 31536000]
Sun Apr 06 15:23:58 2014 Successful ARP Flush on interface [16] {EA199453-58DD-4C3D-9FC7-D840B5A6D3AF}
Sun Apr 06 15:23:58 2014 openvpn_up.bat Local Area Connection 2 1500 1542 10.8.0.6 10.8.0.5 init
C:\Program Files (x86)\OpenVPN\config>c:\windows\system32\net use t: \\host ip\share /persistent:no
System error 53 has occurred.
The network path was not found.
Sun Apr 06 15:24:51 2014 WARNING: Failed running command (--up/--down): returned error code 2
Sun Apr 06 15:24:51 2014 Exiting
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Re: Newbie question - network drive mapping on connection of
I did
I sanitised the logs before posting
Thanks
I sanitised the logs before posting
Thanks
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Re: Newbie question - network drive mapping on connection of
The actual network path I am using is correct in the batch file, when run independently, i.e. vpn connection is establish and the batch file is run manually, it works.
For purposes of sanitising my post I have changed the ip address to "host ip and the actual shared folder to "share" My actual path in the batch file is \\192.168.0.X\ZZZZZ where the X is the last digit of the ip address and the Z'ds are the name of the shared folder.
Going back to my first post I am wondering if the network path is not found because the vpn connection is not complete when the drive mapping script is running and therefore cannot find a network path???
Thanks for you response, all good learning
For purposes of sanitising my post I have changed the ip address to "host ip and the actual shared folder to "share" My actual path in the batch file is \\192.168.0.X\ZZZZZ where the X is the last digit of the ip address and the Z'ds are the name of the shared folder.
Going back to my first post I am wondering if the network path is not found because the vpn connection is not complete when the drive mapping script is running and therefore cannot find a network path???
Thanks for you response, all good learning
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Re: Newbie question - network drive mapping on connection of
That's an interesting response
Having spent the past week searching on Google I had reached the understanding that to automatically map my network drives when using Openvpn. I needed to add the up command in the client config file and include a script to do the drive mapping. There are lots of articles that make reference to this, maybe I am missing something??
As far as my understanding goes is the UP command calls the external script and will only run when the connection is made?? But as I getting the network path not found error my speculation was that the path wasn't set so hence the error. One article I read talked about setting a delay in the config file to delay the running of the mapping script until the handshaking and connection of the vpn was established.
Guess a little knowledge is dangerous....lol.....but thanks for taking a look
Having spent the past week searching on Google I had reached the understanding that to automatically map my network drives when using Openvpn. I needed to add the up command in the client config file and include a script to do the drive mapping. There are lots of articles that make reference to this, maybe I am missing something??
As far as my understanding goes is the UP command calls the external script and will only run when the connection is made?? But as I getting the network path not found error my speculation was that the path wasn't set so hence the error. One article I read talked about setting a delay in the config file to delay the running of the mapping script until the handshaking and connection of the vpn was established.
Guess a little knowledge is dangerous....lol.....but thanks for taking a look
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Re: Newbie question - network drive mapping on connection of
Thanks for that, very interesting reading.
My understanding of your solution for your problem, you write a file from open vpn, filewatcher sees this and triggers an external action?
Guessing I could do the same, openvpn connects and creates a file, filewatcher see it and runs the batch file to map the drives, sound about right?
Thanks
Was kinda thinking along these lines myself, the filewatcher software was the piece of the jigsaw I was missing.
My understanding of your solution for your problem, you write a file from open vpn, filewatcher sees this and triggers an external action?
Guessing I could do the same, openvpn connects and creates a file, filewatcher see it and runs the batch file to map the drives, sound about right?
Thanks

Was kinda thinking along these lines myself, the filewatcher software was the piece of the jigsaw I was missing.
-
- OpenVpn Newbie
- Posts: 9
- Joined: Sun Apr 06, 2014 10:26 am
Re: Newbie question - network drive mapping on connection of
next question is how do I use the up directive to write a external file. Guess you overwrite the file each time the config script runs and filewatcher picks up on the change in timestamp?
-
- OpenVpn Newbie
- Posts: 1
- Joined: Mon Jan 05, 2015 7:59 am
Re: Newbie question - network drive mapping on connection of
The install with original DeviceDescription is OK.
My old-install with 2.3.3 and new 2.3.5 is correct for XP, 2003, SBS2011, Win7.
Can I change the DeviceDescription in *.inf-Files?
New Policys for WinSvr2012?
My old-install with 2.3.3 and new 2.3.5 is correct for XP, 2003, SBS2011, Win7.
Can I change the DeviceDescription in *.inf-Files?
New Policys for WinSvr2012?