linux tc实现ingress&&egress限速

限制网卡的上行流量

上行流量用ingress这个qdisc实现,实现简单的限速

sql 复制代码
tc qdisc add dev wg0 ingress
tc filter add dev wg0 protocol ip ingress  u32 match ip src 13.0.0.3/32 police rate 10mbit burst 10k drop flowid :1
tc filter add dev wg0 protocol ip ingress  u32 match ip src 13.0.0.4/32 police rate 10mbit burst 10k drop flowid :1

限制网卡的下行流量

sql 复制代码
tc qdisc add dev wg0 root handle 1: htb default 2
tc class add dev wg0 parent 1: classid 1:1 htb rate 5Mbit ceil 10Mbit
tc class add dev wg0 parent 1: classid 1:2 htb rate 1000Mbit ceil 10Mbit
tc filter add dev wg0 parent 1: protocol ip prio 1 u32 match ip dst 13.0.0.3/32 flowid 1:1
tc filter add dev wg0 parent 1: protocol ip prio 1 u32 match ip dst 13.0.0.4/32 flowid 1:2

用iperf分别测试上行速率和下行速率

  • 上行 下行流量用htb这个qdisc实现,用不同的class来区分需要限制的ip地址
  • 下行
相关推荐
U盘失踪了10 小时前
Django 登录注册功能实现-样式优化
后端·python·django
qinyuan1511 小时前
使用husky和fabric规范git提交的注释
前端·后端
uhakadotcom11 小时前
asyncpg 全面教程:常用 API 串联与实战指南
后端·面试·github
武子康11 小时前
大数据-176 Elasticsearch Filter DSL 全面实战:过滤查询、排序分页、高亮与批量操作
大数据·后端·elasticsearch
kevinzeng11 小时前
SpringBoot自动装配注解
spring boot·后端
闲人编程11 小时前
GraphQL与REST API对比与实践
后端·python·api·graphql·rest·codecapsule
JavaEdge在掘金11 小时前
零距离拆解银行司库系统(TMS)的微服务设计与实践
后端
11来了11 小时前
DeepResearch 核心原理
后端
Wzx19801211 小时前
go接受输入方式
开发语言·后端·golang