zoukankan      html  css  js  c++  java
  • tc限速配置

    #TC 限速
    #https://blog.csdn.net/zhongbeida_xue/article/details/54613750
    #https://blog.51cto.com/13162375/2112847
    #https://blog.csdn.net/eydwyz/article/details/53320612
    #https://lartc.org/howto/lartc.qdisc.classful.html

    #!/bin/bash
    WANDEV=eth0
    LANDEV=eth1
    ALLOUT=200mbit
    EVERYIPOUT=100mbit
    ALLIN=200mbit
    EVERYIPIN=100mbit

    #上传速率做流量控制
    tc qdisc del dev $WANDEV root 2>/dev/null
    #根队列
    tc qdisc add dev $WANDEV root handle 1:0 htb default 60
    #根类
    tc class add dev $WANDEV parent 1:0 classid 1:1 htb rate $ALLOUT ceil $ALLOUT prio 0
    #子类
    tc class add dev $WANDEV parent 1:1 classid 1:11 htb rate $EVERYIPOUT ceil $EVERYIPOUT prio 1 burst 96kbit
    #设置队列规则
    tc qdisc add dev $WANDEV parent 1:11 handle 111:0 sfq perturb 10
    tc filter add dev $WANDEV parent 1:0 protocol ip prio 1 u32 match ip src 192.168.122.0/24 flowid 1:11


    #做下载限制,过滤器是用u32
    tc qdisc del dev $LANDEV root 2>/dev/null
    #根队列
    tc qdisc add dev $LANDEV root handle 2:0 htb default 30
    #根类
    tc class add dev $LANDEV parent 2:0 classid 2:1 htb rate $ALLIN ceil $ALLIN prio 0
    #子类
    tc class add dev $LANDEV parent 2:1 classid 2:11 htb rate $EVERYIPIN ceil $EVERYIPIN prio 1
    #设置队列规则
    tc qdisc add dev $LANDEV parent 2:11 sfq perturb 10
    tc filter add dev $LANDEV parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.122.0/24 flowid 2:11

    #查看流量
    #tc -s qdisc ls dev eth0
    #tc -s qdisc ls dev eth1
    #tc -s class ls dev eth0
    #tc -s class ls dev eth1

  • 相关阅读:
    15,scrapy中selenium的应用
    14,UA池和代理池
    13,scrapy框架的日志等级和请求传参
    12,scrapy框架之post请求
    11,scrapy框架持久化存储
    10,Scrapy简单入门及实例讲解
    09.移动端数据爬取
    08.Python网络爬虫之图片懒加载技术、selenium和PhantomJS
    07.验证码处理
    vue的ref与$refs
  • 原文地址:https://www.cnblogs.com/larrypeng/p/11579654.html
Copyright © 2011-2022 走看看