From owner-freebsd-net@freebsd.org Mon Apr 1 03:34:27 2019 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3187D154D78C for ; Mon, 1 Apr 2019 03:34:27 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) Received: from admin.sibptus.ru (admin.sibptus.ru [IPv6:2001:19f0:5001:21dc::10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EE746D73D for ; Mon, 1 Apr 2019 03:34:25 +0000 (UTC) (envelope-from vas@mpeks.tomsk.su) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=Message-ID:Subject:To:From:Date:In-Reply-To; bh=eht7QyaZdrOks5XZ489hHhN1qI64Phg7UjQRmgMERbQ=; b=CqCBUupaUCsnoJpaPXX9EnDTPS vsrdeTPoAuBkulxaOdQIof+0Js+LLWR/KDjKuarfMQGPjNbOW2zhjZvbHA0PYjpBSLgzVji4+L4t5 wE7ctWkRR0WeoeBcMM9YB0FhezV3BOfc+PjI23mwkLGvJWNYmMtFbahqcd2R6zAK3IPA=; Received: from vas by admin.sibptus.ru with local (Exim 4.92 (FreeBSD)) (envelope-from ) id 1hAniK-000OmR-3b for freebsd-net@freebsd.org; Mon, 01 Apr 2019 10:34:24 +0700 Date: Mon, 1 Apr 2019 10:34:24 +0700 From: Victor Sudakov To: freebsd-net@freebsd.org Subject: need help with ipfw nat to pf nat migration Message-ID: <20190401033424.GA95019@admin.sibptus.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0F1p//8PRICkK4MW" Content-Disposition: inline X-PGP-Key: http://www.dreamwidth.org/pubkey?user=victor_sudakov X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 User-Agent: Mutt/1.11.4 (2019-03-13) Sender: Victor Sudakov X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Apr 2019 03:34:27 -0000 --0F1p//8PRICkK4MW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Dear Colleagues, I'm trying to migrate some firewall rules from ipfw to pf. As pf does NAT first and filtering after NAT, I have a problem doing the following: 1. All 192.168.0.0/16 addresses should be translated to the real IP of the external interface. 2. A subset of the 192.168.0.0/16, for example 192.168.3.0/24, should have access only to a limited list of addresses in the Internet, for example 8.8.8.8 only. However, because the "nat" rule has already done its job before filtering, I cannot "block on $ext_if from 192.168.3.0/24 to any" because the source has already been translated. In ipfw I can "deny ip from 192.168.3.0/24 to not 8.8.8.8" before it even gets into the nat rule, but what do I do with pf? --=20 Victor Sudakov, VAS4-RIPE, VAS47-RIPN 2:5005/49@fidonet http://vas.tomsk.ru/ --0F1p//8PRICkK4MW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJcoYbAAAoJEA2k8lmbXsY0ZBQH/1TKj16YOhkbVocShcg6XRtJ D9P15cZDJCASjh4ERvhHpY1CgrrpCsAEutI+FTXSJDJaORiLnuqLu+PE0HQqqTWv LZ0YWNGr+pfrm5+n8GOLGwMUtnni2q2W0JP59HFaPzhCRLmzkWFVx8FVJcBAcIpE eSn+SS9Gv1ttQfARSHaUErfYxjg++aY5JjgsxzNj5OTJ/5GuX1oDMjG6OWWVwSSl UVPcocv9U4fZlAkoyeSEJms+YsdEsVC37kVVItNag2TOiY1Yo22T+ubXS7BW4iVB x5rtbbLsjS40elBUJDkNdCjfDM2ruw0+2dPfZQWmL/FjXU5nEUq4JGg90bSk/q8= =gl4h -----END PGP SIGNATURE----- --0F1p//8PRICkK4MW--