Install L2TP Client di ubuntu server CLI

Tambahkan repository

sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp

Update repository

sudo apt update

Install network-manager-l2tp

sudo apt install network-manager-l2tp

Ubah parameter [ifupdown] managed=false menjadi managed=true

sudo nano /etc/NetworkManager/NetworkManager.conf

Menjadi

[ifupdown]
managed=true

Restart service NetworkManager

sudo systemctl restart NetworkManager

Ubah pengelola jaringan menjadi NetworkManager dengan cara

Edit Konfigurasi 00-installer-config.yaml, direkomendasikan menyalin terlebih dahulu file original nya

sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.original

Lalu edit

sudo nano /etc/netplan/00-installer-config.yaml

Isikan Seperti berikut

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp0s3:
      dhcp4: yes
    config:
      dhcp4: yes

*Catatan: Ubah paramter enp0s3 sesuai dengan nama interface yang kamu gunakan bisa dilihat dengan mengetikkan perintah

ip address

Simpan dan aktifkan konfigurasi

sudo netplan apply

Buat agar Network-Manager bisa mengelola interface

sudo nmcli device set enp0s3 managed yes

Restart service NetworkManager

sudo systemctl restart NetworkManager

Lihat status device

sudo nmcli device status

Pastikan ouput yang keluar pada interface fisik nya connected

DEVICE  TYPE      STATE      CONNECTION     
enp0s3  ethernet  connected  netplan-enp0s3 
lo      loopback  unmanaged  --             
ppp0    ppp       unmanaged  --             

Lalu jalankan perintah berikut untuk membuat koneksi L2TP

sudo nmcli connection add connection.id [vpnName] con-name [conName] type VPN vpn-type l2tp ifname -- connection.autoconnect no ipv4.method auto vpn.data "gateway = [ipv4], ipsec-enabled = yes, mru = 1400, mtu = 1400, password-flags = 0, refuse-chap = yes, refuse-mschap = yes, refuse-pap = yes, require-mppe = yes, user = [user]" vpn.secrets "password=[user-password], ipsec-psk = [PSK]"

Perintah membuat koneksi tanpa IPSec PSK

sudo nmcli connection add connection.id [vpnName] con-name [conName] type VPN vpn-type l2tp ifname -- connection.autoconnect no ipv4.method auto vpn.data "gateway = [ipv4], ipsec-enabled = no, mru = 1400, mtu = 1400, password-flags = 0, refuse-chap = yes, refuse-mschap = yes, refuse-pap = yes, require-mppe = yes, user = [user]" vpn.secrets "password=[user-password]"

Ubah parameter berikut dan hilangkan tanda [ ]

  • [vpnName] = Nama VPN (bebas)
  • [conName] = Nama koneksi (bebas)
  • [ipv4] = Alamat IP server VPN
  • ipsec-enabled = yes jika menggunakan IPSec atau no Jika tidak menggunakan IPSec
  • [user] = User VPN
  • [user-password] = Password VPN
  • [PSK] = IPSec Secret (jika menggunakan IPSec)

Perintah untuk mengaktifkan koneksi VPN

sudo nmcli connection up namakoneksiVPN[conName]

Perintah untuk menonaktifkan koneksi VPN

sudo nmcli connection down namakoneksiVPN[conName]

Keterangan:

Tested on: Ubuntu Server 22.04
Sumber/referensi:
https://askubuntu.com/questions/1167283/l2tp-connection-client-on-ubuntu-18-04-server

https://unix.stackexchange.com/questions/438224/networkmanager-fails-with-could-not-find-source-connection