1.Use TC to set up qdisc(HTB/WRR/SPQ).
- #tc qdisc add dev ppp0 root handle 1: htb default 11 r2q 64
- #tc class add dev ppp0 parent 1: classid 1:1 htb rate 30mbit ceil 30mbit
- #tc class add dev ppp0 parent 1:1 classid 1:10 htb rate 10mbit ceil 10mbit
- #tc class add dev ppp0 parent 1:1 classid 1:11 htb rate 20mbit ceil 20mbit
- #tc qdisc add dev ppp0 parent 1:10 handle 110: sfq perturb 10
- #tc qdisc add dev ppp0 parent 1:11 handle 111: sfq perturb 10
2.Use iptables/ip6tables to match ipv4 or ipv6 packet and set the mark.
- #iptables -A POSTROUTING -t mangle -o ppp0 -p all -s 192.168.1.3 -j MARK --set-mark 10
- #iptables -A POSTROUTING -t mangle -o ppp0 -p all -d 192.168.2.200 -j MARK --set-mark 11
3.Use TC filter to map packet to qdisc.
- #tc filter add dev ppp0 parent 1:0 handle 10 fw flowid 1:10
- #tc filter add dev ppp0 parent 1:0 handle 11 fw flowid 1:11
阅读(2332) | 评论(0) | 转发(0) |