Sorry if this is the wrong place to post. Something’s wrong with my configuration and I don’t know what.
I’m trying to create an ipsec tunnel between a RouterBoard and a CentOS box (running libreswan), the latter of which is behind a NAT.
The physical network is A ↔ B ↔ C ↔ D. A, C, and D are CentOS systems; B is a RouterBoard. I am trying to establish a tunnel so that ‘A’ can communicate with ‘D’. ‘C’ is configured to forward UDP ports 500 and 4500 to ‘D’.
Also, the RouterBoard has another IPsec tunnel (to a different remote network) already active and working correctly.
From what I can tell, the IKE negotation works correctly and an SA is established for each direction, but the RouterBoard then does not actually forward any packets.
When I run ‘ping A’ on D:
- I see encrypted UDP packets (port 4500) being sent from C to B.
- On B, there is an ‘input’ firewall rule to accept UDP packets from C to port 4500. I see the packet count increasing.
- On B, there is a ‘forward’ firewall rule to accept ICMP packets to A. This packet count does not change.
- No packets actually arrive at A.
When I run ‘ping D’ on A:
- I see unencrypted ICMP packets being sent from A to B.
- On B, there is a ‘forward’ firewall rule to accept ICMP packets from A. I see the packet count increasing.
- On B, a “larval” SA appears in the list. (In addition to the two “mature” SAs that were already there.) After a minute or so, this disappears.
- No packets arrive at C (or D), except for periodic “keep-alive” packets.
How can I figure out what is happening to outgoing packets? The RouterBoard’s firewall is accepting them, and presumably the IPsec policy I defined is being applied, but once that happens, the RouterBoard… doesn’t recognize that it already has an SA? Or doesn’t believe that the SA should apply to that packet? And decides it wants to create a new SA, but doesn’t actually send any IKE packets to the other end?
How can I figure out what is happening to incoming packets? The sender is encrypting them according to (what it believes is) a valid SA, and the RouterBoard’s firewall accepts the encrypted packets, but then… it doesn’t believe they’re encrypted correctly? Or doesn’t know what to do with them after decrypting them, so drops them on the floor? Or sends them out the wrong interface? How can I figure out what it’s doing?