Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Oct 2006 07:22:03 +0200
From:      Max Laier <max@love2party.net>
To:        freebsd-net@freebsd.org
Cc:        Dan b <thedanyes@yahoo.com>
Subject:   Re: reset netstat statistics
Message-ID:  <200610150722.09919.max@love2party.net>
In-Reply-To: <20061014071416.64065.qmail@web56508.mail.re3.yahoo.com>
References:  <20061014071416.64065.qmail@web56508.mail.re3.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart3769149.ZUTpy8zbdG
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Saturday 14 October 2006 09:14, Dan b wrote:
> I searched the archives for this and was unable to
> find anything relevant.  I have a machine that is
> being used as a NAT Router with IPFW and IPNAT running
> 5.3-RELEASE.  I'm only using IPFW to keep track of
> traffic, no actual packet filtering is going on.

I recommend that you use pf for that.  A simple pfctl -e with no ruleset=20
will get you 64bit packet and byte counters for all interfaces using=20
pfctl -vvsI or for a specific interface with:

> 7:14 [~]amd64# pfctl -vvsI -i fxp0
> fxp0    (instance, attached)
>  Cleared:     Fri Sep 29 23:24:37 2006
>  References:  [ States:  0                  Rules: 15                 ]
>  In4/Pass:    [ Packets: 46986037           Bytes: 28315507365        ]
>  In4/Block:   [ Packets: 0                  Bytes: 0                  ]
>  Out4/Pass:   [ Packets: 43460700           Bytes: 40071770000        ]
>  Out4/Block:  [ Packets: 0                  Bytes: 0                  ]
>  In6/Pass:    [ Packets: 9982               Bytes: 3320321            ]
>  In6/Block:   [ Packets: 0                  Bytes: 0                  ]
>  Out6/Pass:   [ Packets: 5259               Bytes: 418780             ]
>  Out6/Block:  [ Packets: 3                  Bytes: 192                ]

> The problem is that the statistics reported by netstat
> seem to reset themselves intermittently.  Last night I
> ran netstat -ib and got an Ibytes stat of around 2.1GB
> on my sis0 adapter.  Today I ran netstat -ib and got
> an Ibytes stat of around 600MB on my sis0 adapter.
> The system has around 29 days of uptime, and I have
> run ipfw zero a few times, but have not run netstat -z
> at all.  Let me know if you have any ideas about this.

This is because the numbers reported by netstat are based on (signed)=20
32bit counters.  Either you sample these numbers at a high enough rate or=20
you use other 64bit counters (see above).

=2D-=20
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

--nextPart3769149.ZUTpy8zbdG
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQBFMcWBXyyEoT62BG0RAtfnAJ9PSgQq+d/NCd2heAAy9VsktCbwygCePoxU
jTNU8z3EXFZvtB8NxmHs7Ak=
=6NHp
-----END PGP SIGNATURE-----

--nextPart3769149.ZUTpy8zbdG--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610150722.09919.max>