[CDBUG-talk] pfctl -t table -T add foo.bar (so what happens on reboot?)

Jameel Akari jakari at bithose.com
Fri Sep 30 00:46:37 EDT 2005

> I was just working with tables today for the first time, and using pfctl to
> add / remove entries. I was wondering, though, are these updates simply lost
> on reboot, or are they retained?
> Just wondering. It seems to me that they must be retained, but I haven't

Nope, not if you're adding them like that.  Tables only exist in memory.

What you want is a persistent table wih an external file:

table <mytable> persist file "/etc/mytablefile"

You add/edit/append entries in the external file (mytablefile).  It will 
be reloaded when pf is reloaded, or when pfctl is told to reread it:

/sbin/pfctl -t mytable -Treplace -f /etc/mytablefile

Changes to the file do not immediately affect the table; you have to have 
pf replace the table contents with the file.  (Or, you can other 
files listing things just to add or delete - see the -T section of the 
pfctl manpage for more details and examples)

Good luck,
Jameel Akari

More information about the CDBUG-talk mailing list