Sunday, November 27, 2011

pf Tables

pf has tables, which are extremely useful when creating and destroying jails. The given link has all the information needed, but below are some quick commands to get started.

A series of jails will be created, with IP addresses 10.10.10.100-105. A small excerpt from pf.conf follows, in which a table is created, IPs given, and a rule to use it.

table <jails> persist { \
        10.10.10.100, \
        10.10.10.101, \
        10.10.10.102, \
        10.10.10.103, \
}

pass in on $ext_if proto tcp from any to <jails> port 22

This should permit SSH to the jails table. A new jail has just been created, add it to the table and then display the table contents.

$ sudo pfctl -t jails -T add 10.10.10.104
$ sudo pfctl -t jails -T show
10.10.10.100
10.10.10.101
10.10.10.102
10.10.10.103
10.10.10.104

The pf.conf file must still be modified to include this new IP address if it is to persist across reboots.

No comments:

Post a Comment