---
title: "Linux服务器下查看网络流量"
author: "purpen"
date: "2011-08-01T01:37:09Z"
tags: ["Linux", "监测", "网络流量"]
categories: ["操作系统"]
slug: "linux"
draft: false
lastmod: "2011-08-01T01:50:46Z"
id: 1136974
url: "https://purpen.iteye.com/blog/1136974"
---

推荐Linux下检测网卡流量的两款软件，其一是：nload，另外一个就是：iftop。这两个软件的安装方法都很简单，下面逐一介绍：  
首先，从以上网址下载下来后，安装nload：

./configure –prefix=/usr/local/nload

make

make install

./configure –prefix=/usr/local/iftop

make

make install

nload是：# /usr/local/nload/bin/nload

iftop是：# /usr/local/iftop/sbin/iftop

一般的服务器都会有内网和外网两块网卡，nload默认的是eth0网卡，如果你想监测eth1网卡的流量，那么

 

#/usr/local/[nload](http://www.frostsky.com/tag/nload/ "Posts tagged with nload")/bin/[nload](http://www.frostsky.com/tag/nload/ "Posts tagged with nload") eth1

这样即可。

 

[nl](http://www.frostsky.com/tag/nload/ "Posts tagged with nload")o[ad](http://www.frostsky.com/tag/nload/ "Posts tagged with nload")默认分为上下两块：上半部分是：Incoming也就是进入网卡的流量，下半部分是：Outgoing，也就是从这块网卡出去的流量，每部分都 有当前流量（Curr），平均流量（Avg），最小流量（Min），最大流量（Max），总和流量（Ttl）这几个部分，看起来还是蛮直观的。

另外，你也可以自己定义流量数值显示的单位

就可以看到具体的相关参数了。

iftop默认也是监测eth0网卡的流量，如果你想要监测eth1这块网卡，则需要加-i+eth1来指定网卡，也就是这样：

 

#/usr/local/[iftop](http://www.frostsky.com/tag/iftop/ "Posts tagged with iftop")/sbin/[iftop](http://www.frostsky.com/tag/iftop/ "Posts tagged with iftop") -i eth1

iftop显示的也很直观，样子和操作有些像top命令。