Increasing Network Speed with the example of Raspberry Pi4 and Raspbian

I could increase the maximum internet download speed of my Raspberry Pi4 running with the most current Raspbian 64 bit kernel from 60-70 MB/s to a bit over 90 MB/s with the following adjustments. Please note many servers limit downloads e.g. to 400 Mbit/s, even speed test servers.

1. A bash script - you could post this into /etc/rc.local:
# network speed
iface=eth0

# speed up internet - https://datatag.web.cern.ch/datatag/howto/tcp.html
/sbin/ifconfig $iface txqueuelen 8000
echo 8000 > /proc/sys/net/core/netdev_max_backlog
ip link set $iface qlen 20000

# google bbr - https://www.tecmint.com/increase-linux-server-internet-speed-with-tcp-bbr/
sysctl -w net.core.default_qdisc=fq
sysctl -w net.ipv4.tcp_congestion_control=bbr

# https://www.cyberciti.biz/faq/rhel-centos-fedora-debian-configure-rx-polling-mode/
ethtool -C $iface adaptive-rx on

# https://cromwell-intl.com/open-source/performance-tuning/ethernet.html
ethtool -K $iface tx-checksum-ipv4 on
ethtool -K $iface tx-checksum-ipv6 on

# not supported https://cromwell-intl.com/open-source/performance-tuning/ethernet.html
# ethtool -A $iface rx on
# ethtool -A $iface tx on
# ethtool -G $iface rx 4096 tx 4096

Kernel tweaks, you could put this in /etc/sysctl.d/99-netspeed.conf

# https://serverfault.com/a/758350
kernel.sem = 350 358400 64 1024
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 4194304
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_adv_win_scale = 2
net.ipv4.tcp_moderate_rcvbuf = 1
net.ipv4.tcp_rmem = 4096 262144 4194304
net.ipv4.tcp_wmem = 4096 262144 4194304
net.ipv4.tcp_keepalive_time = 900
net.ipv4.tcp_keepalive_intvl = 900
net.ipv4.tcp_keepalive_probes = 9

3. Installing irqbalance:
sudo apt install irqbalance

4. Reboot

Enjoy!