From owner-freebsd-questions Thu Dec 19 4: 5:57 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C82D337B401 for ; Thu, 19 Dec 2002 04:05:55 -0800 (PST) Received: from zim.0x7e.net (zim.0x7e.net [203.38.184.132]) by mx1.FreeBSD.org (Postfix) with ESMTP id 39D6B43EB2 for ; Thu, 19 Dec 2002 04:05:54 -0800 (PST) (envelope-from listone@deathbeforedecaf.net) Received: from goo.0x7e.net ([203.38.184.164] helo=deathbeforedecaf.net) by zim.0x7e.net with esmtp (Exim 3.36 #1) id 18OzQw-0000vB-00; Thu, 19 Dec 2002 22:35:46 +1030 Message-ID: <3E01B616.7080708@deathbeforedecaf.net> Date: Thu, 19 Dec 2002 22:35:42 +1030 From: Rob User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gary D Kline , FreeBSD Mailing List Subject: Re: Are these IPF -> IPFW protocols equivalent? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > # Inside Interface (ipfw) > [IPFW] add 200 allow tcp from any to any out xmit via dc0 keep-state > [IPFW] add 200 allow icmp from any to any out xmit via dc0 keep-state > [IPFW] add deny ip from any to any out xmit via dc0 > > [IPFW] add 200 allow tcp from any to any in recv via dc0 keep-state > [IPFW] add 200 allow icmp from any to any in recv via dc0 keep-state > [IPFW] add deny ip from any to any in recv via dc0 > > # Loopback Interface > [IPFW] add allow ip from 127.0.0.1 to 127.0.0.1 in recv via lo0 > [IPFW] add allow ip from 127.0.0.1 to 127.0.0.1 out xmit via lo0 I've only used ipfw for a little while, but there's a few things I can suggest here. * A good diagnostic for your rules is ipfw list Run this after adding a list of rules, and it shows you how they were translated by ipfw. It also shows the default rule (number 65535) which will be allow any or deny any, depending on your kernel options. * You don't need to supply a number after 'add' - the ipfw command will number them for you. I'm not sure what happens if you give different rules the same number, but it probably isn't useful. * Since you're allowing all out #1 and all in #4, you can combine these rules as add allow tcp from any to any via dc0 keep-state with the same effect. * Likewise with #2 and #5, they can be combined as add allow icmp from any to any via dc0 keep-state * Likewise with #7 and #8. * The keep-state option allows you set up two-way traffic based on a one-way rule. I think it's mainly designed for UDP (where there's no established connection to allow) but it should work for ICMP as well. However, since you're already allowing traffic both ways (in & out) it isn't necessary in this case. * If your default rule is deny all, you don't need #3 and #6, because it will be denied anyway. * If you give a hostname to ipfw, it will resolve the address when adding the rule. * So you should be able to do the same thing with add allow tcp from any to any via dc0 add allow icmp from any to any via dc0 add allow ip from localhost to localhost via lo0 As I said, I've only been using ipfw for a little while so wiser heads may contradict some of this.... Best of luck :-) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message