Date: Wed, 26 Jul 2017 13:20:23 +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: <2672efbc-49f2-efba-07d6-feeb5c8e3757@yandex.ru> In-Reply-To: <3a7d5a5b-3b72-4cfe-2d8e-c832f7bfab5c@spam-fetish.org> References: <459d59f7-2895-8aed-d547-be46a0fbb918@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> <454ed1b7-a80f-b096-cfa1-3c32d1e60f7d@yandex.ru> <f4c5a11c-a329-d746-ece8-e3752a6c82ea@spam-fetish.org> <5dfdfbb3-1046-5abe-b23a-b62c215b5d08@yandex.ru> <ada882bb-7344-49c5-0e47-e1432f27f1c9@spam-fetish.org> <860b48aa-b99e-7b71-3724-587ee0a7fe80@spam-fetish.org> <1b831b84-1d3f-38cb-acee-07a339315417@yandex.ru> <0bbf5bb9-8089-f9ce-3b1d-e9bcbdbc6c76@spam-fetish.org> <e870fe5e-431c-49b6-5960-123d0c7be0a9@yandex.ru> <3a7d5a5b-3b72-4cfe-2d8e-c832f7bfab5c@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) --KTku6E83IiNAwI8fFTSlIMxH5QMdS3WaB Content-Type: multipart/mixed; boundary="Uwkop2JDIUdsxAMKW56xT5iwUQCK7AK7f"; protected-headers="v1" From: "Andrey V. Elsukov" <bu7cher@yandex.ru> To: "Muenz, Michael" <m.muenz@spam-fetish.org>, freebsd-net@freebsd.org Message-ID: <2672efbc-49f2-efba-07d6-feeb5c8e3757@yandex.ru> Subject: Re: NAT before IPSEC - reply packets stuck at enc0 References: <459d59f7-2895-8aed-d547-be46a0fbb918@spam-fetish.org> <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> <454ed1b7-a80f-b096-cfa1-3c32d1e60f7d@yandex.ru> <f4c5a11c-a329-d746-ece8-e3752a6c82ea@spam-fetish.org> <5dfdfbb3-1046-5abe-b23a-b62c215b5d08@yandex.ru> <ada882bb-7344-49c5-0e47-e1432f27f1c9@spam-fetish.org> <860b48aa-b99e-7b71-3724-587ee0a7fe80@spam-fetish.org> <1b831b84-1d3f-38cb-acee-07a339315417@yandex.ru> <0bbf5bb9-8089-f9ce-3b1d-e9bcbdbc6c76@spam-fetish.org> <e870fe5e-431c-49b6-5960-123d0c7be0a9@yandex.ru> <3a7d5a5b-3b72-4cfe-2d8e-c832f7bfab5c@spam-fetish.org> In-Reply-To: <3a7d5a5b-3b72-4cfe-2d8e-c832f7bfab5c@spam-fetish.org> --Uwkop2JDIUdsxAMKW56xT5iwUQCK7AK7f Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 26.07.2017 12:47, Muenz, Michael wrote: > When I type setkey -PD I get: >=20 > 10.24.66.0/24[any] 10.26.1.0/24[any] any > in ipsec > esp/tunnel/81.24.74.3-213.244.192.191/unique:2 > created: Jul 26 11:03:53 2017 lastused: Jul 26 11:40:02 2017 > lifetime: 9223372036854775807(s) validtime: 0(s) > spid=3D5 seq=3D1 pid=3D4292 > refcnt=3D1 > 10.26.1.0/24[any] 10.24.66.0/24[any] any > out ipsec > esp/tunnel/213.244.192.191-81.24.74.3/unique:2 > created: Jul 26 11:03:53 2017 lastused: Jul 26 11:40:02 2017 > lifetime: 9223372036854775807(s) validtime: 0(s) > spid=3D6 seq=3D0 pid=3D4292 > refcnt=3D1 >=20 >=20 > So it's in use. >=20 > But when I type in your command it just "hangs". Not the system, but th= e > command doesn't get completed. >=20 > root@PB-FW1-FRA:~ # setkey -v -c spdadd -4 10.26.2.0/24 10.24.66.0/24 > any -P out ipsec esp/tunnel/213.244.192.191-81.24.74.3/require ; > <waiting cursor> You need to do it this way: 1. setkey -v -c <press Enter> 2. type the policy specification 3. press Enter and then press ^D # setkey -v -c spdadd -4 10.26.2.0/24 10.24.66.0/24 any -P out ipsec esp/tunnel/213.244.192.191-81.24.74.3/unique:2 ; ^D Also, since your policies uses "unique" level, you need to specify the same level using "unique:N" syntax. Also if it is interesting to you, I patched ipfw_nat to be able specify needed direction. The patch is untested at all :) https://people.freebsd.org/~ae/nat_in_out.diff You need to rebuild ipfw(4) and ipfw_nat(4) kernel modules, and also ipfw(8) binary. With this patch you can use the following commands: ipfw nat 1 config ip 10.26.1.1 log ipfw add 179 nat-out 1 all from 10.26.2.0/24 to 10.24.66.0/24 in recv vtn= et1 ipfw add 179 nat-in 1 all from 10.24.66.0/24 to 10.26.1.1 in recv enc0 or these: ipfw nat 1 config ip 10.26.1.1 log reverse ipfw add 179 nat-in 1 all from 10.26.2.0/24 to 10.24.66.0/24 in recv vtne= t1 ipfw add 179 nat-out 1 all from 10.24.66.0/24 to 10.26.1.1 in recv enc0 Or maybe guys from OpenSense can help with testing. --=20 WBR, Andrey V. Elsukov --Uwkop2JDIUdsxAMKW56xT5iwUQCK7AK7f-- --KTku6E83IiNAwI8fFTSlIMxH5QMdS3WaB 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/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAll4bOcACgkQAcXqBBDI oXqF/Qf+MuC1dSCmhz9Yenv0ygR8/tL3Hx1HQ3k7VbT7Zsm+q2dVY1D+VoSbVIMq COPTADflXhE7mzwIxopEaat262gfg+FOl7XDSR6AK2ZaBUMjG4Iee00KUy4B+YKx Uu+GVx9lqkGablS3wmUPxnhGzDErwPhAafH1qXz5la1//U0JmyMNqM5L9QhNZXJ0 w1FQu4NJHAAbSm0GWCJPTHO+/PN9djd5mkWuu8+1p1b8xU4SCqB82Kjh7TIB1MMm eOdbqFTN4H/+HPR55mHUTs5Hi34776GL4HRq2Nhz6h2OK7aLe9jiADnJtp192076 koi2s1u+bB/b05vhQVu7SlkV1T73Ig== =/AC2 -----END PGP SIGNATURE----- --KTku6E83IiNAwI8fFTSlIMxH5QMdS3WaB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2672efbc-49f2-efba-07d6-feeb5c8e3757>