From owner-freebsd-ipfw@FreeBSD.ORG Sat Apr 21 06:20:08 2012 Return-Path: Delivered-To: freebsd-ipfw@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2761A106564A for ; Sat, 21 Apr 2012 06:20:08 +0000 (UTC) (envelope-from crapsh@monkeybrains.net) Received: from lavash.monkeybrains.net (mail.monkeybrains.net [208.69.40.9]) by mx1.freebsd.org (Postfix) with ESMTP id 0183E8FC08 for ; Sat, 21 Apr 2012 06:20:07 +0000 (UTC) Received: from Computer-of-Penelope.local (199-83-222-51.PUBLIC.monkeybrains.net [199.83.222.51]) (authenticated bits=0) by lavash.monkeybrains.net (8.14.4/8.14.4) with ESMTP id q3L5mHgA036657 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Fri, 20 Apr 2012 22:48:17 -0700 (PDT) (envelope-from crapsh@monkeybrains.net) Message-ID: <4F9249CA.8030208@monkeybrains.net> Date: Fri, 20 Apr 2012 22:46:50 -0700 From: "Rudy (bulk)" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: freebsd-ipfw@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.3 at lavash.monkeybrains.net X-Virus-Status: Clean Subject: [ipfw_nat] How do I view active NAT sessions? X-BeenThere: freebsd-ipfw@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: IPFW Technical Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Apr 2012 06:20:08 -0000 [1] How do I see active sessions? The summary is great for graphing sessions over time: # ipfw nat 123 show nat 123: icmp=0, udp=173, tcp=876, sctp=0, pptp=0, proto=0, frag_id=0 frag_ptr=0 / tot=1049 But I am interested in seeing a list of all the active sessions -- in ipnat, you would run 'ipnat -l' to see a list of the current NAT table. Is there an equivalent for ipfw? [2] Why are my local (from router box) requests incrementing the nat counters (shouldn't my local ip should be skipped as it is not unreg_only)? # ipfw nat 123 config ip 1.1.1.123 same_ports reset log unreg_only # ipfw add nat 123 all from any to any # fping -g 1.1.1.1 1.1.4.255 # ipfw nat 123 show nat 123: icmp=302, udp=179, tcp=825, sctp=0, pptp=0, proto=0, frag_id=0 frag_ptr=0 / tot=1447 What the heck is being shown by 'ipfw nat show'? ;) [3] Man page recommendations for ipfw(8) Shouldn't the external interface be recommended in the EXAMPLES section? I didn't even try to set it up without a 'via'... - ipfw add nat 123 all from any to any + Assuming em0 is your external interface: + ipfw add nat 123 all from any to any via em0 For people stumbling ipnat to ipfw, how will they know about 'redirect_address' unless they have used natd? There is no reference to redirect_address in the man page -- which is internal, which external? All the options from natd(8) need to be dumped into ipfw(8). Yes, there is the curt reference to natd(8) many lines earlier than the EXAMPLES section, but a reference to natd(8) next to the example or explicit documentation within the man page for ipfw would make for better documentation. Put together a 'working' nat example... illustrate that with "net.inet.ip.fw.one_pass: 1" you need to specify IPs on the nat lines or ipfw will stop at that nat rule. 1.1.1.5,1.1.1.123 <-- em0 + em1 --> 10.0.0.1 (external) (internal) # basic example that allows a SSH access, a one-to-one mapping and a many-to-one mapping ipfw add 10 allow ip from any to me 22 in // allow SSH here as nat will stop the packet later (one_pass:1) ipfw add 20 allow ip from me 22 to any out ipfw add 1000 allow ip from any to any via em1 // we trust the internal network ipfw add nat 101 all from 10.0.0.5 to any out via em0 // map Luigi's desktop ipfw add nat 101 all from any to 1.1.1.5 in via em0 // map Luigi's desktop ipfw add nat 123 all from any to any out via em0 // map for Archie, Alex, Ugen, and Poul-Henning ipfw add nat 123 all from any to any in via em0 // map for Archie, Alex, Ugen, and Poul-Henning ipfw add allow ip from any to any via em0 // this rule will never be reached while one_pass: 1 # define your nat mappings ipfw nat 101 config redirect_addr 10.0.0.5 1.1.1.5 ipfw nat 123 config ip 1.1.1.123 same_ports reset deny_in log unreg_only Some questions and 2 cents based on usability, Rudy I just moved from ipnat to ipfw_nat as ipnat was making my box 'Fatal 12'. The man page for ipfw could use some work on the NAT section, IMHO.