IKEv2 Cisco ASA and strongSwan

In this lesson we’ll take a look at how to configure an IPsec IKEv2 tunnel between a Cisco ASA Firewall and a Linux strongSwan server.

strongSwan is an IPsec VPN implementation on Linux which supports IKEv1 and IKEv2 and some EAP/mobility extensions. It’s well documented, maintained and supports Linux kernels 3.x and later.

Here’s the topology:

IKEv2 topology with strongSwan server and ASA1 connected through the OUTSIDE network 10.10.10.0/24, R1 behind strongSwan and R2 behind ASA1Above we have a small network with 4 devices. On the left side we have our strongSwan server, on the other side a Cisco ASA firewall. I’m using two routers called R1 and R2 as “hosts” so we have something to test the VPN. I’m using an Ubuntu 24.04 LTS server running strongSwan 5.9 and a Cisco ASAv firewall running ASA 9.24. Let’s start with the strongSwan configuration!

strongSwan Configuration

strongSwan is in the default Ubuntu repositories so installing it is very simple. The strongswan package installs the legacy starter with the ipsec command and the ipsec.conf file. These are deprecated, so we’ll install the packages for swanctl instead:

# apt install strongswan-swanctl charon-systemd libstrongswan-extra-plugins

The charon-systemd package contains the IKE daemon and the strongswan systemd service, strongswan-swanctl contains the swanctl command. If you skip libstrongswan-extra-plugins, swanctl prints a “plugin … failed to load” line for each plugin it can’t find. When I tested this, these messages were harmless and swanctl loaded the configuration anyway.

The main configuration is done in the swanctl.conf file. By default, /etc/swanctl/swanctl.conf includes all files in the /etc/swanctl/conf.d directory so we’ll create a new file there. Open your favorite text editor:

# vim /etc/swanctl/conf.d/ciscoasa.conf

This is what the configuration should look like:

connections {
    ciscoasa {
        version = 2
        local_addrs = 10.10.10.1
        remote_addrs = 10.10.10.2
        proposals = aes256-sha256-modp2048
        rekey_time = 1440m
        local {
            auth = psk
            id = 10.10.10.1
        }
        remote {
            auth = psk
            id = 10.10.10.2
        }
        children {
            ciscoasa {
                local_ts = 192.168.1.0/24
                remote_ts = 192.168.2.0/24
                esp_proposals = aes256-sha256
                rekey_time = 60m
                start_action = trap
            }
        }
    }
}

secrets {
    ike-ciscoasa {
        id-1 = 10.10.10.1
        id-2 = 10.10.10.2
        secret = "networklessons"
    }
}

Let’s discuss these parameters so you know what we are dealing with. Everything under “connections” belongs to our connection called “ciscoasa”:

  • version = 2: We want to use IKEv2 for this connection.
  • local_addrs = 10.10.10.1: This is the IP address of strongSwan that we want to use for the IPsec VPN.
  • remote_addrs = 10.10.10.2: The IP address of the Cisco ASA Firewall.
  • proposals = aes256-sha256-modp2048: The security parameters for IKE Phase 1, in this example we use AES 256-bit, SHA-256 and Diffie-Hellman (DH) group 14. modp2048 is the 2048-bit DH group, which is group 14.
  • rekey_time = 1440m: This is when strongSwan rekeys the IKE Phase 1 SA. 1440 minutes equals 86400 seconds (1 day). This is a common value and also the default lifetime on our Cisco ASA Firewall. The strongSwan default is 4 hours.
  • local: how strongSwan authenticates itself. We use a pre-shared key (auth = psk) and the IP address as the identity. This can be an IP address or a FQDN.
  • remote: how the Cisco ASA Firewall should authenticate. We also use a pre-shared key and the IP address of the ASA as the identity.

Under “children” we configure the IPsec SA, also called “ciscoasa”:

  • local_ts = 192.168.1.0/24: The subnet behind strongSwan that we want to reach through the VPN.
  • remote_ts = 192.168.2.0/24: The subnet behind the Cisco ASA Firewall.
  • esp_proposals = aes256-sha256: We use ESP, AES 256-bit and SHA-256 for Phase 2. There is no DH group in this proposal so we don’t use Perfect Forward Secrecy (PFS). Our ASA crypto map doesn’t use PFS either.
  • rekey_time = 60m: This is when strongSwan rekeys the IKE Phase 2 (IPsec) SA. Default strongSwan value is 60 minutes. The default IPsec SA lifetime on our Cisco ASA Firewall is 28800 seconds (8 hours). The lifetimes don’t have to match, each side rekeys based on its own value. strongSwan rekeys a bit before the configured time, it subtracts a random value of up to 10% by default. This is a local value, it doesn’t have to match with the other side.
  • start_action = trap: This means that strongSwan installs a trap policy in the kernel. As soon as there is traffic that should go through the tunnel, strongSwan builds the tunnel. The default is “none”, which means strongSwan won’t build the tunnel by itself. It responds when the Cisco ASA initiates the tunnel, or you can start it manually with swanctl --initiate. If you set it to “start” then strongSwan builds the tunnel as soon as the configuration is loaded.

The “secrets” section contains our pre-shared key. IKEv2 allows us to use a different pre-shared key for each peer, to keep it simple we’ll use the same key on both sides. The key is used for both IDs, id-1 for strongSwan and id-2 for the Cisco ASA Firewall.

There’s still one thing left to do…by default, Ubuntu (or most Linux distributions) will not act as a router…it won’t forward IP packets from one interface to another. To enable this you have to use the following command:

# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1

Forwarding is now activated. If you want to enable this at boot then you should add it to the sysctl.conf file. You can do it like this:

# echo "net.ipv4.ip_forward = 1" | tee -a /etc/sysctl.conf
net.ipv4.ip_forward = 1

Everything is now in place for strongSwan. Let’s restart the strongswan service:

# systemctl restart strongswan

Let’s check if it’s running:

# systemctl status strongswan --no-pager -l
● strongswan.service - strongSwan IPsec IKEv1/IKEv2 daemon using swanctl
     Loaded: loaded (/usr/lib/systemd/system/strongswan.service; enabled; preset: enabled)
     Active: active (running) since Fri 2026-11-20 14:54:41 UTC; 460ms ago
    Process: 2204 ExecStartPost=/usr/sbin/swanctl --load-all --noprompt (code=exited, status=0/SUCCESS)
   Main PID: 2183 (charon-systemd)
     Status: "charon-systemd running, strongSwan 5.9.13, Linux 6.8.0-101-generic, x86_64"
      Tasks: 17 (limit: 2316)
     Memory: 3.6M (peak: 6.6M)
        CPU: 23ms
     CGroup: /system.slice/strongswan.service
             └─2183 /usr/sbin/charon-systemd

Nov 20 14:54:41 strongswan charon-systemd[2183]: spawning 16 worker threads
Nov 20 14:54:41 strongswan charon-systemd[2183]: loaded IKE shared key with id 'ike-ciscoasa' for: '10.10.10.1', '10.10.10.2'
Nov 20 14:54:41 strongswan charon-systemd[2183]: added vici connection: ciscoasa
Nov 20 14:54:41 strongswan charon-systemd[2183]: installing 'ciscoasa'
Nov 20 14:54:41 strongswan swanctl[2204]: loaded ike secret 'ike-ciscoasa'
Nov 20 14:54:41 strongswan swanctl[2204]: no authorities found, 0 unloaded
Nov 20 14:54:41 strongswan swanctl[2204]: no pools found, 0 unloaded
Nov 20 14:54:41 strongswan swanctl[2204]: loaded connection 'ciscoasa'
Nov 20 14:54:41 strongswan swanctl[2204]: successfully loaded 1 connections, 0 unloaded
Nov 20 14:54:41 strongswan systemd[1]: Started strongswan.service - strongSwan IPsec IKEv1/IKEv2 daemon using swanctl.

The service is running and it loads our configuration with swanctl --load-all when it starts. When you change the configuration later, you can load it again without restarting the service:

# swanctl --load-all
loaded ike secret 'ike-ciscoasa'
no authorities found, 0 unloaded
no pools found, 0 unloaded
loaded connection 'ciscoasa'
successfully loaded 1 connections, 0 unloaded

Now we can work on the Cisco ASA…

Cisco ASA Configuration

In a previous lesson I covered the configuration of IKEv2 IPsec VPN between two Cisco ASA firewalls so I won’t explain all commands one by one again. First we’ll configure the interfaces:

ASA1(config)# interface GigabitEthernet0/0
ASA1(config-if)# no shutdown
ASA1(config-if)# nameif INSIDE
ASA1(config-if)# ip address 192.168.2.254 255.255.255.0
ASA1(config)# interface GigabitEthernet0/1
ASA1(config-if)# no shutdown
ASA1(config-if)# nameif OUTSIDE
ASA1(config-if)# ip address 10.10.10.2 255.255.255.0

Now we can configure the VPN settings. Let’s start with the IKEv2 policy:

Sign up for FREE to Get Started

Here's what you'll get:

  • Full Access to 448 lessons.
  • Learn CCNA, CCNP and CCIE R&S. Explained as simple as possible.
  • Unlock Access to this lesson + 424 more by becoming a member.
  • New Lessons Added Regularly. You'll Be the First to Know.
  • Content created by Rene Molenaar (CCIE #41726)

Takes 1 minute - No credit card needed

Tags: , , ,


Forum Replies

  1. Avatar for dredb71 dredb71 says:

    Thanx Rene,
    This a very clear manual. Gonna use it right away…

    Andre

  2. Avatar for lucfilion lucfilion says:

    Thanks rené,

    My present configuration is quite the same but I don’t have (yet) a subnet under the strongswan platform (this may come later).
    So I would like to configure the VPN and test it (ping, scp…) directly with the strongwan plateform and not with its subnet.
    What should I change in your configuration for it ?
    Thanks again.

  3. Avatar for ReneMolenaar ReneMolenaar says:

    Hello Luc,

    In this case, you might want to test to configure strongSwan as a remote client perhaps.

    First I would try to configure a Cisco router as the VPN server and use a Cisco client. Here’s an example:

    https://networklessons.com/mis...vpn-configuration

    Once this is working, see if you can replace the client with Strongswan:

    https://www.strongswan.org/tes.../ikev1/xauth-psk/

    Rene

  4. Avatar for chriscowboyfann chriscowboyfann says:

    Rene,

    How are you using the Ubuntu server with the strongswan on it. Is it in a laptop or do you have a server. Reason for asking is I am wondering how you got the two ports. Maybe you could point me in the right direction on how to set my lab up. thank you

  5. Avatar for ReneMolenaar ReneMolenaar says:

    Hi Cristopher,

    I use a HP proliant DL360 G7 with a quad NIC running VMware ESXi. Using virtual machines is a great way to test things like this. You can also use a single physical connection from your VMware server to your switch and then configure it as a trunk. Each virtual NIC in your virtual machine can then use a different VLAN.

    Rene

16 more replies! Ask a question or join the discussion by visiting our Community Forum