Monitor bandwidth consumption with iptables
A method to measure how much bandwidth is consumed for e.g. a nmap scan against a specific host can be done with iptables in Linux.
Run following to monitor bandwidth to and from 10.10.10.233:
1 2 3 4 |
iptables -I INPUT 1 -s 10.10.10.233 -j ACCEPT iptables -I OUTPUT 1 -d 10.10.10.233 -j ACCEPT iptables -Z |
Then run command against host, e.g “nmap -p- 10.10.10.233”.
Then to show bandwidth for IP in scope:
1 2 |
iptables -vn -L |
Above screenshot shows 3.1 MB out and 2.7 MB inbound to and from the specific host.
To clear the iptables stats table run:
1 2 |
iptables -Z |