当前位置: 技术问答>linux和unix
linux tc怎么对 目的MAC ,源MAC,目的IP, 源 IP,目的 port ,源 port配置带宽限制规则?谢谢
来源: 互联网 发布时间:2016-06-05
本文导语: linux tc怎么对 目的MAC ,源MAC,目的IP, 源 IP,目的 port, 源 port配置带宽限制规则?谢谢 请给一个例子,包括上述六项的配置,谢谢 | http://www.oklinux.cn/html/other/qyyy/20080513/54135.html TC IPTables带宽限...
linux tc怎么对 目的MAC ,源MAC,目的IP, 源 IP,目的 port, 源 port配置带宽限制规则?谢谢
请给一个例子,包括上述六项的配置,谢谢
请给一个例子,包括上述六项的配置,谢谢
|
|
做成 shell 脚本,调试时有错就将 qdisc 删除,重来...
# tc qdisc del
|
Priority queuing with tc to optimize VoIP. See the full example on voip-info.org or www.howtoforge.com. Suppose VoIP uses udp on ports 10000:11024 and device eth0 (could also be ppp0 or so). The following commands define the QoS to three queues and force the VoIP traffic to queue 1 with QoS 0x1e (all bits set). The default traffic flows into queue 3 and QoS Minimize-Delay flows into queue 2.
# tc qdisc add dev eth0 root handle 1: prio priomap 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 0
# tc qdisc add dev eth0 parent 1:1 handle 10: sfq
# tc qdisc add dev eth0 parent 1:2 handle 20: sfq
# tc qdisc add dev eth0 parent 1:3 handle 30: sfq
# tc filter add dev eth0 protocol ip parent 1: prio 1 u32
match ip dport 10000 0x3C00 flowid 1:1 # use server port range
match ip dst 123.23.0.1 flowid 1:1 # or/and use server IP
Status and remove with
# tc -s qdisc ls dev eth0 # queue status
# tc qdisc del dev eth0 root # delete all QoS
# tc qdisc add dev eth0 root handle 1: prio priomap 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 0
# tc qdisc add dev eth0 parent 1:1 handle 10: sfq
# tc qdisc add dev eth0 parent 1:2 handle 20: sfq
# tc qdisc add dev eth0 parent 1:3 handle 30: sfq
# tc filter add dev eth0 protocol ip parent 1: prio 1 u32
match ip dport 10000 0x3C00 flowid 1:1 # use server port range
match ip dst 123.23.0.1 flowid 1:1 # or/and use server IP
Status and remove with
# tc -s qdisc ls dev eth0 # queue status
# tc qdisc del dev eth0 root # delete all QoS
|
iptables -t mangle -A PREROUTING -m mac --mac-source 00:15:F2:9E:D3:6C -j TOS --set-tos 0x1
/sbin/tc filter add dev eth1 parent 1: protocol ip prio 1 handle 1 fw flowid 1:1
可以通过优先级关联起来...
/sbin/tc filter add dev eth1 parent 1: protocol ip prio 1 handle 1 fw flowid 1:1
可以通过优先级关联起来...