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地址
  • 下行
相关推荐
GetcharZp5 分钟前
告别 Nginx 手动配置!这款 Go 语言开发的云原生网关,才是容器化时代的真香神器!
后端
RuoyiOffice14 分钟前
SpringBoot+Vue3 企业考勤如何处理法定假期?节假日方案、调休补班与工作日判断链路拆解
spring boot·后端·vue·anti-design-vue·ruoyioffice·假期·人力
Vane144 分钟前
从零开发一个AI插件,经历了什么?
人工智能·后端
952361 小时前
SpringBoot统一功能处理
java·spring boot·后端
rleS IONS1 小时前
SpringBoot中自定义Starter
java·spring boot·后端
DevilSeagull2 小时前
MySQL(2) 客户端工具和建库
开发语言·数据库·后端·mysql·服务
TeDi TIVE3 小时前
springboot和springframework版本依赖关系
java·spring boot·后端
雨辰AI3 小时前
SpringBoot3 + 人大金仓 V9 微服务监控实战|Prometheus+Grafana+SkyWalking 全链路监控
数据库·后端·微服务·grafana·prometheus·skywalking
Nicander3 小时前
理解 mybatis 源码:vibe-coding一个mini-mybatis
后端·mybatis
小呆呆6664 小时前
Codex 穷鬼大救星
前端·人工智能·后端