#!/bin/sh # # https://www.bufferbloat.net/projects/codel/wiki/Cake/ ETH=eth1 MTU=1492 # https://www.sonicwall.com/support/knowledge-base/how-can-i-optimize-pppoe-connections/170505851231244/ # https://blog.cloudflare.com/path-mtu-discovery-in-practice/ # https://www.baeldung.com/linux/maximum-transmission-unit-mtu-ip # https://www.cisco.com/c/en/us/support/docs/ip/transmission-control-protocol-tcp/200932-Ethernet-MTU-and-TCP-MSS-Adjustment-Conc.html ip link set mtu $MTU dev $ETH # https://apenwarr.ca/log/20110110 DOWN=45mbit UP=9mbit { modprobe sch_cake modprobe act_mirred tc qdisc del dev $ETH root tc qdisc del dev $ETH ingress ip link del name ifb4$ETH } 2>/dev/null test "$1" = "clear" && exit tc qdisc add dev $ETH \ root cake \ bandwidth $UP \ ack-filter test "$1" = "up" && exit # tc qdisc add dev eth0 root cake help # # Usage: ... cake [ bandwidth RATE | unlimited* | autorate-ingress ] # [ rtt TIME | datacentre | lan | metro | regional | # internet* | oceanic | satellite | interplanetary ] # [ besteffort | diffserv8 | diffserv4 | diffserv3* ] # [ flowblind | srchost | dsthost | hosts | flows | # dual-srchost | dual-dsthost | triple-isolate* ] # [ nat | nonat* ] # [ wash | nowash* ] # [ split-gso* | no-split-gso ] # [ ack-filter | ack-filter-aggressive | no-ack-filter* ] # [ memlimit LIMIT ] # [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ] # [ mpu N ] [ ingress | egress* ] # (* marks defaults) # INGRESS ip link add name ifb4$ETH type ifb tc qdisc add dev $ETH handle ffff: ingress tc qdisc add dev ifb4$ETH \ root cake \ bandwidth $DOWN \ besteffort ip link set ifb4$ETH up tc filter add dev $ETH parent ffff: matchall \ action mirred egress redirect dev ifb4$ETH