Книга: Linux Network Administrator Guide, Second Edition
Resetting the Counters
Resetting the Counters
The IP accounting counters will overflow if you leave them long enough. If they overflow, you will have difficulty determining the value they actually represent. To avoid this problem, you should read the accounting data periodically, record it, and then reset the counters back to zero to begin collecting accounting information for the next accounting interval.
The ipfwadm and ipchains commands provide you with a means of doing this quite simply:
#
ipfwadm -A -z
or:
#
ipchains -Z
or:
#
iptables -Z
You can even combine the list and zeroing actions together to ensure that no accounting data is lost in between:
#
ipfwadm -A -l -z
or:
#
ipchains -L -Z
or:
#
iptables -L -Z -v
These commands will first list the accounting data and then immediately zero the counters and begin counting again. If you are interested in collecting and using this information regularly, you would probably want to put this command into a script that recorded the output and stored it somewhere, and execute the script periodically using the cron command.
- 4.4.4 The Dispatcher
- About the author
- Chapter 7. The state machine
- Appendix E. Other resources and links
- Example NAT machine in theory
- The final stage of our NAT machine
- Compiling the user-land applications
- The conntrack entries
- Untracked connections and the raw table
- Basics of the iptables command
- Other debugging tools
- Setting up user specified chains in the filter table