[strongSwan] High availability configuration

Noel Kuntze noel at familie-kuntze.de
Sat Feb 21 19:52:18 CET 2015

Hash: SHA256

Hello Aleksey,

Currently, strongSwan only supports high-availability in an active-active cluster.
However, you can abuse it and make it active-passive by simply not using
a multicast mac address and configuration on the the CLUSTERIP rule on the
devices. That way, the SAs will be synchronized, but traffic will only be forwarded to
one member of the cluster. Failover of the IP needs to be done by a cluster executive.
Propagating the new MAC address of the IP needs to be done either by the kernel
or the cluster executive. After the IP is assigned to the former passive and now active
member, it will process the traffic.

In an active-active configuration, the multicast mac address would ensure that the traffic traffic is
always received by both nodes. A hash function over the layer three address would decide which host
processes it. However, be aware that I had problems with multicast mac addresses with some newer Juniper switches.
They do not seem to handle those addresses and forwarding the traffic correctly.

Why do you want to use a CLUSTERIP rule two times on the same node? That doesn't make any sense.

The documents only mention IKEv2, but I think that IKEv1 works, too.

Currently, it is not possible to make a tunnel depend on the state of another tunnel,
however, you can leverage marks in netfilter to choose what policies match the traffic.
For this, see the mark match module and target on the man page for iptables-extensions
and mark, mark_in and mark_out on the ipsec.conf and swanctl.conf man pages,
as well as my email to this list on 2014-11-25[1]. Using this, you can have to active tunnels to the same subnets
and use marks to match the tunnel you want to use. Failover can be handled by strongswan through
use of short dpdtimeouts and retransmission values. Reestablishement of the tunnels can be done by it, too,
through use of dpdaction. I do not know if this plays nice with auto=route.

A cluster executive that would support most needed features would be corosync[2].

[1] https://lists.strongswan.org/pipermail/users/2014-November/006942.html
[2] https://corosync.github.io/corosync/

Mit freundlichen Grüßen/Regards,
Noel Kuntze

GPG Key ID: 0x63EC6658
Fingerprint: 23CA BB60 2146 05E7 7278 6592 3839 298F 63EC 6658

Am 20.02.2015 um 16:04 schrieb unite:
> Hi guys!
> I have a couple of questions regarding stronswan HA configuration.
> I have the following topology:
> I have two debain wheezy nodes running the 5.2.1 strongswan installed from backports and 3.16 kernel also installed from wheezy backports. Here is the part of "ipsec statusall" ouput:
> ipsec statusall
> Status of IKE charon daemon (strongSwan 5.2.1, Linux 3.16.0-0.bpo.4-amd64, x86_64)
> My two nodes receive routes from 2 ISPs using bgp. So both nodes are running quagga and ISP's router is configured to operate with two neighbors in my AS. The addressing between my external interfaces and the first ISPs gateway (on which BGP relations are held) is for example ( - ISP gateway, - my cluster node1, - node2). Addressing for the second let's assume is in net. My AS is bound to net for example and I have for example vlan 50 which contains these addresses.
> So, for maximum reachability, I would like to configure strongswan to use the source ip from my AS net, for example -, so all tunnels would be initiated from this IP and even if one ISP fails my tunnels are still reacheble. However, is that possible to configure strongswan in HA mode using such a configuration? So, I see two possible ways how it theoretically might work:
> 1) in active/standby configuration - when for example all bgp traffic will be held by node1 - so ISP gateways forward traffic to node1 of my cluster, it receives VPN packets for destination and decrypts them and so on. So in this setup all traffic will be received by node1. If I want to have high availability does the configuration differ from the simple one? Will the SA's be synchronized and will failover work correctly when only one node receives 100% of the traffic, and also at this time no multicast is used (all traffic is received by the node1, both nodes have address so it won't forward it also to node2)?
> 2) in active/active configuration - if I configure my nodes to send virtual next-hop address to ISP routers. In this way both nodes will receive connection in round robin fashion however, multivast still won't be used - will this solution work correctly, will SA's be correctly synchronized and so on?
> Also for both cases (if they should work at all)  I believe I need to make some unusual clusterip rule. So if the address could be reached directly from ISP, the clusterip rule would have been like this:
> ifconfig vlan50:0 up
> iptables -A INPUT -i vlan50 -d -j CLUSTERIP --new --total-nodes 2 --local-node 1
> but assuming I have this configration I guess I need to change the incoming interface to the one, on which packets from ISPs are received while the address still belongs to vlan50. For example
> ifconfig vlan50:0 up
> iptables -A INPUT -i eth0 -d -j CLUSTERIP --new --total-nodes 2 --local-node 1
> iptables -A INPUT -i eth1 -d -j CLUSTERIP --new --total-nodes 2 --local-node 1
> Am I right? Won't it cause any problems?
> Also, should I anyway patch 3.16 kernel or the needed patch for clusterip+strongswan is included in it?
> Also, did I understand correctly, strongswan can only use HA mode if IKEv2 is used for the tunnel?
> Another question, is there a way to have redundant tunnels? So, what do i mean - I have two tunnels two different peers, though they link the same subnets. Tunnel is built with one peer, however if it becomes unavailable another tunnel should automatically be brought up. Is this possible using strongswan utilities?
> Thanks in advance.

Version: GnuPG v2


More information about the Users mailing list