This scenario demonstrates a property of XFRM interfaces that allows moving them into network namespaces while retaining access to IPsec SAs and policies in the original namespace. This enables an IKE daemon in one namespace to provide IPsec tunnels for processes in other namespaces without having to give them access to the keys and IKE credentials.

The gateways use route-based forwarding with XFRM interfaces, with firewall rules to allow traffic to pass. The IPsec traffic selector used is 0.0.0.0/0, however, specific routing is achieved with routes on the XFRM interfaces. The IKE daemon does not install routes for CHILD_SAs with outbound interface ID, so static routes are installed for the target subnets.

The XFRM interface on gateway moon is moved into a new network namespace from which a ping is sent to client bob. It is then moved back out and alice sends another ping to bob to test if that works too.

Gateway sun dynamically creates the XFRM interface via updown script using the passed unique generated interface ID.

Note that the dropped packet seen on the XFRM interface on moon is an IPv6 Router Solicitation (NDP) sent from that namespace, which doesn't match the IPsec policy.