I am trying to host multiple clients on a single CentOS server and provide them each with their own 10 or 100mbit upload speed. The server itself has a multi-gig connection to a single eth0 interface that needs to be 'divided up'. It can be assumed that each client has just one single IP. I only care about limiting their outbound traffic and not worried about controlling the inbound. For this problem, I also do not want to limit the number of packets, just the resulting outbound bandwidth on a per-ip basis.
I have found the following code from this source:
DEV=eth0 tc qdisc del dev $DEV root tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit tc class add dev $DEV parent 1: classid 1:1 cbq rate 256kbit allot 1500 prio 5 bounded isolated tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src X.X.X.X flowid 1:1 tc qdisc add dev $DEV parent 1:1 sfq perturb 10
Could someone please tell me whether this will have the desired behaviour that I just described. e.g. limit outgoing bandwidth based on ip rather than limit the entire NIC. Do I just need to copy/change the fifth line multiple times, once for each IP?
Explaining in english what each line of the code does would also be appreciated.