Solved

Resetting 'netstat' output

Posted on 2011-03-10
3
4,745 Views
Last Modified: 2012-05-11

Is there any option to reset the 'netstat -i' output in Linux ?  Today we observed heavy packet drops on production linux server. We did some network settings tweak, after which we tried to see if any packet drops are happening. I felt it would be nice if I can clear all the previous packet drops information and start monitoring it from zero values. Please let me know if you know it.

Thanks.
0
Comment
Question by:ashsysad
3 Comments
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 100 total points
ID: 35106456
Hi,

some netstat implementations support the "-Z" option.

Together with the appropriate option letter it clears the associated statistics:

"netstat -Zc"    - Network Buffer Cache
"netstat -Zi"     - state of all configured interfaces
"netstat -Zm"   - statistics recorded by the memory management routines
"netstat -Zs"    - statistics for each protocol

If this flag is not supported (or used for other purposes), netstat itself will not be capable to clear its statistics.
They will only be reset on reboot.

wmp
0
 
LVL 12

Accepted Solution

by:
upanwar earned 100 total points
ID: 35108003

According to Linux network developers, the network counters are not supposed to be reset. If you really want to this you hack the kernel code to this.

A simple but not so straight forward method is to stop the network interface remove the driver and reload the driver back, this will reset counter values to 0.

http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1299842223781+28353475&threadId=864824
0
 

Author Closing Comment

by:ashsysad
ID: 35113312
Thanks for the explanation guys !!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now