Skip to content

Instantly share code, notes, and snippets.

@ndgnuh
Created January 22, 2022 04:59
Show Gist options
  • Save ndgnuh/efa32f1c45857aba2b111a9e8ea12b52 to your computer and use it in GitHub Desktop.
Save ndgnuh/efa32f1c45857aba2b111a9e8ea12b52 to your computer and use it in GitHub Desktop.
New L2TP Connection profile
#!/bin/sh
# https://askubuntu.com/questions/1167283/l2tp-connection-client-on-ubuntu-18-04-server
VPNDATA="
gateway = [ipv4],
ipsec-enabled = yes,
ipsec-psk = 0s"$(base64 <<<'[PSK]' | rev | cut -c2- | rev)"=,
mru = 1400,
mtu = 1400,
password-flags = 0,
refuse-chap = yes,
refuse-mschap = yes,
refuse-pap = yes,
require-mppe = yes,
user = [user]"
nmcli connection add\
connection.id [vpnName] \
con-name [vpnName] \
type VPN vpn-type l2tp \
ifname \
-- connection.autoconnect no \
ipv4.method auto \
vpn.data "$VPNDATA" \
vpn.secrets password=[user-password]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment