Hi everyone! i just wanted to share this.
I'm doing 4g over tethering on a RPI4.
i'm using mwan3 for load balancing between an iphone SE 2022(5g ) and s9 starlte connected through the usb cable to the rpi4 to increase total bandwith(no gb limit on both sims, the s9 is dedicated with lineageOS installed on it and 0 gapps, the iphone is my personal phone and i attach it when i'm home to increase total bandwith)
I can do A+ on waveform bufferbloat even while bittorrent is saturating the connection.
First file is custom_cake.qos that needs to be put in /usr/lib/sqm/
. ${SQM_LIB_DIR}/defaults.sh
QDISC=cake
EGRESS_CAKE_OPTS="${EGRESS_CAKE_OPTS} diffserv4 rtt 5ms "
INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS diffserv4 rtt 5ms "
egress() {
SILENT=1 $TC qdisc del dev $IFACE root
$TC qdisc add dev $IFACE root $( get_stab_string ) cake \
bandwidth ${UPLINK}kbit $( get_cake_lla_string ) ${EGRESS_CAKE_OPTS} ${EQDISC_OPTS}
}
ingress() {
SILENT=1 $TC qdisc del dev $IFACE handle ffff: ingress
$TC qdisc add dev $IFACE handle ffff: ingress
SILENT=1 $TC qdisc del dev $DEV root
[ "$IGNORE_DSCP_INGRESS" -eq "1" ] && INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS besteffort"
[ "$ZERO_DSCP_INGRESS" -eq "1" ] && INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS wash"
# Ensure that DSCP markings are honored
#INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS diffserv4"
# Prioritize different classes based on DSCP markings
case "$DSCP" in
"CS7") INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS priority 1" ;;
"CS6") INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS priority 2" ;;
"CS4") INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS priority 3" ;;
"CS5") INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS priority 4" ;;
"CS1") INGRESS_CAKE_OPTS="$INGRESS_CAKE_OPTS priority 5" ;;
esac
$TC qdisc add dev $DEV root $( get_stab_string ) cake \
bandwidth ${DOWNLINK}kbit $( get_cake_lla_string ) ${INGRESS_CAKE_OPTS} ${IQDISC_OPTS}
$IP link set dev $DEV up
# Redirect all IP packets arriving in $IFACE to ifb0
$TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \
match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV
}
sqm_prepare_script() {
do_modules
verify_qdisc $QDISC "cake" || return 1
}
Corresponding example firewall rules:
Add these lines into /etc/config/firewall
config rule
option name 'DNS and ICMP'
list proto 'tcp'
list proto 'udp'
option set_dscp 'CS7'
option counter '0'
option dest_port '53 853 5353'
option target 'DSCP'
option src '*'
option dest '*'
config rule
option name 'League of Legends'
list proto 'udp'
option set_dscp 'CS6'
option counter '0'
option dest_port '5000-5500 8393-8400'
option target 'DSCP'
option src '*'
config rule
option name 'HTTPS'
list proto 'tcp'
list proto 'udp'
option set_dscp 'CS5'
option counter '0'
option dest_port '443'
option target 'DSCP'
option src '*'
config rule
option name 'BitTorrent'
list proto 'tcp'
list proto 'udp'
option set_dscp 'CS1'
option counter '0'
option dest_port '6881-6889 6969 1337 6960-6969 6881'
option target 'DSCP'
option src '*'
config rule
option name 'Other-Traffic'
list proto 'tcp'
list proto 'udp'
option set_dscp 'CS3' # Adjust DSCP as needed
option counter '0'
option dest_port '0-65535' # Adjust port range as needed
option target 'DSCP'
option src '*'
option dest '*'
SQM config file:
This one is directly into /etc/config/sqm. adjust the interface names and bandwith limits as you see fit.
In my case i have 2 WANs with 50% load balancing throgh mwan3.
config queue
option interface 'eth1'
option enabled '1'
option download '70000'
option upload '10000'
option script 'custom_cake.qos'
option qdisc_advanced '1'
option linklayer 'ethernet'
option overhead '44'
option linklayer_advanced '1'
option wash '0'
option qdisc 'cake'
option ehard 'default'
option quantum '3000'
option qdisc_really_really_advanced '1'
option flows '1024'
option flowhash '1'
option mpu '64'
option target 'default'
option interval '50'
option burst '1600'
option linklayer_adaptation_mechanism 'cake'
option flent '0'
option ingress_ecn 'ECN'
option egress_ecn 'ECN'
option ecn 'ECN'
option dequeue_ecn 'ECN'
option debug_logging '0'
option verbosity '5'
option squash_dscp '0'
option squash_ingress '0'
option tcMTU '1484'
option tcTSIZE '128'
option tcMPU '64'
option itarget '10'
option etarget '10'
config queue
option interface 'usb0'
option enabled '1'
option download '70000'
option upload '10000'
option script 'custom_cake.qos'
option qdisc_advanced '1'
option linklayer 'ethernet'
option overhead '44'
option linklayer_advanced '1'
option wash '0'
option qdisc 'cake'
option ehard 'default'
option quantum '3000'
option qdisc_really_really_advanced '1'
option flows '1024'
option flowhash '1'
option mpu '64'
option target 'default'
option interval '50'
option burst '1600'
option linklayer_adaptation_mechanism 'cake'
option flent '0'
option ingress_ecn 'ECN'
option egress_ecn 'ECN'
option ecn 'ECN'
option dequeue_ecn 'ECN'
option debug_logging '0'
option verbosity '5'
option squash_dscp '0'
option squash_ingress '0'
option tcMTU '1484'
option tcTSIZE '128'
option tcMPU '64'
option itarget '10'
option etarget '10'
4g tether is a refurbished s9. Best 4g modem ever by performance to price.
i honestly gonna try increase the donwload bandwith a bit and see if i can still keep latency under control.
Feel free to add this to the project if anyone wants to
x750 honestly is so bad. switched over to this solution.