9 ms·
The OpenBSD site has an example as well. http://www.openbsd.org/faq/pf/example1.html http://www.openbsd.org/faq/pf/example1.html As a point of comparison, the
by zdw 11y ago
The OpenBSD site has an example as well.
http://www.openbsd.org/faq/pf/example1.html http://www.openbsd.org/faq/pf/example1.html
As a point of comparison, the iptables syntax as shown in the Ars article is far harder to grok at first glance than either of the pf examples. For example:
pass in on egress inet proto tcp from any to (egress) port { 80 443 } rdr-to <ipaddr>
vs:
-A PREROUTING -p tcp -m tcp -i p4p1 --dport 80 -j DNAT --to-destination <ipaddr>:80
-A FORWARD -p tcp -d <ipaddr> --dport 80 -j ACCEPT
- Mister_Snuggles 11y agoYeah, I've always found iptables to be a little hard to understand. It also sounds like it's getting replaced[0]. My guess is that we will see iptables around for a long time after it's been deprecated. ifconfig, for example, is deprecated[1] yet it's still around and being used. [0] https://lwn.net/Articles/564095/ https://lwn.net/Articles/564095/ [1] https://lists.debian.org/debian-devel/2009/03/msg00780.html https://lists.debian.org/debian-devel/2009/03/msg00780.html
- zdw 11y agoifconfig is BSD derived and standard across more Unix variants, whereas ip and friends are Linux only. See also dladm in illumos as another variation on a theme.
- Decade 11y agoifconfig is still used on BSD and, most importantly, MacOS X. Also, the Linux replacement for ifconfig is ip from iproute2, and that was made by the guy who did Linux QoS. He sort of sucks at usability. For example, `ifconfig eth0 down` becomes `ip link set dev eth0 down` and `ifconfig eth0 192.168.1.2` becomes `ip add add 192.168.1.2/24 brd + dev eth0`; I had to look these up to make sure I had the correct syntax. Okay, the actual command is `ip address add` and not `ip add add`, but it allows extreme abbreviation at the expense of discoverability.