1

If I use nm-connection-editor and check "Automatically connect to VPN" then WiFi doesn't start. If I uncheck it, WiFi starts but then I have to start VPN manually.

In terminal I can see this warnings when checking the box and save

(nm-connection-editor:2052): Gtk-WARNING **: 18:37:51.050: GtkGrid does not have a child property called expand

(nm-connection-editor:2052): Gtk-WARNING **: 18:37:51.055: GtkGrid does not have a child property called fill

Edit1: Screenshoots: Connect Auto VPN

Edit 2: Switching to TCP mode seems to stop disconnection

  • You have to import your .ovpn file into NetworkManager, and then when in nm-connection-editor, select "Automatically connect to VPN" as you have been, and then popup the button just to the right and select your imported VPN connection profile. – heynnema May 20 at 17:21
  • That is exactly how I did it. After restart Wired is off, When connect to WiFi, VPN is connected automatic. BUT I have to click on connect – Per-Åke Franklind May 20 at 17:43
  • You want to run wired, or wireless? Which connection profile did you enable VPN? Which "connect" to your refer to? – heynnema May 20 at 17:48
  • Ubuntu is running in ViritualBox on my Mac so Wired, Is possible change to Wireless? – Per-Åke Franklind May 20 at 17:57
  • Oh, we're running in VB? What host? What is "Network Adapter, Connected via" set to? You also didn't answer my question about which "connect" button you refer to. – heynnema May 20 at 18:03
0

The build I have that's closest related to yours uses the connection profiles found under /etc/NetworkManager/system-connections

Some connection profile settings that may be of use; documentation pulled from nm-settings from developer.gnome.org

autoconnect-priority <int32>

The autoconnect priority. If the connection is set to autoconnect, connections with higher priority will be preferred. Defaults to 0. The higher number means higher priority.

autoconnect-slaves   <int32>

Whether or not slaves of this connection should be automatically brought up when NetworkManager activates this connection. This only has a real effect for master connections. The properties "autoconnect", "autoconnect-priority" and "autoconnect-retries" are unrelated to this setting. The permitted values are: 0: leave slave connections untouched, 1: activate all the slave connections with this connection, -1: default. If -1 (default) is set, global connection.autoconnect-slaves is read to determine the real value. If it is default as well, this fallbacks to 0.

master <string>

Interface name of the master device or UUID of the master connection.

secondaries <array of strings>

List of connection UUIDs that should be activated when the base connection itself is activated. Currently only VPN connections are supported.


Putting this together with manuals that maybe reviewed via man NetworkManager, man NetworkManager.conf, and man nm-settings, here's the portions of my AP's connection profile, eg. /etc/NetworkManager/system-connections/WiFI_AP, that are relevant...

[connection]
id=WiFI_AP
uuid=aaaa-0000-aaaa-0000
type=wifi
autoconnect=true
autoconnect-priority=9000
permissions=
secondaries=deadbeef-d3ad-b33f-dead-be33e3f;
autoconnect-slaves=1
vpn.timeout=120
# ... more connection config blocks...

... the VPN connection profile did not require modification (in other-words I only included master documentation references in-case your system requires it for some reason), instead I had to copy it's uuid into the above secondaries list, in this example that would mean the /etc/NetworkManager/system-connections/VPN_Client looks something like...

[connection]
id=VPN_Client
uuid=deadbeef-d3ad-b33f-dead-be33e3f
type=vpn
permissions=
secondaries=
# ... more connection config blocks...

Note, lists for connection profiles are space separated strings, and end with a semicolon ;

I've tried turning off/of my WiFi as well as reboots and full shutdowns and the connection resumes as desired!

If ya run into problems, eg sudo systemctl status NetworkManager is logging read errors or file not found, then ya may want to move the VPN configurations and certs into a directory that isn't an encrypted home directory, or set a longer vpn.timeout, or log-in faster.


Reading through the comments of your question @Per-ÅkeFranklind, sounds like the network shape is a bit like...

    [Mac_wlan]    # Host hardware
       | ^
       v |
    [VMs_vEth]    # Virtualized interface
       | ^
       v |
    [VPN_tun0]    # Within VM of Ubuntu

Names are just placeholders because the question doesn't include it explicitly, so some translation will be required yet again.

And no LaTeX/Mathjax support here so can't really make the above any prettier.

... if so then you've got a firewall at the Host level Mac_wlan that'll need to be configured to allow traffic forwarded out of VMs_vEth, then within the VMs instance of VMs_vEth (which may be renamed within the Guest OS) the firewall there will have to be configured to allow traffic forwarded out of the VPN_tun0 interface, and each layer should allow established (and in some cases related) connections the other direction.

If ya edit your question with more info, scrubbed of course of anything sensitive, for example the guest OS's /etc/NetworkManager/system-connections connection profiles, and what your VPN configs sorta look like, it will help those that wish to provide ya with a more complete answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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