OpenBSD / FreeBSD / NetBSD: PF Firewall List Rules

In OpenBSD, FreeBSD, and NetBSD, you can list the rules in a PF firewall using the following command:

pfctl -sr

This command will display a list of the rules in the firewall, including both the filter and the nat rules. The output of this command provides information about the direction of the rule (in/out), the interface, the source and destination addresses, and the action taken by the rule (pass/block).

You can also display the rules in a human-readable format using the following command:

pfctl -sr -v

This command provides additional information about the rules, such as the protocol and port numbers, and displays the rules in a format that is easier for humans to read.

Note: The PF firewall is a powerful and flexible firewall solution that is used in a variety of Unix-like operating systems, including OpenBSD, FreeBSD, and NetBSD. If you are not familiar with PF, it is recommended that you consult the PF manual pages or seek advice from a qualified expert before making any changes to your firewall configuration.

Leave a Comment