活用Linux

今天我係公司做的工作就係確認eth?究竟係邊張LAN咭
我用了以下三個資訊
1. lspci
2. lsmod
3. cat /proc/bus/pci/devices

1. lspci會後到以下的資訊
0000:00:00.0 Host bridge: Silicon Integrated Systems [SiS] 730 Host (rev 02)
0000:00:00.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0)
0000:00:01.0 ISA bridge: Silicon Integrated Systems [SiS] SiS85C503/5513 (LPC Bridge)
0000:00:01.1 Ethernet controller: Silicon Integrated Systems [SiS] SiS900 PCI Fast Ethernet (rev 82)
0000:00:01.2 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 07)
0000:00:01.3 USB Controller: Silicon Integrated Systems [SiS] USB 1.0 Controller (rev 07)
0000:00:01.4 Multimedia audio controller: Silicon Integrated Systems [SiS] SiS PCI Audio Accelerator (rev 02)
0000:00:02.0 PCI bridge: Silicon Integrated Systems [SiS] Virtual PCI-to-PCI bridge (AGP)
0000:01:00.0 VGA compatible controller: Matrox Graphics, Inc. MGA G200 AGP (rev 01)

係入面有這一行
0000:00:01.1 Ethernet controller: Silicon Integrated Systems [SiS] SiS900 PCI Fast Ethernet (rev 82)
把”Ethernet controller” grep左佢,再拿左面00:01.1計數,把這個看成a:b.c,看成十六進制的數,咁設d = a*256+b*8+c。把d寫回十六進制,那就是”cat /proc/bus/pci/devices”入面第一行的Token。在同一行的最後一個token就係個Driver。
再從lsmod就可以確認邊張咭把邊張由尾數上頭就係eth0 至 ethn的資序了。

Leave a Reply