Sample Header Ad - 728x90

How to set a VPN connection in nmcli?

5 votes
2 answers
19774 views
I want to use nmcli to connect to a VPN that I typically use Cisco Annyconnect for. I've installed networkmanager-openconnect package (in Arch) and now I want to use it through nmcli. However, nmcli interface seems too convoluted for me. Looking at nmcli c add help, it should be something along these lines:
Usage: nmcli connection add { ARGUMENTS | help }

ARGUMENTS := COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- ([+|-]. )+]
with:
TYPE_SPECIFIC_OPTIONS:
...
    vpn:          vpn-type vpnc|openvpn|pptp|openconnect|openswan|libreswan|ssh|l2tp|iodine|...
                  [user ]
But the explanation in the help message is too terse for me and I could not find any examples online. **Can anyone who uses nmcli for similar purposes share their examples here?** ---------- **Failed attempts** There is an example configuration here . Exploring the available man pages I did not find what form:main:group_list=CLIENTGROUP even suppose to do. Fails with:
Error: Connection activation failed: No valid secrets
---------- For those who look for the simplest possible option; you can use openconnect directly:
sudo openconnect my.vpn.gateway
And that works as long as you don't need to make it available for a non-sudoer. When that happens, the plot gets complicated around name resolution (see here ). I would prefer nmcli to handle this.
Asked by yujaiyu (259 rep)
May 19, 2022, 12:32 AM
Last activity: Dec 19, 2022, 04:14 PM