Bufferbloat-reducing shaper configuration with different bandwidth limits for LAN, in-country and international traffic

Hello,

I have a FTTH being terminated directly in a Turris Omnia's SFP cage. The router runs an OpenWrt snapshot image with a .dtb file extracted from TurrisOS in order to enable the SFP cage.

My ISP offers three 'tiers' of bandwidth:

  • 1gbps between its clients
  • 300mbps for in-country traffic
  • 100mbps for international traffic

Unfortunately this set-up seems to be a bit above the scope of sqm-scripts :frowning:

After scouring the web for documentation of a similar configuration, the closest thing I could come up with was the following:

tc qdisc add dev eth2 root handle 1:0 htb default 100
tc class add dev eth2 parent 1:0 classid 1:100 htb rate 1gbit
tc class add dev eth2 parent 1:0 classid 1:300 htb rate 1gbit
tc class add dev eth2 parent 1:0 classid 1:1000 htb rate 1gbit
tc qdisc replace dev eth2 parent 1:1000 cake bandwidth 990mbit ethernet diffserv4 dual-srchost nat
tc qdisc replace dev eth2 parent 1:300 cake bandwidth 243mbit ethernet diffserv4 dual-srchost nat
tc qdisc replace dev eth2 parent 1:100 cake bandwidth 90mbit ethernet diffserv4 dual-srchost nat

tc qdisc add dev eth2 handle ffff: ingress

ip link add name ifb4eth2 type ifb
tc qdisc add dev ifb4eth2 root handle 1:0 htb default 100
tc class add dev ifb4eth2 parent 1:1 classid 1:100 htb rate 1gbit
tc class add dev ifb4eth2 parent 1:1 classid 1:300 htb rate 1gbit
tc class add dev ifb4eth2 parent 1:1 classid 1:1000 htb rate 1gbit
tc qdisc replace dev ifb4eth2 parent 1:1000 cake bandwidth 960mbit diffserv4 ethernet dual-dsthost nat ingress
tc qdisc replace dev ifb4eth2 parent 1:300 cake bandwidth 244mbit diffserv4 ethernet dual-dsthost nat ingress
tc qdisc replace dev ifb4eth2 parent 1:100 cake bandwidth 90mbit diffserv4 ethernet dual-dsthost nat ingress
ip link set ifb4eth2 up
tc filter add dev eth2 parent ffff:  matchall action mirred egress redirect dev ifb4eth2

# Filters for country-local prefixes:
tc filter add dev eth2 protocol ip parent 1:0 prio 1 u32 match ip dst 2.56.12.0/22 flowid 1:300
tc filter add dev ifb4eth2 protocol ip parent 1:0 prio 1 u32 match ip src 2.56.12.0/22 flowid 1:300
... 

# Filters for ISP-local prefixes:
tc filter add dev eth2 protocol ip parent 1:0 prio 1 u32 match ip dst 77.238.64.0/19 flowid 1:1000
tc filter add dev ifb4eth2 protocol ip parent 1:0 prio 1 u32 match ip src 77.238.64.0/19 flowid 1:1000
...

My question is is there a better way to implement this? Maybe something simpler than HTB above CAKE?

1 Like