版权声明:本文为博主原创文章,转载请注明出处。

目录(?)[-]

  1. 概述
  2. Ingress qdisc
  3. ifb
  4. 实例
  5. Author
  6. Reference

概述

Linux中的QoS分为入口(Ingress)部分和出口(Egress)部分,入口部分主要用于进行入口流量限速(policing),出口部分主要

用于队列调度(queuing scheduling)。

大多数排队规则(qdisc)都是用于输出方向的,输入方向只有一个排队规则,即ingress qdisc。ingress qdisc本身的功能很有限,

但可用于重定向incoming packets。通过Ingress qdisc把输入方向的数据包重定向到虚拟设备ifb,而ifb的输出方向可以配置

多种qdisc,就可以达到对输入方向的流量做队列调度的目的。

Q: 为什么大多数的流量控制都是在输出方向的?

A: It is easiest to create traffic control rules for traffic flowing out of an interface, since we can control when the system

sends data, but controlling when we receive data requires an additional intermediate queue to be created to buffer

incoming data.

原理图如下:

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.

入口流量的限速

# tc qdisc add dev eth0 ingress

# tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 match ip src 0.0.0.0/0 police rate 2048kbps burst 1m drop flowid :1

ifb

IFB — Intermediate Functional Block device。

Q: How can we use qdisc (e.g., netem) on incoming traffic?

A: You need to use IFB. This network device allows attaching queueing disciplines to incoming packets.

To use an IFB, you must have IFB support in your kernel (configuration option CONFIG_IFB). Assuming that

you have a modular kernel, the name of the IFB module is ifb and may be loaded using the command

modprobe ifb (if you have modprobe installed) or insmod /path/to/module/ifb.

ip link set ifb0 up

ip link set ifb1 up

By default, two IFB devices(ifb0 and ifb1) are created.

IFB allows for queueing incoming traffic for shaping instead of dropping.

ifb模块需要手动加载。

# modprobe ifb

启用虚拟设备ifb0。

# ip link set dev ifb0 up

使用ifb0做输入方向的重定向。

tc filter add dev eth0 parent fff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0

使用ifb0做输出方向的重定向。

tc filter add dev eth0 parent 1: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0

实例

用ingress qdisc和ifb做ingress方向的队列调度。

# modprobe ifb

# ip link set dev ifb0 up txqueuelen 1000

# tc qdisc add dev eth1 ingress

# tc filter add dev eth1 parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0

# tc qdisc add dev ifb0 root netem delay 50ms loss 1%

Author

zhangskd @ csdn

Reference

[1]  http://lartc.org/howto/index.html

[2]  http://www.linuxfoundation.org/collaborate/workgroups/networking/ifb

输入方向的流量控制 --ifb相关推荐

  1. 如何控制input的输入方向

    inoput的输入方向是从左向右的,但是有的时候我们希望的是多个input右对齐 这个时候我们可以使用两个办法 一个是设置 dir设置 <input type="text" ...

  2. iOS UITextField文字输入方向

    phoneTF.textAlignment=NSTextAlignmentRight;

  3. c语言中怎么暂停一个一个游戏,求助:最近在linux下用c语言写了一个贪吃蛇程序,有几个问题,第一:贪吃蛇怎么实现暂停,第二:有时候同时输入上下左右中的两个键就会直接游戏结束...

    求助:最近在linux下用c语言写了一个贪吃蛇程序,有几个问题,第一:贪吃蛇怎么实现暂停,第二:有时候同时输入上下左右中的两个键就会直接游戏结束 /* 以下是主要的逻辑代码,还有些.c和.h就没发了 ...

  4. MSP430 MSP430单片机输入/输出模块 通用I/O端口GPIO LED按键

     DO OR DIE MSP430 MSP430单片机输入/输出模块 通用I/O端口GPIO LED&按键 一.原理图 二.I/O端口常用操作C语言描述及常用C语言解析 1.MSP430头文件 ...

  5. Ueditor增加文字竖排显示和从右向左输入(支持蒙古文和维吾尔文)

    平时我们在ueditor中都是输入的中文,排版都是从左向右输入.但是当输入一些少数民民族言时,ueditor却不能正常显示. 例如蒙古文字,传统蒙文是竖排书写.如下图:传统蒙古文排文方式,<蒙古 ...

  6. MSP432输入输出模块

    第6章MsP432微控制器输入输出模块 单片机中的输入输出模块是供信号输入.输出所用的模块化单元.MsP432单片机的片内输入输出模块非常丰富,典型的输入输出模块有:通用O端口.模/数转换模块.比较器 ...

  7. Linux系统下的系统资源和网络资源控制

    title: Linux系统下的系统资源和网络资源控制 categories:- 学习 tags:- Linux- 系统管理- 网络管理 今日珠宝 宝格丽BVLGARI系列戒指 18K玫瑰金材质镶嵌7 ...

  8. Linux QoS ingress处理流程

    在传统的TCP/IP网络的路由器中,所有的IP数据包的传输都是采用FIFO(先进先出),尽最大努力传输的处理机制.在早期网络数据量和关键业务数据不多的时候,并没有体现出非常大的缺点,路由器简单的把数据 ...

  9. 物理层(网线)、数据链路层(交换机)、网络层(IP协议、ARP协议、ICMP协议、路由器)、VLAN(虚拟局域网)、HSRP协议、ACL、NAT

    文章目录 物理层(Physic Layer) 数据链路层(2层 Data Link Layer) 1.帧结构: 2.帧格式: 3.工作在数据链路层的设备: 交换机/网卡 4.交换机基本的工作原理:MA ...

最新文章

  1. vuex中组合action的使用
  2. windows 2008 64位oracle11g部署问题(3)之ORA-12514:TNS:监听程序当前无法识别连接描述符中请求的服务...
  3. PyQt 5布局管理
  4. 易语言服务器不在一个网段,设置二级路由器保持局域网在同一个网段
  5. 智能优化算法:JAYA优化算法 -附代码
  6. Django 创建model的一些注意事项
  7. LayaAir UI 组件 # Button 按钮
  8. 【软件工程】系统约束
  9. html 图片导出excel,html静态表格导出到excel
  10. 《15款最好用的新浪短链接(t.cn接口)在线生成工具》
  11. wireshark:时区
  12. 与钩React过度-实际操作
  13. shell脚本自动化创建虚拟机的基本配置--tomcat--mysql--jdk--maven---妈妈再也不用担心我不会配置虚拟机了!
  14. 基于ESP32+AMG8833的物联网红外成像测温枪
  15. 基于禁忌搜索算法的TSP问题求解matlab仿真
  16. 苹果11是高通基带吗_iPhone11信号成最大问题,不支持5G还是英特尔基带,令人失望...
  17. TortoiseGit-下载安装汉语语言包(汉化-方法)
  18. MoshUp安卓版来了
  19. 快播“洗白”,难道要抛弃用户?
  20. 计算机网络(3.10)数据链路层- 集线器的星形拓扑和以太网的信道利用率

热门文章

  1. Vue封装Tabs标签页
  2. Thinkphp5手册学习笔记-配置项
  3. 【哈利波特·魔法觉醒】手记全攻略
  4. “读芯术”精华文章汇总:学术报告
  5. tensorboard 2.0可视化 —浏览器中输入http://ip:6006 - 无法访问此网站——有效解决
  6. 基于springboot的智能美食点餐配送系统
  7. Pytorch警告UserWarning: Loky-backed parallel loops cannot be called in a multiprocessing
  8. android 环信 emmessagelistener,集成环信实现简单聊天功能
  9. 辐角原理判断点和多边形的关系
  10. PDA模拟中的问题1