Linux‎ > ‎

iptables count rule setup

Thank you for visiting this page, this page has been update in another link iptables count rule setup
Simple stuff , but works perfect if you want to monitor some particular transfers between nodes.

/etc/sysconfig/iptables on the client host. Just below the line *filter Add rules like: ### count rules below ### :count-rule - [0:0] -A INPUT -j count-rule -A OUTPUT -j count-rule # add both rules below for each host you want to monitor -A count-rule -d <remote host to monitor> -A count-rule -s <remote host to monitor> ### end counting rules ### Restart iptables: # service iptables restart Flushing firewall rules: [ OK ] Setting chains to policy ACCEPT: filter [ OK ] Unloading iptables modules: [ OK ] Applying iptables firewall rules: [ OK ] Loading additional iptables modules: ip_conntrack_netbios_n[ OK ] # Now you can check the packets/bytes using: # iptables -v -n -L count-rule Chain count-rule (2 references) pkts bytes target prot opt in out source destination 44 2960 all -- * * 0.0.0.0/0 24.85.243.94 30 22040 all -- * * 24.85.243.94 0.0.0.0/0 # and if you want to zero the counters, use: # iptables -Z count-rule

Tested on Scientific Linux and RHEL.

Comments