Last active
January 27, 2021 20:55
-
-
Save MaxMatti/49fdcad2d089a3da7425ac95dea5d2e0 to your computer and use it in GitHub Desktop.
This script monitors the incoming and outgoing bandwidth of a server on localhost.
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
#!/usr/bin/env bash | |
SERVERPORT=$1 | |
sudo iptables -A INPUT -p tcp --dport "$SERVERPORT" | |
sudo iptables -A OUTPUT -p tcp --sport "$SERVERPORT" | |
watch -n 1 sudo iptables -n -L -v -Z | |
sudo iptables -D INPUT -p tcp --dport "$SERVERPORT" | |
sudo iptables -D OUTPUT -p tcp --sport "$SERVERPORT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This measures the bandwidth to/from all clients combined. To see each client separately, check out this script.