Linux 网络限速 Wondershaper 工具使用

wondershaper 可以限制 linux 服务器网卡级别的带宽

下载 wondershaper

# cd /usr/local/
# git clone  https://github.com/magnific0/wondershaper.git

wondershaper 使用

// 单位是 Kbps
./wondershaper -a 网口名称 -u 上传速度 -d 下载速度

// 限制 eth0 网口上传下载为 150  Kbps
./wondershaper -a eth0 -u 150 -d 150

// 可以看到多了一个 ifb0 网口
# ip addr show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:16:3e:0e:48:a7 brd ff:ff:ff:ff:ff:ff
    inet 10.3.200.99/22 brd 10.3.203.255 scope global dynamic eth0
       valid_lft 304404587sec preferred_lft 304404587sec
3: ifb0:  mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 32
    link/ether 96:3a:32:74:1e:01 brd ff:ff:ff:ff:ff:ff

// 查看限速状态
./wondershaper -a eth0 -s

//取消限速
./wondershaper -a eth0 -c

你可能感兴趣的:(Linux 网络限速 Wondershaper 工具使用)