magnific0 / wondershaper

Command-line utility for limiting an adapter's bandwidth
GNU General Public License v2.0
1.74k stars 267 forks source link

Wondershaper on virtual NIC #98

Open narcisgarcia opened 8 months ago

narcisgarcia commented 8 months ago

Hello, and thank you for sharing Wondershaper to community.

I'm trying to split LAN-to-WAN bandwidth by throttling traffic per computer in LAN. I've tried with fireqos but it seems too complicated. I have a single computer with Debian GNU/Linux 12 connected to Internet (eth0), and it acts as default gateway/NAT to the other computers in LAN (configured with iptables). LAN computers are physically connected to gateway's eth1.

My ISP is providing a 1000mbps connection, and I want to split this into 10mbps per computer.

Then I install wondershaper and define at /etc/network/interfaces :

iface br-pc1 inet static bridge_ports none bridge_fd 0 bridge_stp off bridge_maxwait 0 address 172.16.1.1/16 up /sbin/wondershaper -a br-pc1 -d 10000 -u 10000 down /sbin/wondershaper -c -a br-pc1

iface br-pc2 inet static bridge_ports none bridge_fd 0 bridge_stp off bridge_maxwait 0 address 172.16.1.2/16 up /sbin/wondershaper -a br-pc2 -d 10000 -u 10000 down /sbin/wondershaper -c -a br-pc2

iface br-pc3 inet static bridge_ports none bridge_fd 0 bridge_stp off bridge_maxwait 0 address 172.16.1.3/16 up /sbin/wondershaper -a br-pc3 -d 10000 -u 10000 down /sbin/wondershaper -c -a br-pc3

I enable these virtual NICs to act as dedicated gateways: $ sudo ifup br-pc1 $ sudo ifup br-pc2 $ sudo ifup br-pc3

I also setup LAN computers to use respectively gateways (172.16.1.1 / 172.16.1.2 / 172.16.1.3)

And I make speed tests (speedtest-cli) from them BUT I don't appreciate traffic throttle. Do you know what I'm wrong with this? Perhaps NIC type or definition?