There is a server on Debian that distributes Internet clients. The tasks of the server include shaping and NAT. Due to the fact that there is NAT it is impossible to do a full-fledged shaping (NAT on the output interface works earlier and changes src_ip accordingly, it is impossible to send a packet to the desired tc class). Therefore, we do shaping for incoming traffic, and for outgoing traffic we have to use polishing.
Actually the question is: How can I use speeding for several ips using polising? For example, the contract has 3 ip addresses and you need to make sure that the speed is shared between this group of ip addresses. Naturally, all this needs to be implemented in the context of hash tables.
What is now - a small but full piece of config limiting traffic on one ip
tc filter add dev eth2 parent 1:0 prio 30 handle 2: protocol ip u32 divisor 256 tc filter add dev eth2 parent ffff: prio 30 handle 2: protocol ip u32 divisor 256 tc filter add dev eth2 protocol ip parent 1:0 prio 30 u32 ht 800:: match ip dst 192.168.222.0/24 hashkey mask 0x000000ff at 16 link 2: tc filter add dev eth2 protocol ip parent ffff: prio 30 u32 ht 800:: match ip src 192.168.222.0/24 hashkey mask 0x000000ff at 12 link 2: tc filter add dev eth2 parent 1: protocol ip prio 30 u32 ht 2:c7 match ip dst 192.168.222.199 flowid 1:a03 tc filter add dev eth2 parent ffff: protocol ip prio 30 u32 ht 2:c7 match ip src 192.168.222.199 police rate 4096000 burst 409600b drop flowid ffff: tc class add dev eth2 parent 1:1 classid 1:a03 htb rate 4096000