Everytime I use Vpn I need to connect to the VPN manually using different countries.

Is there a way to connect to the VPN automatically after the system starts on Ubuntu 18.04? Thanks.

  • Yes, it's part of the Gnome VPN Client, part of the stock Ubuntu install. Put your VPN server settings into the client and turn on the 'automatic' switch.
    – user535733
    Jan 7, 2019 at 14:07
  • It can be done for a specific WiFi network. If you go to a new country, or a new coffee shop you may have to set it up first time. It may also depend on your VPN service provider. Different provider may have their own app that may allow what you want.
    – user68186
    Jan 7, 2019 at 14:11
  • Can you please give me more information how can i do this ? I have set the config files from VPN provider using Settings, Network, Add Vpn but here is no option for automatically connecting to VPN. Thanks for your help.
    – kannzzmm2
    Jan 7, 2019 at 14:20
  • 3
    Does this answer your question? Automatically turn on VPN on computer unlock Ubuntu 18.04 Oct 21, 2020 at 18:49

2 Answers 2


To automatically connect to VPN

  • Launch nm-connection-editor or open Network Connections.
  • Choose you WiFi or LAN connection, click "Edit", select the "General" tab.
  • Enable "Automatically connect to VPN when using this connection".

Extra info on installing open VPN and use the same "settings, country" every time check this link.

  • Thanks for your help. I had enabled Automatically connect to VPN when using this connection using the nm-connection-editor, but now the problem is after i turn on the system from suspend mode i get the notification connection failed and it wont be connected to the internet automatically using wired connection or wifi..
    – kannzzmm2
    Jan 7, 2019 at 15:23
  • 1
    The comment is a new question and should be asked as such. Then it can be answered properly.
    – user68186
    Jan 7, 2019 at 15:40
  • As of 20.04 this explanaition works no more. I would like to know how this settings can be found under gnome shell?!
    – mondjunge
    Jan 11, 2021 at 6:34
  • 1
    @mondjunge Open the Network Connections via Terminal, just type nm-connection-editor and press Enter. Worked for me in Ubuntu 20.04.
    – jamix
    Oct 5, 2021 at 14:43
  • @jamix Thx. In the end my problem was ubuntu reseting preferences on the default LAN-Network after reboot. I had to create a new Network Connection to persist my preferences.
    – mondjunge
    Oct 6, 2021 at 15:10

In addition to AnOn's answer you might want to have a look at this answer. If you "Store the password for all users" then the VPN will also automatically connect after waking up from being suspended.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.