背景
由於路由器openwrt的限速不太好用,所以需要到設備上去進行限速設置,這裏使用wondershaper
使用
下載安裝wondershaper
wget https://ghproxy.com/https://github.com/magnific0/wondershaper/archive/refs/heads/master.zip -O wondershaper.zip
unzip wondershaper.zip
cd wondershaper-master/
sudo make install
修改網卡速率限制
sudo vim /etc/systemd/wondershaper.conf
默認下載速率2048Kb 上傳512Kb 修改爲自己想要控制的速率
默認網卡名爲eth0 如果和自己的不一致(可以通過ip addr
命令查看所有網卡及IP信息)
啓用wondershaper服務
由於make install只是把wondershaper拷貝到了/usr/local/sbin 而wondershaper.service中是使用的/usr/sbin/wondershaper,所以需要先軟鏈接過去再啓用服務
sudo ln -s /usr/local/sbin/wondershaper /usr/sbin/wondershaper
sudo systemctl enable --now wondershaper.service
systemctl status wondershaper.service
最後就可以看到服務是處於啓用的狀態