Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of viewing Network Card in linux

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the method of linux to view the network card, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Linux check the network card method: 1, "ifconfig" command; 2, "lspci | grep-I 'eth'" or "lspci | grep-I net" command; 3, "iwconfig" command; 4, use the ethtool tool to query the configuration parameters of the network card.

First, the two most straightforward commands, ifconfig and lspci.

1.ifconfig: the most commonly used command to configure and view network interface information. Executing this command on the server will get the following content of the class, where you can see the status and information of multiple devices and devices.

[oracle@mori ~] $ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:A4:5A:BF inet addr:192.168.1.160 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fea4:5abf/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1650 errors:0 dropped:0 overruns:0 frame:0 TX packets:112 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:134000 (130.8 KiB) TX bytes:12228 (11.9 KiB) eth2 Link encap:Ethernet HWaddr 00:0C:29:A4:5A:C9 inet addr:192.168.1.161 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c: 29ff:fea4:5ac9/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1618 errors:0 dropped:0 overruns:0 frame:0 TX packets:88 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:125909 (122.9 KiB) TX bytes:9320 (9.1 KiB) lo Link encap:Local Loopback inet addr:127 .0.0.1 Mask:255.0.0.0 inet6 addr: 1Accord 128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:182 errors:0 dropped:0 overruns:0 frame:0 TX packets:182 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:10340 (10.0 KiB) TX bytes:10340 (10.0 KiB)

2.lspci | grep-I 'eth' or lspci | grep-I net command: you can list the devices on each pci bus. After filtering through grep, you can get a list of network card devices. You can see below that there are two network devices on my pci bus, which are two intel network cards:

[oracle@mori ~] $lspci | grep-I 'eth' 02grep 01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) 02VR 06.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) [oracle@mori ~] $lspci | grep-I net 02grep 01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01) 02VR 06.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

3.iwconfig: used to view the wireless network. If you have a wireless network card on your device, you can use this command to check it at this time. There is no wireless network card device on my device, so you will get the following information.

[oracle@mori] $iwconfig lo no wireless extensions. Eth0 no wireless extensions. Pan0 no wireless extensions. Eth2 no wireless extensions.

Second, in addition to the above commands, there is a mysterious and powerful tool than ethtool.

The 1.ethtool command is mainly used to query and configure Nic parameters.

two。 Usage: ethtool ethN / / where N is the number of the corresponding network card, such as eth0, eth2, etc.

There are many functions of 3.ethtool, but we will not repeat them one by one here. If there is a need and check its description page man ethtool, this function is shown separately. This function applies to the following scenarios: your server has multiple network cards and has been configured to run, but you do not remember eth0, eth2, eth3. Which physical Nic corresponds to? you can use the following command at this time:

[root@mori oracle] # ethtool-p eth0

At this point, you will see a light flashing in the physical port corresponding to the eth0, by the way. This is the network card called eth0 that we saw in the system. It's as simple as that.

Thank you for reading this article carefully. I hope the article "how to check the Network Card in linux" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report