Skip to content

Instantly share code, notes, and snippets.

@mwyau
Last active March 4, 2019 18:19
Show Gist options
  • Select an option

  • Save mwyau/7df7060f995bc1396af0c83f339654cc to your computer and use it in GitHub Desktop.

Select an option

Save mwyau/7df7060f995bc1396af0c83f339654cc to your computer and use it in GitHub Desktop.
Ubuntu 18.04 L2TP/IPSec VPN

Ubuntu 18.04 L2TP/IPSec VPN

  • Install network-manager-l2tp-gnome

    $ sudo apt install network-manager-l2tp-gnome

  • Add the L2TP connection in Network Manager and set the Pre-shared key, Phase1 and Phase2 Algorithms:

    Phase1 Algorithms : 3des-sha1-modp1024

    Phase2 Algorithms : 3des-sha1

  • Disable and stop the system xl2tpd:

    $ sudo systemctl disable xl2tpd

    $ sudo systemctl stop xl2tpd

  • If you lost internet after disconnecting from VPN, use the following script to fix the permission:

    $ sudo vim /etc/NetworkManager/dispatcher.d/02-fixresolvconf.sh

    $ sudo chmod 755 02-fixresolvconf.sh

    #!/bin/sh -e
    # Fix the permission of systemd-resolved resolv.conf after disconnected from
    # VPN in Ubuntu 18.04
    if [ "$2" = "vpn-down" ]; then
      chmod 644 /run/systemd/resolve/stub-resolv.conf
      chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf
    fi
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment