四个步骤教你在linux下看网卡信息
一、首先是最簡單明了的兩個命令, ifconfig和lspci。
1.ifconfig:最常用的配置和查看網(wǎng)絡接口信息的命令,服務器上執(zhí)行此命令會得到類下文的內(nèi)容,一下內(nèi)容可看到多個設備和設備狀態(tài)、信息。
[oracle@mori~]$ifconfigeth0Linkencap:EthernetHWaddr00:0C:29:A4:5A:BFinetaddr:192.168.1.160Bcast:192.168.1.255Mask:255.255.255.0inet6addr:fe80::20c:29ff:fea4:5abf/64Scope:LinkUPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:1650errors:0dropped:0overruns:0frame:0TXpackets:112errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:134000(130.8KiB)TXbytes:12228(11.9KiB)eth1Linkencap:EthernetHWaddr00:0C:29:A4:5A:C9inetaddr:192.168.1.161Bcast:192.168.1.255Mask:255.255.255.0inet6addr:fe80::20c:29ff:fea4:5ac9/64Scope:LinkUPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:1618errors:0dropped:0overruns:0frame:0TXpackets:88errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:125909(122.9KiB)TXbytes:9320(9.1KiB)loLinkencap:LocalLoopbackinetaddr:127.0.0.1Mask:255.0.0.0inet6addr:::1/128Scope:HostUPLOOPBACKRUNNINGMTU:16436Metric:1RXpackets:182errors:0dropped:0overruns:0frame:0TXpackets:182errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:0RXbytes:10340(10.0KiB)TXbytes:10340(10.0KiB)
2.lspci |grep -i 'eth' 或 lspci | grep -i net命令:可列出每個pci總線上的設備,通過grep過濾后可得到網(wǎng)卡設備列表,下文可看到我pci總線上的網(wǎng)絡設備有倆,是兩個intel的網(wǎng)卡:
[oracle@mori~]$lspci|grep-i'eth'02:01.0Ethernetcontroller:IntelCorporation82545EMGigabitEthernetController(Copper)(rev01)02:06.0Ethernetcontroller:IntelCorporation82545EMGigabitEthernetController(Copper)(rev01)[oracle@mori~]$lspci|grep-inet02:01.0Ethernetcontroller:IntelCorporation82545EMGigabitEthernetController(Copper)(rev01)02:06.0Ethernetcontroller:IntelCorporation82545EMGigabitEthernetController(Copper)(rev01)
3.iwconfig :用于查看無線網(wǎng)絡,如果你設備上有無線網(wǎng)卡此時可用此命令來查看,我的設備上并沒有無線網(wǎng)卡設備,因此會會得到如下信息。
[oracle@mori~]$iwconfiglonowirelessextensions.eth0nowirelessextensions.pan0nowirelessextensions.eth1nowirelessextensions.
二、除以上幾個命令外有個神秘而強大的工具較 ethtool1.ethtool 命令主要用于查詢配置網(wǎng)卡參數(shù)。
2.用法:ethtool ethN//其中 N 是對應網(wǎng)卡的編號,如eth0、eth1等等
3.ethtool的功能較多,這里不一一贅述,如有需求和查看其說明頁 man ethtool,這里單獨拿出來講的一個功能,這個功能適用于如下場景:你的 服務器有多個網(wǎng)卡并且已經(jīng)配置好運行當中,你卻沒記得eth0、eth1、eth2.....分別對應的是哪個物理的網(wǎng)卡,此時可以使用如下命令:
[root@morioracle]#ethtool-peth0
此時就會看到 eth0 對應的物理口一個燈在不停的閃爍,對了。這就是我們在系統(tǒng)看到的那個叫eth0的網(wǎng)卡了,就是這么簡單。
總結(jié)
以上是生活随笔為你收集整理的四个步骤教你在linux下看网卡信息的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 江南四大才子是哪四个(中国古代江南四大才
- 下一篇: 冰种黑曜石好还是金曜石好(冰种黑曜石和金