使用tc限制所有流量匹配tcp(协议6)目标端口54000(256Kbits入站)到eth0的所有流量的示例…
作为根……
tc qdisc add dev eth0 handle ffff: ingress
tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 \
match ip protocol 6 0xff \
match ip dport 54000 0xffff police rate 256kbit burst 10k drop \
flowid :1
您可以像这样监视它…注意下面的ffff删除的数字
[mpenning@Bucksnort ~]$sudo tc -s qdisc show
qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 17796311917 bytes 5850423 pkt (dropped 0,overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
qdisc ingress ffff: dev eth0 parent ffff:fff1 ----------------
Sent 140590 bytes 1613 pkt (dropped 214,overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Sent 0 bytes 0 pkt (dropped 0,overlimits 0 requeues 0)
rate 0bit 0pps backlog 0b 0p requeues 0
[mpenning@Bucksnort ~]$
要删除所有入口流量过滤器:
tc qdisc del dev eth0 ingress