如题,linux 如何对某个 IP 进行上传与下载的限速。
![]() | 1 Yien 288 天前 TC |
![]() | 2 tool2dx 288 天前 if (ip == block_ip) then drop_package_random(); UDP 不好限速,只能随机掉包。 |
![]() | 4 R4rvZ6agNVWr56V0 288 天前 ![]() |
![]() | 5 Yien 288 天前 tc qdisc add dev eth0 root handle 1: htb default 30 tc class add dev eth0 parent 1: classid 1:1 htb rate 2Mbps ceil 2Mbps tc class add dev eth0 parent 1:1 classid 1:10 htb rate 2Mbps ceil 2Mbps tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 10.0.0.100 flowid 1:10 |
9 Shadowxxx OP 谁能指导下怎么限制下行速度 |
![]() | 10 PTLin 287 天前 这问题挺感兴趣特意查了下。 一般只能对发送队列进行整形,对接收方向的整形没意义,所以想要限制下载速度需要模拟一个虚拟的发送设备,对这个发送设备限流,然后进行重定向。 具体做法首先就是要有 ifb 功能,可以 build 在内核中或者编译成模块,然后使用以下命令。 modprobe ifb ip link add dev ifb0 up type ifb tc qdisc add dev eth0 handle ffff: ingress tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 action mirred egress redirect dev ifb0 tc qdisc add dev ifb0 root handle 1: htb default 10 tc class add dev ifb0 parent 1: classid 1:1 htb rate 1000mbit tc class add dev ifb0 parent 1:1 classid 1:10 htb rate 10mbit ceil 10mbit |
11 piero66 287 天前 tc + ifb |
13 DefoliationM 287 天前 via Android 新建一个 tun 网卡,要限速的路由到 tun 网卡,限速逻辑自己写。 |