VPN to LabraNet
You can access your home folder and other resources from your home network with VPN. Instructions for connecting to the LabraNet VPN and mounting your home folder can be found in the LabraNet Remote Access Guide
If you encounter any problems with VPN connection here are few remedies to known problems:
– DNS problems are often solved by flushing the DNS cache (in windows the command is “ipconfig /flushdns”, in linux you need to restart nscd daemon with command “/etc/init.d/nscd restart”)
– Connectivity problems are caused by not receiving proper routes from VPN connection, DHCP clearance is often needed to get VPN routes. In windows commands are: “ipconfig /release” and after that “ipconfig /renew”. In linux “dhclient -r” will renew DHCP bindings.
– Check whether the VPN tunnel is in full or split mode (See Advanced Routing in the Guide). Sometimes full tunnel mode works better
– In newer Mac OS X, check the Service order in the Network settings page, and the scutil –dns command output. Wrong service order will make the system use your default DNS servers, and the system cannot resolve LabraNet names.
– If the Windows 10 app freezes and doesn’t show connection options you can complete or close the connection using the following command line commands:
– To make the connection: rasdial.exe “connection name” (add username and password if you haven’t saved them in connection options: rasdial.exe “connection name” “username” “password”)
– To close the connection: rasdial.exe “connection name” /disconnect
Notice! Due to server side access control implementation, passwords with umlaut characters or more uncommon special characters might not be accepted during authentication. You can use the password reset service to test if this is an issue for you.
LabraNet VPN Auto Triggering
Windows 10 adds the possibility to auto trigger VPN connections. This following guide shows how you can add applications that automatically trigger a VPN connection when launched. The example shows a custom application but you can use whatever application suits you best, for example MySQL Workbench.
Prerequisites for custom application
- Python installed and in path
- Example uses version 3.8.1
- VPN connection created with correct settings
- Credentials saved for the connection
Open a new PowerShell window. Run it as administrator if you want to save the shortcut to public desktop later as per these instructions.
Install PyInstaller for building an executable out of chosen Python-script
python -m pip install pyinstaller
Write your connection script. Here the input() function is chosen so that the script finishes and executable closes after enter is pressed
Write-Output ‘input(“Press enter to disconnect”)’ | Out-File -FilePath vpn.py -Encoding utf8
Build the executable.
python -m PyInstaller -F vpn.py
Move the created executable to current directory.
Move-Item .\dist\vpn.exe .
Configure vpn triggering. Split tunneling is required for triggering to work. IdleDisconnectSeconds define how long the connection stays on after the executable is closed.
$vpn = (Get-VpnConnection).Name
$app = “$((Get-Location).Path)\vpn.exe”
Set-VpnConnection -Name $vpn -SplitTunneling $True -IdleDisconnectSeconds 5
Add-VpnConnectionTriggerApplication -ConnectionName $vpn -ApplicationID $app
Create a shortcut to public desktop. If you did not lauch PowerShell as admin, either escalate privileges or change the $ShortcutLocation path below.
$ShortcutLocation = “[Environment]::GetFolderPath(‘CommonDesktopDirectory’)\Connect to LabraNet.lnk”
$WScriptShell = New-Object -ComObject WScript.Shell
$Shortcut = $WScriptShell.CreateShortcut($ShortcutLocation)
$Shortcut.TargetPath = $app
$Shortcut.save()
Check the connect automatically checkbox in vpn settings.
Connecting via auto trigger should function similarly to video below.