Simple command to view bandwidth usage on eth0?


Recommended Posts

Hey all,

After much Googling, I can't seem to find a command that just tells me how much traffic has passed through eth0, surely there must be one?

All I need is a command I can run which outputs something like "Down: 100GB - Up: 600GB".

Any suggestions? I've got root access to the box and it's running CentOS 5.2 in a remote datacenter.

Cheers!

The figures that is giving me are totally wrong:

Last login: Wed Sep 24 20:56:34 on ttys000
macbook:~ alex$ ssh root@fluxriver.com
root@flxuriver.com'ssword: 
Last login: Tue Sep 23 01:04:30 2008 from dyn-62-56-72-181.dslaccess.co.uk
[root@conquer01 ~]# uptime
 20:57:54 up 21 days, 21:52,  1 user,  load average: 0.01, 0.02, 0.00
[root@conquer01 ~]# ifconfig eth0
eth0	  Link encap:Ethernet  HWaddr 00:19:B9:FA:3B:8C  
		  inet addr:62.212.74.70  Bcast:62.212.74.127  Mask:255.255.255.192
		  inet6 addr: fe80::219:b9ff:fefa:3b8c/64 Scope:Link
		  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
		  RX packets:232437919 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:361855838 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:1000 
		  RX bytes:2483042813 (2.3 GiB)  TX bytes:15682671 (14.9 MiB)
		  Interrupt:169 
[root@conquer01 ~]#

I know for a fact that it's done at least 626GB this month, because the bandwidth graphs on Leaseweb's site show so, along with a PHP script I'm running on it at the moment, which shows it more like 1.1TB so far this month:

post-176093-1222286887.png

post-176093-1222286964.png

Maybe your main network is something else? Try just plain 'ifconfig' and see if any of the interfaces match your b/w usage. That or leaseweb measured it wrong.

Btw, direct ssh root login and running sshd on default port is a bad idea security-wise.

If you aren't a fan of just using the count in ifconfig, maybe a more advanced tool would suit your needs a bit more?

http://www.ubuntugeek.com/bandwidth-monito...-for-linux.html

That link lists several, though I have never used any of them.

Might I point out that if you are interested in your network bandwidth to your ISP, then monitoring at your router would be the correct option, especially if you have multiple devices on your home network.

  zer0day said:
Maybe your main network is something else? Try just plain 'ifconfig' and see if any of the interfaces match your b/w usage. That or leaseweb measured it wrong.

Btw, direct ssh root login and running sshd on default port is a bad idea security-wise.

So is posting ip addresses.. But anyways.

  markjensen said:
Might I point out that if you are interested in your network bandwidth to your ISP, then monitoring at your router would be the correct option, especially if you have multiple devices on your home network.

Unfortunately in this case and many others this is a server in a DC.

  zer0day said:
Maybe your main network is something else? Try just plain 'ifconfig' and see if any of the interfaces match your b/w usage.

root@fluxriver.com'ssword: 
Last login: Thu Sep 25 00:01:11 2008 from dyn-62-56-72-181.dslaccess.co.uk
[root@conquer01 ~]# ifconfig
eth0	  Link encap:Ethernet  HWaddr 00:19:B9:FA:3B:8C  
		  inet addr:62.212.74.70  Bcast:62.212.74.127  Mask:255.255.255.192
		  inet6 addr: fe80::219:b9ff:fefa:3b8c/64 Scope:Link
		  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
		  RX packets:247189119 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:382622310 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:1000 
		  RX bytes:3827389172 (3.5 GiB)  TX bytes:946068225 (902.2 MiB)
		  Interrupt:169 

lo		Link encap:Local Loopback  
		  inet addr:127.0.0.1  Mask:255.0.0.0
		  inet6 addr: ::1/128 Scope:Host
		  UP LOOPBACK RUNNING  MTU:16436  Metric:1
		  RX packets:154632 errors:0 dropped:0 overruns:0 frame:0
		  TX packets:154632 errors:0 dropped:0 overruns:0 carrier:0
		  collisions:0 txqueuelen:0 
		  RX bytes:18357121 (17.5 MiB)  TX bytes:18357121 (17.5 MiB)

[root@conquer01 ~]#

  Mike said:
the values in ifconfig reset to zero after 4GiB

I was under the impression that was just on Windows?

Edit: I stand corrected after a quick Google. Hmm..

  markjensen said:
Might I point out that if you are interested in your network bandwidth to your ISP, then monitoring at your router would be the correct option, especially if you have multiple devices on your home network.

The box is in a datacenter.

  pyther said:
Look at a program called vnstat this should do exactly what you want (command line util)

I installed this about a week ago. Just updated it now, for some reason it's only showing my today and yesterday. Do you have to update it once a day?

[root@conquer01 ~]# vnstat -u
[root@conquer01 ~]# vnstat
Database updated: Sat Sep 27 13:48:40 2008

	eth0

	   received:	   9.33 GB (27.4%)
	transmitted:	  24.66 GB (72.6%)
		  total:	  33.99 GB

					rx	 |	 tx	 |  total
	-----------------------+------------+-----------
	yesterday	  6.02 MB |  243.14 MB |  249.16 MB
		today	264.14 MB |   12.10 GB |   12.35 GB
	-----------------------+------------+-----------
	estimated	   459 MB |   21.04 GB |   21.48 GB

Edited by -Alex-
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • ...if there is any question if it's fake ... Steve Gibson created a little program to detect fraudulent drives.   https://www.grc.com/validrive.htm
    • Hello   Would anyone know by chance regarding the Lian Li Lancool 216 ARGB/Fan hub specifically where the front fans would connect to, to be able to see there RPM in UEFI bios when setting up the fan curves,   i am not a hardware expert, mostly a noob on Hardware still,  trying to learn as much as i can, but its a slow process. Did get Dust clean out done on system, and Temps are much much better,  even during a Defender scan previously i'd hit 85C or higher at times, today despite RL temp being humid and warmer today a bit,  didn't hardly go over 60C.     So i definitely cleaned system good this time!! Did the clean out after early afternoon storms ended!! **Note did not build system myself, had Ibuypower Build my Dream Ryzen Build, normally i don't mention that part as sometimes i feel ashamed that i can't build a whole system myself**  Even my last system before this one had Local PC shop build that one, it ran ok, but even after getting the upgraded cooler installed they said this should work,    still throttled when doing tasks.     My AMD Never Throttles!! I also tend to worry alot, just my nature i guess  
    • Did you just buy this drive? Were you ever able to use the full capacity, or you bought this new/only shows 3 GB? If this is new, then you probably got a fake.
    • Steam overlay's FPS counter gets major upgrade to show CPU and VRAM usage, temps, and more by Pulasthi Ariyasinghe Valve has been steadily revamping its Steam client for years now, with major updates hitting the PC store and platform targeting various parts. The next target has been revealed to be the very popular performance monitor that's a part of the Steam overlay. While the current version only shows a number in a small area to count the current frame rate of the game that's running, the update is giving much more information to the user. Now available via the Steam Beta client, the performance monitor now has multiple detail levels to choose from. These are FPS Single Value (the original version), FPS Detail & Graph, FPS Detail CPU & GPU Utilization, as well as the behemoth FPS Detail & Graph, CPU, GPU, & RAM Details options. As expected, each option adds more and more information to what's shown to the user on the overlay. Screen position, contrast and saturation, as well as background opacity, can also be adjusted from the same overlay settings page. The image above shows the maximum detail option available for users, with everything from generated frames to helpful graphs and VRAM information being shown while playing a game. "The performance monitor can help you understand your frame rate (both including frame generation, and base game frame rate), and it can help you see if CPU utilization might be your bottleneck, or if your GPU is," says Valve regarding its latest upgrade. "You can see if you are out of system or video memory and if those factors are impacting performance as well." Valve said that some of these features, in this initial beta release, will only be available on Windows machines, at least for now. "Much of it will apply to other supported operating systems and while some metrics are not supported on other operating systems additional support is planned for later," added the company. Check out this handy FAQ set up by Valve that explains what each setting means as well as notes on what issues players can diagnose, like micro stutter or bottlenecks, using these overlay additions. To try out the new feature before it goes out to everyone, you can switch to the Steam Beta Client by heading to the app's Settings > Interface section and changing the Client Beta Participation dropdown to the latest version available. Following that, to enable the new performance monitor, go to Settings > In Game section, and change the detail level to the level you would like.
    • I actually didn't like the classic Start Menu as much as the XP, Vista, 7 style menu. Mainly didn't like how you either had to click Programs every time, when that is what you would want 95% of the time, or fill up that top section (I forget what it was called back then) which was both harder than it should have been and looked ugly.
  • Recent Achievements

    • First Post
      TIGOSS earned a badge
      First Post
    • Week One Done
      slackerzz earned a badge
      Week One Done
    • Week One Done
      vivetool earned a badge
      Week One Done
    • Reacting Well
      pnajbar earned a badge
      Reacting Well
    • Week One Done
      TBithoney earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      675
    2. 2
      ATLien_0
      284
    3. 3
      Michael Scrip
      219
    4. 4
      +FloatingFatMan
      196
    5. 5
      Steven P.
      133
  • Tell a friend

    Love Neowin? Tell a friend!