Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 2002 15:18:40 -0400
From:      parv <parv@pair.com>
To:        Patrick Thomas <root@utility.clubscholarship.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: two ipfw questions...
Message-ID:  <20020531191840.GA52186@moo.holy.cow>
In-Reply-To: <20020531110825.I18408-100000@utility.clubscholarship.com>
References:  <20020531110825.I18408-100000@utility.clubscholarship.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020531191840.GA52186>