LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 02-13-2009, 05:26 AM   #1
pfrancois
LQ Newbie
 
Registered: Sep 2005
Location: Antwerp (Belgium)
Distribution: Ubuntu
Posts: 11

Rep: Reputation: 0
measuring traffic with netstat


Hello

The output of
Code:
netstat -e -i | awk '/^eth/,/^$/'
gives me
Code:
eth0      Link encap:Ethernet  HWaddr [...]  
          inet addr:192.168.[...]  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: [...]/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:183698 errors:0 dropped:0 overruns:0 frame:0
          TX packets:105432 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:219946959 (219.9 MB)  TX bytes:12666864 (12.6 MB)
          Interrupt:11 Base address:0x3000
which gives me an idea of my bandwidth consumption since the system is up, I suppose.

I would like to know:

a) where netstat is finding the information about RX and TX bytes, and

b) if this information is reliable.

An other option is to tell me how to browse the code of netstat.

Thanks in advance.

Last edited by pfrancois; 02-13-2009 at 05:28 AM. Reason: binary addresses replaced by [...] for privacy
 
Old 02-13-2009, 06:11 AM   #2
*******
Member
 
Registered: Feb 2009
Posts: 63

Rep: Reputation: 16
Quote:
Originally Posted by pfrancois View Post
where netstat is finding the information about RX and TX bytes, and if this information is reliable.
Anything "alive" get shown through /proc. If you mean reliability as in any 32 or 64-bit counters resetting then you could use an external tool to tally like 'vnstat'?
 
Old 02-13-2009, 06:21 AM   #3
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 4
Posts: 4,305

Rep: Reputation: 205Reputation: 205Reputation: 205
Quote:
Originally Posted by pfrancois View Post
a) where netstat is finding the information about RX and TX bytes
From the /proc directory.
Quote:
b) if this information is reliable.
In what sense? and for what purpose?
Quote:
An other option is to tell me how to browse the code of netstat.
Open the netstat binary with vi (or your preferred) editor.
 
Old 02-13-2009, 08:13 AM   #4
pfrancois
LQ Newbie
 
Registered: Sep 2005
Location: Antwerp (Belgium)
Distribution: Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by {BBI}Nexus{BBI} View Post
From the /proc directory. In what sense? and for what purpose?
OK, I supposed that, but I am looking in which file specifically.

Quote:
Originally Posted by {BBI}Nexus{BBI} View Post
Open the netstat binary with vi (or your preferred) editor.
No, I mean I want to browse the source code of netstat, obviously , online if possible, v.gr with a browser through http without downloading a tarball, expanding it, etc...

Thanks anyway for the reactions.
 
Old 02-13-2009, 08:20 AM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 53
/proc/net/netstat on my kernel. But might be somewhere else in /proc/net. /proc/net/tcp gives active tcp connections.
Yes, it's reliable.
 
Old 02-13-2009, 09:12 AM   #6
pfrancois
LQ Newbie
 
Registered: Sep 2005
Location: Antwerp (Belgium)
Distribution: Ubuntu
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by nx5000 View Post
/proc/net/netstat on my kernel. But might be somewhere else in /proc/net. /proc/net/tcp gives active tcp connections.
Yes, it's reliable.
Thanks nx5000
 
  


Reply

Tags
netstat


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 01:09 AM
Measuring/Monitoring traffic for VMWare guests xabin Linux - Server 3 03-11-2008 12:07 PM
Router box measuring network traffic pavlom Linux - Enterprise 1 01-04-2007 06:34 AM
Measuring Network Traffic shipon_97 Linux - Networking 0 04-12-2006 12:13 PM
Wireless traffic stomps isdn traffic on gateway machine Radix999 Linux - Wireless Networking 0 11-14-2003 01:54 AM


All times are GMT -5. The time now is 10:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration