Traffic shaping per IP

hello there. i would like in my LAN(192.168.1.0/24) to do a traffic shaping per IP, like the following example:

  • xDSL with 50/5Mbps
  • -The IP 192.168.1.2 to have 8Mbps/768kbps
  • -The IP 192.168.1.3 to have 5Mbps/1Mbps
  • -The range 192.168.1.50-99 to share 3Mbps/512k
  • -All the rest do not apply any traffic shaping

How can i achieve that please?

i used the nfttables, but it is not that easy and accurate to be used. For starts you have to do all the conversion from MBytes/s to kbps and the opposite. Then if you add and IP to limit the traffic, it does not start having effect immediately, rather it will be "enabled" on next reboot, or the IP disconecction/reconnection. Also the deviation from the value you put in MBytes/s to kbps varies a lot.
Is there an alternative tool or a better way to use nfttables to create the aforementioned traffic shapes, please?

I have tried with the SQM as well, but it is not that accurate on the traffic.
I need a solution to give for example 10Mbps/1512kbps down/up on one IP and 2Mbps/2Mbps on another and i have many rules that i would like to create on my LAN. Is there any tool that i could this on the fly, please?

You can just create your own script for sqm, have a look at simple.qos and build your own hierarchy of HTB instances.

Keep in mind though that some of your tiers are painfully slow, 513 kbps shared uplink is not going to be fun.
Also creating filtering rules for internal IP address ranges will not work with ingress shaping on the wan interface.

i do not have an idea on how to create a script manually for sqm.

The easiest way is to make a copy of /usr/lib/simple.qos, say /usr/lib/atux_null.qos and then edit that script tp do what you want. In the GUI you then should be able to select atux_null.qos. That still leaves the challenge to edit the file to do what you want.

If this is your design/policy, you will need to implement it somehow.

By simple point and click, probably not.

i am kinda naive on this area and i have lost it.

try https://github.com/tohojo/sqm-scripts/tree/master/src

You might take a look at this thread...

iptables -t mangle -A INPUT -s 192.168.1.103 -m limit --limit 128k -j ACCEPT
iptables -t mangle -A INPUT -s 192.168.1.131 -m limit --limit 128k -j ACCEPT
iptables -t mangle -A INPUT -s 192.168.1.126 -m limit --limit 128k -j ACCEPT
iptables -t mangle -A INPUT -s 192.168.1.103 -j DROP
iptables -t mangle -A INPUT -s 192.168.1.131 -j DROP
iptables -t mangle -A INPUT -s 192.168.1.126 -j DROP
iptables -t mangle -A FORWARD -s 192.168.1.103 -j LIMIT_DOWNLOAD
iptables -t mangle -A FORWARD -s 192.168.1.131 -j LIMIT_DOWNLOAD
iptables -t mangle -A FORWARD -s 192.168.1.126 -j LIMIT_DOWNLOAD
iptables-save