Announcement

Collapse
No announcement yet.

Automatically connect to VPN using network manager

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Automatically connect to VPN using network manager

    I did a search but couldn't find anything on this on the forums.

    Under 14.xx I had a script that ran when Kubuntu booted to connect to the vpn. Thus, I always had the vpn connection when the computer was operational. Unfortunately under 15.xx I have learned that the script will no longer be run by Kubuntu when it boots.

    However, I found something even better while exploring another issue today: How to get network manager to automatically connect to the vpn when it connects to a wired or wireless connection.

    Click on the network icon in the panel and then click the connection editor icon at the right side of the opened window (near the top).

    That will bring up the Connection editor window. Click on the "Wired Connection" item to highlight it. Then click the "edit" icon at the top of the window. That will bring a window to edit the wired connection. Click on the "General Configuration" tab at the top.

    Then click the button to "Automatically connect to VPN when using this connection" and choose a vpn to connect to automatically. You will have to setup the vpn connection prior to this.

    Click "OK" to exit the edit connection edit window. Then close the Connection Editor window.

    Click the network icon on the panel and disconnect from the wired connection. Wait 2 or 3 seconds and reconnect the wired connection. The vpn will be connected when the wired connection is activated by network manager.

    I connect to my router and hence the internet via ethernet cable so I have illustrated the method using the wired connection. If you connect via Wi-Fi then use that connection to edit.

    This method is much, much better than the script I used to have to run at Kubuntu boot time since sometimes there was a timing problem as to when the internet connection was made by network manager and when Kubuntu tried to run the script. This is up to network manager only.

    This method is also superior to the Kubuntu boot script for my laptop. The laptop, when on battery, will close down (sleep, turn-off, whatever it does when idle). When that happens it also closes down the internet connection. When re-activated, the connection is re-established, but since Kubuntu wasn't booted, so the script to re-establish the vpn connection wasn't run. Thus no vpn. Many times I didn't remember to manually re-establish the vpn. By having network manager re-establish the vpn when the Wi-Fi connection is made, I now have the vpn automatically every time network manager establishes the Wi-Fi connection.

    Thus solving my memory problem!

    I hope this helps others with the same problem.
    Last edited by Snowhog; Jul 25, 2015, 11:48 AM.
Working...
X