Linux中的QoS分为入口(Ingress)部分和出口(Egress)部分,入口部分主要用于进行入口流量限速(policing),出口部分主要用于队列调度(queuing scheduling)。大多数排队规则(qdisc)都是用于输出方向的,输入方向只有一个排队规则,即ingress qdisc。ingress qdisc本身的功能很有限,如下;

Ingress qdisc 
The ingress qdisc itself does not require any parameters. It differs from other qdiscs in that it does not occupy the root of a device. Attach it like this:
# tc qdisc add dev eth0 ingress
This allows you to have other, sending qdiscs on your device besides the ingress qdisc. 

About the ingress qdisc
Ingress qdisc (known as ffff:) can't have any children classes. (hence the existence of IMQ)
The only thing you can do with the ingress qdisc is attach filters. 

About filtering on the ingress qdisc
Since there are no classes to which to direct the packets, the only reasonable option is to drop the packets.
With clever use of filtering, you can limit particular traffic signatures to particular uses of your bandwidth.

具体使用如下命令,进行限速:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
tc qdisc add dev vnet1 handle ffff: ingress 
tc filter add dev vnet1 parent ffff: protocol all prio 49 basic police rate 10mbit burst 1mb mtu 65535 drop

未完待续。。。

参考文档:

https://blog.csdn.net/zhangskd/article/details/8240290 
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄