Skip to content

Instantly share code, notes, and snippets.

@goromlagche
Created October 26, 2023 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goromlagche/b67c2d796e901de1e8c71334b66401bc to your computer and use it in GitHub Desktop.
Save goromlagche/b67c2d796e901de1e8c71334b66401bc to your computer and use it in GitHub Desktop.
setup vpn using nmcli
nmcli connection import type openvpn file your-connection.ovpn
nmcli connection modify your-connection +vpn.data username=your-user-name
nmcli connection modify your-connection ipv4.never-default true
nmcli connection up your-connection passwd-file passwd-file
# To list all VPN connections
nmcli connection show --active | grep vpn
# To connect to the VPN
nmcli connection up your-connection passwd-file passwd-file
# content of passwd-file
# ----------------------
# vpn.data.username=your-user-name
# vpn.secrets.password=your-password
# ----------------------
# To disconnect from the VPN
nmcli connection down your-connection
# To delete the VPN connection
nmcli connection delete your-connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment