Skip to content

Instantly share code, notes, and snippets.

@BenKnisley
Created May 10, 2015 12:37
Show Gist options
  • Save BenKnisley/8034e559c54e52cf98dd to your computer and use it in GitHub Desktop.
Save BenKnisley/8034e559c54e52cf98dd to your computer and use it in GitHub Desktop.
Iptables Traffic Monitor
## Create new chain
iptables -N <Name>
## Create outgoing monitor
iptables -A INPUT -s <IpAddr> -j <Name>
## Create incoming monitor
iptables -D INPUT -s <IpAddr> -j <Name>
## Delete outgoing
iptables -D INPUT -s <IpAddr> -j <Name>
## Delete incomming
iptables -D OUTPUT -d <IpAddr> -j <Name>
## Delete chain
iptables -X <Name>
## To read outgoing
iptables -L INPUT -vnx | grep <Name>
## To read incomming
iptables -L OUTPUT -vnx | grep <Name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment