Created
June 12, 2025 14:41
-
-
Save sjtosco/8f5838806f4fc6ae5914038d0d7431e4 to your computer and use it in GitHub Desktop.
limit_100k.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Verifica que se haya pasado el nombre de la interfaz | |
if [[ -z "$1" ]]; then | |
echo "❌ Error: Debes pasar el nombre de la interfaz como argumento." | |
echo "👉 Uso: $0 <nombre_interfaz>" | |
exit 1 | |
fi | |
iface="$1" | |
bw="100kbit" | |
echo "🎯 Aplicando limitación de $bw a $iface..." | |
# Elimina cualquier configuración previa | |
sudo tc qdisc del dev "$iface" root 2>/dev/null | |
# Aplica la nueva limitación | |
sudo tc qdisc add dev "$iface" root tbf rate "$bw" latency 50ms burst 1540 && \ | |
echo "✔️ Limitación aplicada correctamente a $iface." || \ | |
echo "❌ Error al aplicar la limitación a $iface." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use:
Limit iface enp0s20u1:
./limit_100k.sh enp0s20u1