In order to support Differentiated Services (DiffServ), two parallel IPsec connections between the subnets behind the gateways moon and sun are set up. Using XFRM marks one IPsec SA is designated for Best Effort (BE) traffic and the second SA for Expedited Forwarding (EF) traffic. To guarantee that the CHILD_SA with the correct mark is selected on the responder side, labels are used and negotiated via IKEv2. The authentication is based on X.509 certificates.

Upon the successful establishment of the IPsec tunnel, the updown script automatically inserts iptables-based firewall rules that let pass the tunneled traffic In order to test both tunnel and firewall, client alice behind gateway moon pings client bob located behind gateway sun.