Date: Mon, 24 Jul 2017 20:01:43 +0300 From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: "Muenz, Michael" <m.muenz@spam-fetish.org>, freebsd-net@freebsd.org Subject: Re: NAT before IPSEC - reply packets stuck at enc0 Message-ID: <454ed1b7-a80f-b096-cfa1-3c32d1e60f7d@yandex.ru> In-Reply-To: <1e889acf-49d1-b70f-7097-82e6e4dfabb6@spam-fetish.org> References: <459d59f7-2895-8aed-d547-be46a0fbb918@spam-fetish.org> <a082662c-145e-0132-18ef-083adaa59c33@yandex.ru> <1c0de616-91ff-a6f9-d946-f098bc1a709f@spam-fetish.org> <911903d1-f353-d5d6-d400-d86150f88136@yandex.ru> <2d607e1a-a2c0-0f85-1530-c478962a76cd@spam-fetish.org> <3344e189-cdf0-a2c9-3a2a-645460866f2d@yandex.ru> <1279753e-9ad1-2c02-304e-5001e2bbc82f@spam-fetish.org> <15e6eb38-ef0c-7bfd-5f2c-d2acc8ea1af4@yandex.ru> <cdb7e172-4074-4559-1e91-90c8e9276134@spam-fetish.org> <63e80fcf-915e-2dd5-d8c9-1904c8261c6f@yandex.ru> <1c91cd8f-105d-e886-3126-67505c6c3900@spam-fetish.org> <c738380c-e0cc-2d32-934e-a05502887b93@yandex.ru> <1e889acf-49d1-b70f-7097-82e6e4dfabb6@spam-fetish.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --jvfTDvirmlaJGBPxNr3dhpX7QVijMJoVU Content-Type: multipart/mixed; boundary="IKu0VOrDjIEbXVU5JuGrenKVoaMVI1f5N"; protected-headers="v1" From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: "Muenz, Michael" <m.muenz@spam-fetish.org>, freebsd-net@freebsd.org Message-ID: <454ed1b7-a80f-b096-cfa1-3c32d1e60f7d@yandex.ru> Subject: Re: NAT before IPSEC - reply packets stuck at enc0 References: <459d59f7-2895-8aed-d547-be46a0fbb918@spam-fetish.org> <a082662c-145e-0132-18ef-083adaa59c33@yandex.ru> <1c0de616-91ff-a6f9-d946-f098bc1a709f@spam-fetish.org> <911903d1-f353-d5d6-d400-d86150f88136@yandex.ru> <2d607e1a-a2c0-0f85-1530-c478962a76cd@spam-fetish.org> <3344e189-cdf0-a2c9-3a2a-645460866f2d@yandex.ru> <1279753e-9ad1-2c02-304e-5001e2bbc82f@spam-fetish.org> <15e6eb38-ef0c-7bfd-5f2c-d2acc8ea1af4@yandex.ru> <cdb7e172-4074-4559-1e91-90c8e9276134@spam-fetish.org> <63e80fcf-915e-2dd5-d8c9-1904c8261c6f@yandex.ru> <1c91cd8f-105d-e886-3126-67505c6c3900@spam-fetish.org> <c738380c-e0cc-2d32-934e-a05502887b93@yandex.ru> <1e889acf-49d1-b70f-7097-82e6e4dfabb6@spam-fetish.org> In-Reply-To: <1e889acf-49d1-b70f-7097-82e6e4dfabb6@spam-fetish.org> --IKu0VOrDjIEbXVU5JuGrenKVoaMVI1f5N Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 24.07.2017 18:15, Muenz, Michael wrote: > Here's one packet on enc0: >=20 >=20 > root@PB-FW1-FRA:~ # tcpdump -vni enc0 > tcpdump: listening on enc0, link-type ENC (OpenBSD encapsulated IP), > capture size 262144 bytes > 17:07:41.769313 (authentic,confidential): SPI 0x90b7ba72: IP (tos 0x0, > ttl 63, id 27752, offset 0, flags [none], proto ICMP (1), length 28, ba= d > cksum b72d (->b82d)!) > 10.26.1.1 > 10.24.66.25: ICMP echo request, id 41163, seq 28416, > length 8 > 17:07:41.777223 (authentic,confidential): SPI 0xcaae18f8: IP (tos 0x0, > ttl 58, id 44180, offset 0, flags [none], proto IPIP (4), length 48) > 81.24.74.3 > 213.244.192.191: IP (tos 0x0, ttl 63, id 46327, offset= > 0, flags [none], proto ICMP (1), length 28) > 10.24.66.25 > 10.26.1.1: ICMP echo reply, id 41163, seq 28416, leng= th 8 > 17:07:41.777240 (authentic,confidential): SPI 0xcaae18f8: IP (tos 0x0, > ttl 63, id 46327, offset 0, flags [none], proto ICMP (1), length 28) > 10.26.1.1 > 10.26.1.1: ICMP echo reply, id 33347, seq 28416, length= 8 This does not match with what I expected to see. The reply here should be something like "10.24.66.25 > 10.26.2.N: ICMP echo reply". It seems the problem is with ipfw_nat, that for both directions thinks that packets are inbound and this leads to incorrect translation. Can you modify your IPsec security policies, so outgoing packets from 10.26.2.0/24 will go through the same tunnel? Then you need to modify nat rule: ipfw nat 1 config ip 10.26.1.1 ipfw add 179 nat 1 log ip from 10.26.2.0/24 to 10.24.66.0/24 out xmit enc= 0 ipfw add 179 nat 1 log ip from 10.24.66.0/24 to 10.26.1.1 in recv enc0 --=20 WBR, Andrey V. Elsukov --IKu0VOrDjIEbXVU5JuGrenKVoaMVI1f5N-- --jvfTDvirmlaJGBPxNr3dhpX7QVijMJoVU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAll2J/cACgkQAcXqBBDI oXpZwAf/bq4Dpl4rkS08d3HCag23ZaDYtgjh93Pa9N/CdraPN4z4uFUO0yK67tFr NQ0khLM9l3X7Pvx90xEYsYsc26j9alMtrvL9iYbZTjsFpuU18dDnMVJkEc0QlBPC 6ROoFd8n14CmHeCSaJELc9jvptULpIjgwCAmyhC2ue5jhusXY9IfKE/LGjr5tb6X WpJYLpwXPzZxA8qAL+xFaGl54i7QGCV+/7r60IQYG5JHs9XQOm9bp3H/FvbprQ9c Nq8NAaIad9AhZb0iQBBNjIA4WfPOFAgeHgaYZfWz/qiIpG8lkJ/YakkrKKAIEjTp VyanFVvHqKTcGCqzJ2nRCf9SV/L5hQ== =ZJOU -----END PGP SIGNATURE----- --jvfTDvirmlaJGBPxNr3dhpX7QVijMJoVU--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?454ed1b7-a80f-b096-cfa1-3c32d1e60f7d>