我正在尝试学习数据包排队的技巧,所以我想我已经对从已知 Tor 出口节点进入端口 80 的流量设置了限制。这是在 FreeBSD 9 上,因此 OpenBSD 特定的解决方案可能不适用(语法/等)。
# Snipped to mainly the relevant parts
table <torlist> persist file "/var/db/torlist"
# ...
set block-policy return
scrub in all
scrub out on $ext_if all
# What I *want* to do is create a cue for known tor exit nodes
# no single one IP should be able to do more than 56k/sec
# but the combined bandwidth of all tor visitors should not
# exceed 512k/sec, basically limiting Tor visitors to something
# like dialup
altq on $ext_if cbq bandwidth 512k queue { qin-tor }
queue qin-tor bandwidth 56Kb cbq ( default rio )
# ...
block in log all
antispoof for { $ext_if, $tun_if }
antispoof quick for $int_if inet
### inbound web rules
# Main Jail ($IP4_PUB3 is my webserver IP)
pass in on $ext_if inet proto tcp from <torlist> to $IP4_PUB3 port www synproxy state queue qin-tor
pass in on $ext_if inet proto tcp to $IP4_PUB3 port www synproxy state
问题是,当启用特定于 torlist 的 altq、queue 和 pass 行时,所有连接都非常慢。我什至针对 pfctl -t torlist -T test 测试了我自己的 IP,并返回“0/1 地址匹配”,如果我从列表中测试一个,它是“1/1 地址匹配”
所以我并没有真正了解我到底做错了什么,我假设符合它的通行证只会应用于该表中列出的 IP,因此我自己的 IP 不会验证根据该规则,并将传递到下一个规则。
让它工作并不紧急,但任何有助于理解我失败的地方将不胜感激。