在装有Linux的系统上检测nic和端口 [英] detecting nic and ports on systems loaded with linux

查看:70
本文介绍了在装有Linux的系统上检测nic和端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在装有Linux的系统上是否有一种简单的方法来检测nic和相关端口.

Is there a simple way to detect nic and associated ports on systems loaded with linux.

通过对此的研究,我发现lshw -C网络可以通过提供端口和接口的详细信息在一定程度上对我有所帮助.

From my study on this, i found lshw -C network would help me to some extent, by giving details on ports and interfaces.

但是我并没有对nic和相关端口进行清楚的区分.

But i didn't get clear differentiation done with nic and associated ports.

假设我有2个带有一个4端口的网卡,而另一个带有2个端口的网卡,我如何使用lshw或任何方式检测此信息!!

Say if i have 2 nic cards with one 4 ports and other nic with 2 ports, how to i detect this information using lshw or any way!!.

lshw -C网络(此处仅粘贴部分信息)

lshw -C network ( only portion of the information pasted here)

使用lshw -C网络,我们可以使用例如序列号:

Using lshw -C network, we can use the serial number for example:

*-network:0描述:以太网接口产品:82575EB千兆网络连接供应商:英特尔公司物理ID:0巴士资讯:pci @ 0000:01:00.0逻辑名称:eth0版本:02序列:00:14:4f:e7:40:e0

*-network:0 description: Ethernet interface product: 82575EB Gigabit Network Connection vendor: Intel Corporation physical id: 0 bus info: pci@0000:01:00.0 logical name: eth0 version: 02 serial: 00:14:4f:e7:40:e0

*-network:1描述:以太网接口产品:82575EB千兆网络连接供应商:英特尔公司身体ID:0.1巴士资讯:pci @ 0000:01:00.1逻辑名称:eth1版本:02序列:00:14:4f:e7:40:e1

*-network:1 description: Ethernet interface product: 82575EB Gigabit Network Connection vendor: Intel Corporation physical id: 0.1 bus info: pci@0000:01:00.1 logical name: eth1 version: 02 serial: 00:14:4f:e7:40:e1

*-network:0已禁用描述:以太网接口产品:82571EB 千兆以太网控制器(铜)供应商:英特尔公司物理ID:0巴士资讯:pci @ 0000:2b:00.0逻辑名称:eth6版本:06序列:00:15:17:be:e6:75

*-network:0 DISABLED description: Ethernet interface product: 82571EB Gigabit Ethernet Controller (Copper) vendor: Intel Corporation physical id: 0 bus info: pci@0000:2b:00.0 logical name: eth6 version: 06 serial: 00:15:17:be:e6:75

*-network:1已禁用描述:以太网接口产品:82571EB千兆以太网控制器(铜)供应商:英特尔公司身体ID:0.1巴士信息:pci@0000:2b:00.1逻辑名称:eth4版本:06序列:00:15:17:be:e6:74

*-network:1 DISABLED description: Ethernet interface product: 82571EB Gigabit Ethernet Controller (Copper) vendor: Intel Corporation physical id: 0.1 bus info: pci@0000:2b:00.1 logical name: eth4 version: 06 serial: 00:15:17:be:e6:74

序列号有点帮助,前五个元组可以帮助我区分nic,而序列号中的最后一个元组在进入给定nic的不同端口时似乎是按顺序排列的.

serial number kind of helps, the first five tuples help me to distinguish the nics and the last tuple in the serial number seems to be in sequence when in comes to different ports on given nic.

-谢谢赶快

推荐答案

我不确定您想知道哪些信息.我猜您想知道哪个以太网接口在同一块板上.一种快速的检测方法是通过sysfs目录,该目录包含有关设备和驱动程序的信息.这些信息也可以与lspci相关.

I'm not entirely sure what information you want to know. I'm guessing you want to know which ethernet interfaces are on the same board. One quick way to detect is via the sysfs directory which contains information about devices and drivers. This information can also be correlated to lspci.

示例:

find /sys/devices/ -type d | grep eth 

在我的系统上以以下格式输出数据:

Which outputs data on my system in the format of:

/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0

其中pci0000:00是公交车,最后一个数字是卡(0000:02:00.0).

Where pci0000:00 is the bus, and the last number is the card (0000:02:00.0).

然后,如果我运行lspci,我可以查找卡标识符以获取更多信息

Then if I run lspci I can look up the card identifier to get more information

lspci | grep 02:00

网我:

02:00.0以太网控制器:Realtek Semiconductor Co.,Ltd. RTL8101E/RTL8102E PCI Express快速以太网控制器(版本02)

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)

在您的系统上,应该将多个eth *映射到每个卡.这应该告诉您哪个eth映射到哪个卡,以及有关每个特定卡的更多信息.

On your system, you should have multiple eth* mapped to each card. This should tell you the mapping of which eth to which card and more information about each specific card.

这篇关于在装有Linux的系统上检测nic和端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆