bird的RIP路由协议实现默认会以线速向外暴力发送RIP报文, 这使得同学们的路由器的软件部分可能无法及时处理, 因此我们需要对bird发报文的速率进行限制。经过研究, 我们选择使用Linux的tc, 限速命令如下:
#!/bin/bash
IFACE=${1}
# RIP 20000 routes in 3s: 1.1648Mbps
LIMIT=1.5Mbit
tc qdisc del dev ${IFACE} root
tc qdisc add dev ${IFACE} root handle 1:0 htb default 1
tc class add dev ${IFACE} parent 1:0 classid 1:1 htb rate ${LIMIT} ceil ${LIMIT}
tc filter add dev ${IFACE} parent 1:0 prio 1 protocol ip u32 match ip dport 520 0xffff flowid 1:1
tc -s qdisc ls dev ${IFACE}
tc -s class ls dev ${IFACE}
tc -s filter ls dev ${IFACE}
另外, 今天凌晨有5900X抢购, 我又错过了。

发表评论