[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 如何从 pciid 得到 网卡得 MAC 地址?



Faris Xiao (肖盛文) wrote:
> 
> 现在很多服务器都有双网卡,而且芯片一样,内核驱动模块一样。
> 
> lspci -vvv 可以得到如下的一些信息:
> 
> 
> 02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5704
> Gigabit Ethernet (rev 02)
> Subsystem: Dell Computer Corporation: Unknown device 014a
> Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
> Stepping- SERR+ FastB2B-
> Status: Cap+ 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
> <TAbort- <MAbort- >SERR- <PERR-
> Latency: 64 (16000ns min)
> Interrupt: pin A routed to IRQ 16
> Region 0: Memory at fcf30000 (64-bit, non-prefetchable) [size=64K]
> Region 2: Memory at fcf20000 (64-bit, non-prefetchable) [size=64K]
> Capabilities: <available only to root>
> 
> 02:00.1 Ethernet controller: Broadcom Corporation NetXtreme BCM5704
> Gigabit Ethernet (rev 02)
> Subsystem: Dell Computer Corporation: Unknown device 014a
> Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
> Stepping- SERR+ FastB2B-
> Status: Cap+ 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
> <TAbort- <MAbort- >SERR- <PERR-
> Latency: 64 (16000ns min)
> Interrupt: pin B routed to IRQ 17
> Region 0: Memory at fcf10000 (64-bit, non-prefetchable) [size=64K]
> Region 2: Memory at fcf00000 (64-bit, non-prefetchable) [size=64K]
> Capabilities: <available only to root>
> 
> 
> 我想问一下,有没有办法可以知道 02:00.0 所对应网卡的 MAC 地址?
> 
> 我现在两个网卡的 MAC 地址,也知道哪个 MAC 地址对应哪个网络设备,eth0,
> eth1,但是就是不知道怎样将 MAC 地址和 pci id 对应。
> 
如果其他的都一样的话,eth0和eth1的顺序应该是和pci id 的顺序是一致的吧。

如果怕弄混,可以用ifrename这个软件来给网卡命名,用MAC来限定网卡的名字。



Reply to: