Commandline L2TP connection?
I'm looking to connect to a L2TP VPN server, from ubuntu commandline. Ubuntu 18.04.
I've already done it via a desktop ubuntu. By which I mean: added l2tp network manager, configured it and connected properly.
For CLI, this guide seems properly explained:
https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/docs/clients.md#configure-linux-vpn-clients-using-the-command-line
I added ike
and esp
to my configuration, but besides that nothing changed.
It fails at the step where it's expected that a new interface ppp0 shows up. When I try adding it, it fails.
Despite running, every command with no error codes, it fails to connect.
What am I doing wrong?
Alternatively you could use the NetworkManager CLI with the nmcli
command.
- list all NM connections:
nmcli con
- bring up VPN connection :
nmcli con up id VPN-Connection-Name
- bring down VPN connection:
nmcli con down id VPN-Connection-Name
Where VPN-Connection-Name is the actual name of the VPN connection as listed in the nmcli con
output.
If you're on the same computer you're already successfully connecting on via the GUI, that should be all you need. If you're on a different machine:
You'll need to copy the corresponding NetworkManager VPN connection profile file which is stored under /etc/NetworkManager/system-connections/
from the desktop Ubuntu to the computer you want to use the command-line.
To pickup the new VPN connection profile file (or even changes to that file if you edit it), issue the following:
nmcli con reload
Be sure to to install network-manager-l2tp
, you won't need the GNOME GUI network-manager-l2tp-gnome
package.
sudo apt install network-manager-l2tp resolvconf