# list all connections nmcli con nmcli con show --active | grep -i vpn # show connection details nmcli con show 'MY_CONNECTION_1' # start vpn from command line (ubuntu) nmcli con up id VPN_NAME nmcli dev wifi list # create wifi configuration SSID="FRITZ!Box 5960" PASS=00011090700208423311 nmcli con add con-name "${SSID}" ifname wlan0 type wifi ssid "${SSID}" nmcli con modify "${SSID}" wifi-sec.key-mgmt wpa-psk nmcli con modify "${SSID}" wifi-sec.psk "${PASS}" nmcli con up "${SSID}" # test: bounding nmcli con add type bond con-name bond1 ifname bond1 mode 802.3ad ipv4 179.254.0.2/16 nmcli con mod id bond1 bond.options mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer2+3 nmcli con mod id bond1 802-3-ethernet.mtu 9000 nmcli con add type bond-slave ifname p5p1 con-name p5p1 master bond1 nmcli con add type bond-slave ifname p5p1 con-name p5p2 master bond1 # disable autoconnect nmcli connection modify wg0 autoconnect no
Autostart delayed VPN connection
# /home/foo/.config/autostart/vpn.desktop [Desktop Entry] Type=Application Exec=nmcli con up VPN1 Hidden=false NoDisplay=false X-GNOME-Autostart-Delay=3 X-GNOME-Autostart-enabled=true Name=Auto connect to VPN1
Links
https://developer.gnome.org/NetworkManager/stable/nmcli-examples.html
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Using_the_NetworkManager_Command_Line_Tool_nmcli.html
https://www.mankier.com/7/nmcli-examples