<div dir="ltr">Hi all,<br><br>I am testing vpn connection from a windows client behind a NAT to a publicly accessible server running libreswan 3.16. When the initiator request reaches libreswan the source address is not 500 because of the NAT. But even so, libreswan still responds to port 500. This is of course dropped by the NAT since it doesn't have a clue how to forward this.<br><br>Check this tcpdump<br>16:05:17.182210 IP natIP.12286 > libreswanIP.500: isakmp: parent_sa ikev2_init[I]<br>16:05:17.183377 IP libreswanIP.500 > natIP.500: isakmp: parent_sa ikev2_init[R]<br>16:05:19.182310 IP natIP.12286 > libreswanIP.500: isakmp: parent_sa ikev2_init[I]<br>16:05:19.183145 IP libreswanIP.500 > natIP.500: isakmp: parent_sa ikev2_init[R]<br><br><br>I would expect libreswan to respond to port 12286 instead of 500.<br><br>I also looked this up in the RFC (rfc 7296)<br>It is a common practice of NATs to translate TCP and UDP port numbers<br>as well as addresses and use the port numbers of inbound packets to decide which internal node should get a given packet. For this<br>reason, even though IKE packets MUST be sent to and from UDP port 500 or 4500, they MUST be accepted coming from any port and responses MUST be sent to the port from whence they came. This is because the ports may be modified as the packets pass through NATs. Similarly, IP addresses of the IKE endpoints are generally not included in the IKE payloads because the payloads are cryptographically protected and could not be transparently modified by NATs. <br><br>Is this a bug in libreswan? Or am I missing something? A configuration option?<br><br>Regards,<br>Fabian van der Werf<br></div>