I have a gateway whose OS is Linux.Assume my downlink bandwidth is 100 Mbps. I want to limit the max download speed to 1Mbps for every device which uses this gateway.In other words, if there are 100 devices, every device can get 1 Mbps bandwidth in theory.I tried doing traffic shaping via Linux command "tc". Below are my commands.My interface name is "eth0".But the problem is these commands only can limit speed for specific device(here, its MAC address is M0M1M2M3M4M5) .The commands what I want are to limit the speed for every device.The commands should be general because I don't know the MAC address of device which will send the packets the to gateway.Are there any simple commands/ways to do this? Do we need to add TC rules dynamically? Thanks in advance.
tc qdisc add dev eth0 root handle 1: htb default 20
tc class add dev eth0 parent 1: classid 1:1 htb rate 1mbit ceil 1mbit
#dst MAC=M0M1M2M3M4M5
tc filter add dev eth0 parent 1: protocol ip prio 5 u32 match u32 0xM2M3M4M5 0xffffffff at -12 match u16 0xM0M1 0xffff at -14 flowid 1:1