From owner-freebsd-questions Fri May 31 12:16: 8 2002 Delivered-To: freebsd-questions@freebsd.org Received: from avocet.mail.pas.earthlink.net (avocet.mail.pas.earthlink.net [207.217.120.50]) by hub.freebsd.org (Postfix) with ESMTP id 69BFB37B404 for ; Fri, 31 May 2002 12:16:04 -0700 (PDT) Received: from sdn-ar-004dcwashp047.dialsprint.net ([206.133.21.159] helo=moo.holy.cow) by avocet.prod.itd.earthlink.net with esmtp (Exim 3.33 #2) id 17DrsZ-00022E-00; Fri, 31 May 2002 12:16:03 -0700 Received: by moo.holy.cow (Postfix, from userid 1001) id D9A7250BC8; Fri, 31 May 2002 15:18:40 -0400 (EDT) Date: Fri, 31 May 2002 15:18:40 -0400 From: parv To: Patrick Thomas Cc: freebsd-questions@freebsd.org Subject: Re: two ipfw questions... Message-ID: <20020531191840.GA52186@moo.holy.cow> Mail-Followup-To: Patrick Thomas , freebsd-questions@freebsd.org References: <20020531110825.I18408-100000@utility.clubscholarship.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020531110825.I18408-100000@utility.clubscholarship.com> 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 in message <20020531110825.I18408-100000@utility.clubscholarship.com>, wrote Patrick Thomas thusly... > > > 2) is there a way to take your current, running ruleset and dump it to a > file that can be used as a standalone shell script to set the rules at > boot time? > > For instance, if you `ipfw show` you get: > > 00100 7750 1619098 allow udp from any 53 to 10.10.10.10 > > how can I output that to: > > ipfw add 00100 allow udp from any 53 to 10.10.10.10 based on your input & output, can be easily done via awk... ipfw show | awk ' BEGIN { rule = "ipfw add" } { rule = rule" "$1 for (i = 4; i <= NF; i++) { rule = rule" "$i } } END { print rule }' -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message