Workaround: LM 19.1 won't auto-connect to network if auto-connect VPN is set

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
User avatar
catweazel
Level 19
Level 19
Posts: 9890
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Workaround: LM 19.1 won't auto-connect to network if auto-connect VPN is set

Post by catweazel »

I'm a firm believer in 'physician, heal thyself'. If I can't solve my own problems then I shouldn't be here trying to solve problems for others. I was at my wit's end with an issue that almost made me post asking for assistance. No amount of google-fu revealed a fix or a workaround. Fortunately I figured it out before I got as far as asking for help and losing all respect for myself :)

I'm running LM 19.1 Cinnamon and use a VPN. I should be able to specify that a particular network connection is to connect to a VPN automatically, but Mint will have none of it. If I remove the VPN auto-connection then the network starts as it should, automatically. If I want to start the VPN automatically then I have to manually start the network after logging in to the desktop. I haven't been able to solve the problem but I have found a workaround. I will add that I have tried multiple NICs (Intel and RTL) but the problem persisted.

So, you have a network connection and a VPN, both created in network manager and working when you manually start the network, followed by starting the VPN, but it doesn't work when the network connection in network manager is set to start the VPN automatically. From this point, the first step is to identify the network connection:

Code: Select all

boot@akhenaten:~$ nmcli con
NAME             UUID                                  TYPE      DEVICE 
AustraliaXXXXX   aae2d1d2-c064-4b3c-80db-afb20ae4124e  vpn       enp5s0 
RTL8111          bd2453c9-f8a2-30c5-8e7f-697a82acad63  ethernet  enp5s0 
tun0             4dacd325-e58b-44f6-83bd-8f9b7d1f373f  tun       tun0   
Intel i219-V     041447da-aaf8-3542-ae47-3cf997879e67  ethernet  --     
I want the machine to use the connection named RTL8111, and I want that connection to start the VPN without any intervention from me, which is what network manager is supposed to do but won't. Taking that connection name information, disconnecting from the network in the network manager, and manually bringing up the connection named RTL8111 in a terminal also fires up the VPN:

Code: Select all

nmcli con up id RTL8111
This tells us that the network connection defined in network manager can actually start the VPN automatically, despite Mint somehow not being able to figure it out.

The final step is to create a startup command in Cinnamon's Startup Applications, simply paste the nmcli con up id RTL8111 command in, save it and reboot. Of course, you must replace RTL8111 with the name of your connection.

Voila! Network up and VPN automatically connected.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.

User avatar
PaulCarry
Level 1
Level 1
Posts: 6
Joined: Fri Apr 26, 2019 7:50 am
Location: Madrid, Spain
Contact:

Re: Workaround: LM 19.1 won't auto-connect to network if auto-connect VPN is set

Post by PaulCarry »

Interesting. I haven't noticed this so far in LM 19.1 (although I haven't set my public VPN to auto-connect just yet) but will test it out this evening.

Thanks for the write-up (and heads up).

Zessofed
Level 1
Level 1
Posts: 29
Joined: Tue Jul 16, 2019 2:40 am
Location: Antwerp
Contact:

Re: Workaround: LM 19.1 won't auto-connect to network if auto-connect VPN is set

Post by Zessofed »

Hi,

Mint 19 installed on a Dell Precision M4800.
I've exactly the same problem.

I don't know if there is already a real solution for this?

Thanks.

Zessofed
Level 1
Level 1
Posts: 29
Joined: Tue Jul 16, 2019 2:40 am
Location: Antwerp
Contact:

[SOLVED] Re: Workaround: LM 19.1 won't auto-connect to network if auto-connect VPN is set

Post by Zessofed »

Hi,

In the latest version, 19.2, the Network Manager - Network Connections - Editing [General] tab has a tick-box to use an installed VPN automatically when the network turns on (after boot).
Thus the basic question is resolved!

But:
I've a couple of PC's running Mint 19.2 and on some it works flawless.
On two other it works but at boot I need to start the network connection by selecting the network icon and turn on the switch.
When I remove the tick mark, the network starts automatically and of course I then need to turn the switch for the VPN on manually.
I think that due to the automatism on some PC's things happen too fast.
There should be a timeout between the turn on of the network and the VPN.
Everything depends from one file in /etc/NetworkManager/system-connections.
I'm looking now if there is an option to add a timeout command in that file.

Regards,

Post Reply

Return to “Tutorials”