每个Linux系统都有很多的网络接口,用来与物理或虚拟网络设备通信。例如,你的电脑有一块以太网卡和一块无线网卡,那么每个网卡都会有一个网络接口(默认情况)。
ifconfig命令会列出网络接口的当前状态和相关信息。这是一些输出的例子:
Every Linux system has a number of network interfaces, each of which corresponds to either a physical or virtual networking device. For example, if your computer has both an Ethernet card and a Wifi card will have then there will be one network interface for each (by default).
The ifconfig command will display a list of network interfaces along with their current status and associated information. Here is some example output (… is used in place of some data to ensure the output fits on screen):$ ifconfig
eth0
Link encap:Ethernet HWaddr …
inet addr:73.14.187.124 Bcast:…
Mask:255.255.255.0
inet6 addr: …/64 Scope:Global
inet6 addr: …/64 Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
RX packets:9302745 errors:0 dropped:0
overruns:0 frame:0
TX packets:6648291 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:995345630 (995.3 MB)
TX bytes:7125692666 (7.1 GB)
$
eth0接口与一个物理以太网连接进行通信。我们可见相关信息是活跃的,而且被配置了73.14.187.124这个IP地址。输出包括一些高级网络活动数据:RX是通信“接收到的”TX是通信“发送出的”,比如下载流量对应上传流量。
The eth0 interface corresponds to a physical Ethernet connection. We can see that the associated connection is active, connected to the internet, and has been assigned an IP address of 73.14.187.124. The output includes some high-level network activity statistics: RX means corresponds to “received” and TX corresponds to “transmitted”, i.e., download traffic vs. upload traffic.