From owner-freebsd-pf@freebsd.org Mon Jun 11 22:23:45 2018 Return-Path: Delivered-To: freebsd-pf@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 6D1A01005705 for ; Mon, 11 Jun 2018 22:23:45 +0000 (UTC) (envelope-from srs0=u+m5=i5=sigsegv.be=kristof@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A910581D1E for ; Mon, 11 Jun 2018 22:23:44 +0000 (UTC) (envelope-from srs0=u+m5=i5=sigsegv.be=kristof@codepro.be) Received: from [169.254.240.65] (unknown [66.171.165.146]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 52C205E749; Tue, 12 Jun 2018 00:23:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigsegv.be; s=mail; t=1528755820; bh=CkRunhve3TnLlydKEligw1a5/n3ksdjaO/L77ACKCUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rfLXdGfjiHKtc75+eBcxHbgFEbLV5OD6CxKmxF13m13Hz1sx91C1thUzU9C2YvUoW HlSghmnmmTEAQ1LJQEVZrFNKw3XVD5eb/zeZSWu2ok5xed4mjmj7a+o+J+zM+B/Dgp tXinE1bFLLZt5XFhfbjNGz6s8OasJskgbHAxzKoo= From: "Kristof Provost" To: "Fatemeh Mehdizadeh" Cc: freebsd-pf@freebsd.org Subject: Re: pf nat log does not show source and destination port Date: Mon, 11 Jun 2018 18:23:33 -0400 X-Mailer: MailMate (2.0BETAr6113) Message-ID: <8F0561C0-67A6-4479-8F0D-72A038CC1280@sigsegv.be> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2018 22:23:45 -0000 Hi Fatemeh, On 11 Jun 2018, at 7:51, Fatemeh Mehdizadeh wrote: > Hi all, > I'm using pf to create nat. I'm on FreeBSD9.2. Note that FreeBSD 9.2 is not a supported version. It went out of support at the end of 2014. (See https://www.freebsd.org/security/unsupported.html) I would strongly recommend upgrading to a supported version: https://www.freebsd.org/security/security.html#sup > I want enable logs for > nat translations, so > in pf.cpnf: > > table { 20.20.20.2,20.20.20.3,20.20.20.4,20.20.20.5 } > nat log on 'eth0' from { 10.10.10.0/24} to any -> > round-robin sticky-address > > After ping request I have a log: > # tcpdump -t -r pflog > IP 20.20.20.3 > 20.20.20.1: ICMP echo request, id 4147, seq 0, length > 64 > pflog logs the entire packet (with a pf-specific header with information about the matched rules), so you can parse whatever information you want out of that. > The problem is that I want my log shows the source port and > destination port and NOT show id, seq and length. > You may get enough information by simply telling tcpdump to be more verbose: # tcpdump -t -v -r pflog (Repeat the ā€˜-vā€™ flag for even more information.) Regards, Kristof