auto reconnect and auto block

Got a problem with Viscosity or need help? Ask here!

Ingenuus

Posts: 3
Joined: Sun May 25, 2014 6:35 am

Post by Ingenuus » Sun May 25, 2014 6:41 am
Hi,
1. Auto reconnect
somehow I can not find the option to tell Viscosity to auto reconnect when connections drops. I provoked a connection drop and ticked in the menu "automatically reconnect" but without success.
Where can I configure the auto reconnect in Viscosity ?


2. Auto block
I followed the "3. Using The Routing Table" in : http://www.sparklabs.com/forum/viewtopic.php?f=3&t=443
In Windows 7 64 bit this is NOT working. As soon as Internet connection comes back, Viscosity does NOT reconnect, but Internet does. Everything starts working again, but is NOT using my VPN. This is the worst possible outcome.
Please help!
1. Edit your connection in Viscosity
2. Click on the Networking tab
3. Click the small "+" button to add a new route. Enter "0.0.0.0" as the Route/IP, "0.0.0.0" as the mask, "vpn_gateway" as the Gateway, and leave the Metric field blank. Click Add.
4. Click Save and test what happens when a dropout occurs.

Cheers,
James

Eric

User avatar
Posts: 1146
Joined: Sun Jan 03, 2010 3:27 am

Post by Eric » Mon May 26, 2014 2:27 pm
Hi Ingenuus,

To answer each of your questions:

1. In the event of a drop-out, Viscosity will attempt to automatically reconnect where it can. If you wish for Viscosity to be more aggressive in reconnecting, you will need to use a couple of advanced commands and scripting support. I'm afraid Viscosity does not have an Automatically Reconnect option though, could you let us know what version of Viscosity you are using, as you may be using an early beta that your VPN Provider has sent you, which they might be able to help you out more.

2. This method of blocking an Internet connection on drop-out I'm afraid will not work on Windows, it is a Mac only option. For Windows, you will need to use scripting support.

For more information, please see - http://www.sparklabs.com/support/preven ... fic_leaks/
For more information on more aggressive reconnecting, please have a look at the following forum post - http://www.sparklabs.com/forum/viewtopi ... 1413#p4161

If you have any specific questions, please let us know and we will do our best to help.

Regards,

Eric
Eric Thorpe
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs

Ingenuus

Posts: 3
Joined: Sun May 25, 2014 6:35 am

Post by Ingenuus » Tue May 27, 2014 5:16 am
Hi,

thank you for the answer. I am running Viscosity 1.4.8 (1236). I do have persist Tun AND persist KEY checked. Viscosity is NOT reconnecting.

I tried the vbs script you kindly provided:
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = "."
strProcessKill = "uTorrent.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
WSCript.Echo "Just killed process " & strProcessKill _
& " on " & strComputer
WScript.Quit
' End of WMI Example of a Kill Process
It is throwing an error at Line:
For Each objProcess in colProcess
objProcess.Terminate()
Next
Error:
Line: 11
Character: 1
Error: 0x80052017
Code: 80041017
Source: (null)

Any idea why?
OS is Win7 64 Ultimate.

Eric

User avatar
Posts: 1146
Joined: Sun Jan 03, 2010 3:27 am

Post by Eric » Tue May 27, 2014 11:42 am
Hi Ingenuus,

Could you please post a copy of your OpenVPN log when a reconnect is failing. Please note, if you a disconnect manually, a reconnect will not be reattempted, only on a drop out. On Windows, Persist Tun and Persist Key should not be checked to improve the chances of a connection being re-established automatically.

Please take a look at the script we provide again as you are missing a set of quotes around utorrent, the line should read:
Code: Select all
strProcessKill = "'uTorrent.exe'" 
Also, if you are running uTorrent.exe as Administrator, Viscosity will need to be run as Administrator so the script is given elevated rights.
Eric Thorpe
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs

Ingenuus

Posts: 3
Joined: Sun May 25, 2014 6:35 am

Post by Ingenuus » Thu May 29, 2014 10:17 pm
Hi Eric,

thank you for the answer. The script is working fine now! I was not aware that you have to use different quotes in VBS!


I unchecked Persist Tun and Persist Key. Now let’s see what happens. Only way I can try is to switch of my router, and switch it back on again. Does this count as “dropout” or is it a manual disconnect?

BR
Frank
Mai 29 01:14:02: Status auf Connecting geändert
Mai 29 01:14:02: Viscosity 1.4.8 (1236)
Mai 29 01:14:02: Besturingssysteem is Microsoft Windows 7 Ultimate
Mai 29 01:14:02: Aktivieren des Netzwerkadapters...
Mai 29 01:14:03: Überprüfe die Erreichbarkeit der Gegenstelle...
Mai 29 01:14:13: Gegenstelle ist nicht erreichbar. Verbindung wird getrennt.
Mai 29 01:14:13: Status auf Disconnected geändert
Mai 29 01:14:32: Reachability check failed for vpn.btguard.com - Failed DNS Resolution
Mai 29 01:14:42: Reachability check failed for vpn.btguard.com - Failed DNS Resolution
Mai 29 01:29:21: Status auf Connecting geändert
Mai 29 01:29:21: Viscosity 1.4.8 (1236)
Mai 29 01:29:21: Besturingssysteem is Microsoft Windows 7 Ultimate
Mai 29 01:29:21: Aktivieren des Netzwerkadapters...
Mai 29 01:29:21: Überprüfe die Erreichbarkeit der Gegenstelle...
Mai 29 01:29:21: Gegenstelle ist erreichbar. Starte Verbindungsversuch.
Mai 29 01:29:22: OpenVPN 2.3.2 Windows-MSVC [SSL (OpenSSL)] [LZO] [PKCS11] [eurephia] [IPv6] built on Apr 8 2014
Mai 29 01:29:24: WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Mai 29 01:29:24: Attempting to establish TCP connection with [AF_INET]xnonblock]
Mai 29 01:29:25: TCP connection established with [AF_INET]x
Mai 29 01:29:25: TCPv4_CLIENT link local: [undef]
Mai 29 01:29:25: TCPv4_CLIENT link remote: [AF_INET]x
Mai 29 01:29:25: WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Mai 29 01:29:26: [server] Peer Connection Initiated with [AF_INET]x
Mai 29 01:29:29: do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Mai 29 01:29:29: open_tun, tt->ipv6=0
Mai 29 01:29:29: TAP-WIN32 device [BTGuard (TCP).ovpn] opened: \\.\Global\{x}.tap
Mai 29 01:29:29: Notified TAP-Windows driver to set a DHCP IP/netmask of x on interface {x} [DHCP-serv:x, lease-time: 31536000]
Mai 29 01:29:29: Successful ARP Flush on interface [22] {x}
Mai 29 01:29:34: Initialization Sequence Completed
Mai 29 01:29:34: Status auf Connected geändert
Mai 29 01:56:51: Status auf Disconnecting geändert
Mai 29 01:56:52: Status auf Disconnected geändert
Mai 29 01:56:53: Reachability check failed for vpn.x - Failed DNS Resolution
Mai 29 01:57:35: Reachability check failed for vpn.x - Failed DNS Resolution

Eric

User avatar
Posts: 1146
Joined: Sun Jan 03, 2010 3:27 am

Post by Eric » Fri May 30, 2014 10:37 am
Hi Ingenuus,

A dropout can occur in two ways, either when the servers drops your connection, or when your connection drops out because your lose your network/Internet connection. Turning off your router can only mimic the latter, and Viscosity should prompt you to ask if you want to reconnect manually in this case as Viscosity can monitor your network connection until it is up again and a connection can be established. It looks like this has happened a minute later but your DNS server has not re-established. If this happens regularly, you may wish to use an IP Address instead of an DNS address in your config.

Regards,

Eric
Eric Thorpe
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
6 posts Page 1 of 1