Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1729012
  • 博文数量: 234
  • 博客积分: 4966
  • 博客等级: 上校
  • 技术积分: 3322
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-13 01:03
文章分类

全部博文(234)

文章存档

2017年(2)

2016年(1)

2015年(8)

2014年(11)

2013年(44)

2012年(27)

2011年(22)

2010年(30)

2009年(37)

2008年(6)

2007年(45)

2006年(1)

分类: LINUX

2009-10-27 11:51:32

1.查看网卡详细信息

1)dmesg | grep -i eth

2) ethtool eth1
Settings for eth1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 32
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg
        Wake-on: d
        Current message level: 0x00000007 (7)
        Link detected: yes

2.查看网络实时带宽

linux的proc文件系统中,通过查看/proc/net/dev文件
可以得到每个网络接口的吞吐量,但是无法获得实时带宽
最近发现了一种基于ncurses库的小程序,可以获得实时带宽

Example:
执行 bmon -o ascii -p eth1

Name                      RX Rate         #   %     TX Rate         #   %
eth1                          0 B         0             0 B         0    
eth1                       1.91KiB       31         90.96KiB       63    
eth1                       1.91KiB       31         90.96KiB       63    
eth1                       7.35KiB      123        349.87KiB      248    
eth1                       7.35KiB      123        349.87KiB      248    
eth1                       7.66KiB      127        342.76KiB      248    
eth1                       7.66KiB      127        342.76KiB      248    
eth1                       7.36KiB      120        291.06KiB      210    
eth1                       7.36KiB      120        291.06KiB      210    
eth1                       7.99KiB      131        324.10KiB      237    
eth1                       7.99KiB      131        324.10KiB      237    
eth1                       7.37KiB      122        311.74KiB      232    
eth1                       7.37KiB      122        311.74KiB      232    
eth1                       7.00KiB      116        301.00KiB      217    

再介绍两个查看网络状况的软件:
# yum install nload

nload默认分为上下两块:
上半部分是:Incoming也就是进入网卡的流量
下半部分是:Outgoing,也就是从这块网卡出去的流量,

每部分都有当前流量(Curr),平均流量(Avg),最小流量(Min),最大流量(Max),总和流量(Ttl)这几个部分,
看起来还是蛮直观的。
#nload --help 查看具体用法

2.iftop
# yum install iftop
# iftop -i eth0


TX:发送流量
RX:接收流量
TOTAL:总流量
Cumm:运行iftop到目前时间的总流量
peak:流量峰值
rates:分别表示过去 2s 10s 40s 的平均流量

#iftop -i eth0 -n       就可以看到eth0网卡的流量状况:

iftop 相关命令 :
监控eth1的网卡的流量
# iftop -i eth0
以位元组(bytes)为单位显示流量(预设是位元bits):
$ iftop -B
直接显示IP, 不进行DNS反解:
$ iftop -n
直接显示连接埠编号, 不显示服务名称:
$ iftop -N
显示某个网段进出封包流量
$ iftop -F 192.168.1.0/24 or 192.168.1.0/255.255.255.0
其他参数可下 iftop -h 看说明.
进入iftop画面时, 可按 p 切换是否显示连接埠, n 切换显示IP或主机的domain name, N切换显
示连接埠代号或名称, p暂停显示, b切换是否显示长条, B切换计算几秒内的平均流量, 其他按键
可以按h观看说明.

阅读(4495) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~