AltBSD / Pf在OpenBSD上遇到麻烦

我在OpenBSDpf / altq上遇到了一些麻烦,但是由于我刚刚接触到了这个问题,所以我不确定是不是因为我误解了如何使用锚点,或者系统出了什么问题。

我正在尝试使用pfctl将altq规则添加到锚点,但pfctl在尝试时总是说设备忙。 如果我在pf.conf中使用相同的规则,虽然它工作正常:

root@openbsd:~# uname -a OpenBSD openbsd.my.domain 5.2 GENERIC.MP#368 amd64 # ---- Show current pf.conf rules ----- root@openbsd:~# cat /etc/pf.conf pass out on re0 pass in on re0 anchor tshaping # ---- Try to load altq rules into the anchor ----- root@openbsd:~# echo -n "altq on re0 cbq bandwidth 10Mb queue { myqueue }\nqueue myqueue bandwidth 1Mb cbq(default)\n" | pfctl -a tshaping -f - pfctl: DIOCADDALTQ: Device busy # ---- Change the pf.conf to include the altq rules without an anchor ----- root@openbsd:~# cat /etc/pf.conf pass out on re0 pass in on re0 altq on re0 cbq bandwidth 10Mb queue { myqueue } queue myqueue bandwidth 1Mb cbq(default) # ---- Load the new pf.conf rules ----- root@openbsd:~# pfctl -f /etc/pf.conf # ---- The new rules load fine from the config file with no anchor ----- root@openbsd:~# pfctl -sa | grep queue queue root_re0 on re0 bandwidth 10Mb priority 0 cbq( wrr root ) {myqueue} queue myqueue on re0 bandwidth 1Mb cbq( default ) 

根据http://lists.freebsd.org/pipermail/freebsd-pf/2008-October/004826.html你不能加载队列到我想要做的锚点。

您必须将队列规则加载到主要的pf.conf文件中,并只将用于将队列分配给队列的过滤规则加载到锚点中。

你可以有多个pf.conf文件。 像这样的东西:

 /etc/pf.conf /<whatever path>/tshaping.conf /<whatever path>/other_rules.conf 

并运行:

 pfctl -f /etc/pf.conf pfctl -f /<whatever path>/tshaping.conf pfctl -f /<whatever path>/other_rules.conf 

但是,您可以使用pfctl(8)即时操作表格 。

所以,你可以这样做: echo -n "altq on re0 cbq bandwidth 10Mb queue { myqueue }\nqueue myqueue bandwidth 1Mb cbq(default)\n" > /whatever path>/tshaping.conf; pfctl -f /<whatever path>/tshaping.conf echo -n "altq on re0 cbq bandwidth 10Mb queue { myqueue }\nqueue myqueue bandwidth 1Mb cbq(default)\n" > /whatever path>/tshaping.conf; pfctl -f /<whatever path>/tshaping.conf