#!/bin/bash -xe # Interface towards UPF: IFACE_UPF="enp2s0f0np0" IPADR_UPF="172.16.32.1" NUM_CN=50 # Disable ethernet flow control: sudo ethtool -A $IFACE_UPF autoneg off rx off tx off # Increase NIC buffers: sudo ethtool -G $IFACE_UPF rx 8192 tx 8192 # Increase Adapter Transmit Queue: sudo ip link set dev $IFACE_UPF txqueuelen 2000 # Increase UDP buffer memory: sudo sysctl -w net.ipv4.udp_mem="763563 900000000 1000000000" sudo sysctl -w net.core.optmem_max=16000000 sudo sysctl -w net.core.rmem_max=2000000000 sudo sysctl -w net.core.rmem_default=2000000000 sudo sysctl -w net.core.wmem_max=2000000000 sudo sysctl -w net.core.wmem_default=2000000000 sudo sysctl -w net.core.netdev_max_backlog=2000 sudo sysctl -w net.core.netdev_budget=600 # Set up CN IP addresses: for i in $(seq "0" "$((NUM_CN - 1))"); do sudo ip addr add "$(printf "172.16.32.2%02u/24" $i)" brd 172.16.32.255 dev $IFACE_UPF || true; done sudo ip route add 192.168.0.0/16 via $IPADR_UPF dev $IFACE_UPF