Skip to main content
eng
New Member
May 28, 2020
Question

How to connect to IPsec VPN in Ubuntu Server 18.04

  • May 28, 2020
  • 2 replies
  • 6077 views

Hello,

 

I've been trying to connect to my VPN using an Ubuntu Server today, but I can't seem to be able to get it working. A lot of the advice I found online either didn't work or was outdated. 

 

Does anyone know of a Step by Step guide which actually works?

 

Thanks

    2 replies

    eng
    engAuthor
    New Member
    May 29, 2020

    Ok - I managed to do it after a lot of perseverance and effort! I'll post my answer soon for future visitors.

    eng
    engAuthor
    New Member
    May 29, 2020

    Here's how I managed to do it:

     

    cat /etc/ipsec.conf


    config setup
            # strictcrlpolicy=yes
            # uniqueids = no
            charondebug="dmn 2, mgr 2, ike 2, chd 2, job 2, cfg 2, knl 2, net 2, enc2, lib 2"

    conn ug_vpn
        fragmentation = yes
        keyexchange = ikev1
        aggressive = yes
        reauth = yes
        forceencaps = no
        mobike = no
        rekey = yes
        installpolicy = yes
        type = tunnel
        #type = passthrough
        dpdaction = restart
        dpddelay = 10s
        dpdtimeout = 60s
        ikelifetime = 14400s
        lifetime = 3600s

        auto=start
        dpdaction=hold
        closeaction=hold

        left = %defaultroute
        leftauth = psk
        leftauth2 = xauth
        leftsourceip = %config
        leftid = %<MY_LOCALID>
        xauth_identity=<MY_USERNAME>
        right = <MY_FORTIGATE_IP>
        rightid = %<MY_LOCALID>
        # route all trafic via this tunnel
        rightsubnet = 0.0.0.0/0
        rightauth = psk

        ike=aes128-sha1-modp1536!
        esp=aes128-sha1-modp1536!

     

    cat /etc/ipsec.secrets

     

    <MY_USERNAME> : XAUTH "<MY_PASSWORD>"
    <MY_USERNAME> <MY_FORTIGATE_IP> : PSK "<MY_SECRET_KEY>"

     

    ipsec up ug_vpn

     

    I hope this helps somebody :)

    sw2090
    SuperUser
    SuperUser
    June 2, 2020

    thanks so far. I am interested in this too. Thus I'd like to addidionally have support for split tunneling.

    But might give it some try if I find the time to.

    shehab
    New Member
    June 12, 2020

    Do you mean installing Forticlient on Ubuntu?