Home > Operation and Maintenance > Linux Operation and Maintenance > What does network card refer to in linux?

What does network card refer to in linux?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-05-27 23:56:06
forward
3987 people have browsed it

A network card is a piece of computer hardware that allows computers to communicate over a network, whether connected through cables or wireless technology. In the Linux operating system, the traditional naming methods of network card devices are eth0, eth2, eth3, etc. Check the syntax of the network card model "lspci | grep -i ether", the syntax of the network card resource usage "sar -n DEV", and whether the network card supports Syntax for multi-queue "lspci -vvv | grep -i msi-x".

What is a network card?

A network card is a piece of computer hardware designed to allow computers to communicate on a computer network. Since it has a MAC address, it falls between Layer 1 and Layer 2 of the OSI model. It allows users to connect to each other via cable or wirelessly.

Each network card has a unique 48-bit serial number called a MAC address, which is written in a ROM on the card. Every computer on the network must have a unique MAC address.

Summary of basic knowledge about network cards in Linux

1. Overview of network cards

Tradition of network card devices in Linux operating system The naming methods are eth0, eth2, eth3, etc., while CentOS7 provides different naming rules. The default is to assign based on firmware, topology, and location information. The advantage of using this naming method is that the naming is completely automatic and predictable, but the disadvantage is that names such as ens33 are more difficult to read than eth0 and wlan0.

2. The difference between Eth0 and ens

  • eno1: represents the network card built into the host bios

  • Ens: Represents the PCI-E network card built into the motherboard bios

  • Enp2s0: PCI-E independent network card

  • Eth0: If all of the above If not used, return to the default network card name

3. Naming rule strategy

Rule 1:

For onboard device naming, merge the index number provided by the firmware or BIOS. If the information from the firmware or BIOS is readable, name it, such as eno1. This naming is more common, otherwise use rule 2.

Rule 2:

Name the PCI-E hot plug port index number provided by the merged firmware or BIOS, such as ens1. If the information is readable, use it, otherwise use it. Rule 3.

Rule 3:

Name the physical location of the merged hardware interface, such as enp2s0. Name it if it is available. If it fails, go directly to solution 5.

Rule 4:

Name the MAC address of the merged interface, such as enx78e7d1ea46da, which is not used by default unless the user chooses to use this scheme.

Rule 5:

Use traditional solutions. If all else fails, use a style like eth0.

4. The meaning of network card name characters

1. The meaning of the first 2 characters

en Ethernet Ethernet

wl Wireless LAN WLAN

ww Wireless WAN WWAN

2. Select the third character according to the device type

  • o x ; port number chain

  • 5. Modify the network card name style to ethx
  • If you are not used to using the new naming rules, you can return to the traditional way Name it, edit the grub file, add two variables, and then use grub2-mkconfig to regenerate the grub configuration file.

  • 1. Edit the grub configuration file

    vim /etc/sysconfig/grub   # 其实是/etc/default/grub的软连接
    Copy after login
  • # Add 2 parameters to the GRUB_CMDLINE_LINUX variable. The specific content is as follows (bold):
  • GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap net.ifnames=0 biosdevname=0 rhgb quiet"
    Copy after login

    2. Regenerate the grub configuration file
grub2-mkconfig -o /boot/grub2/grub.cfg
Copy after login

Then restart the Linux operating system. Through ip addr, you can see that the network card name has changed to eth0.

3. Modify the network card configuration file

The original name of the network card configuration file is ifcfg-ens33. It needs to be modified to the ethx format and the network card configuration file should be adjusted appropriately.

mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0
# 修改ifcfg-eth0文件如下内容(其它内容不变)
NAME=eth0
DEVICE=eth0
Copy after login

[root@localhost ~]# systemctl restart network.service    # 重启网络服务
Copy after login

Note: It is best to delete the ifcfg-ens33 file, otherwise an error will be reported when restarting the network service

TYPE=Ethernet                # 网卡类型:为以太网
PROXY_METHOD=none            # 代理方式:关闭状态
BROWSER_ONLY=no                # 只是浏览器:否
BOOTPROTO=dhcp                # 网卡的引导协议:DHCP[中文名称: 动态主机配置协议]
DEFROUTE=yes                # 默认路由:是, 不明白的可以百度关键词 `默认路由`
IPV4_FAILURE_FATAL=no        # 是不开启IPV4致命错误检测:否
IPV6INIT=yes                # IPV6是否自动初始化: 是[不会有任何影响, 现在还没用到IPV6]
IPV6_AUTOCONF=yes            # IPV6是否自动配置:是[不会有任何影响, 现在还没用到IPV6]
IPV6_DEFROUTE=yes            # IPV6是否可以为默认路由:是[不会有任何影响, 现在还没用到IPV6]
IPV6_FAILURE_FATAL=no        # 是不开启IPV6致命错误检测:否
IPV6_ADDR_GEN_MODE=stable-privacy            # IPV6地址生成模型:stable-privacy [这只一种生成IPV6的策略]
NAME=ens33                    # 网卡物理设备名称
UUID=f47bde51-fa78-4f79-b68f-d5dd90cfc698    # 通用唯一识别码, 每一个网卡都会有, 不能重复, 否两台linux只有一台网卡可用
DEVICE=ens33                    # 网卡设备名称, 必须和 `NAME` 值一样
ONBOOT=no                        # 是否开机启动, 要想网卡开机就启动或通过 `systemctl restart network`控制网卡,必须设置为 `yes`
Copy after login
/etc/sysconfig/ network #Includes basic network information of the host, used for system startup/etc/sysconfig/network-script/ #This directory contains the most initial network information for system startup/etc/sysconfig/network-script/ifcfg-em1 #Network configuration information, Everyone's configuration name is different. View /etc/xinetd.conf through the command. It defines the network service /etc/protocols started by the super process XINETD # Set the protocol used by the host and the protocol number of each protocol /etc/services # Set Set the network services of different ports of the host

6. Check whether virtualization is enabled

Ctrl alt delete

What does network card refer to in linux?

7. Basic commands

Check the network card model: lspci | grep -i ether

View network card resource usage: sar -n DEV (focus on network bandwidth);

View the queue of network card eth0: /sys/class/net/eth0/queues

Check whether the network card supports multiple queues: lspci -vvv | grep -i msi-x

As shown in the figure below, check the entry content of the Ethernet controller. If there is MSI-X && Enable && TabSize > 1, the network card is a multi-queue network card, and TabSize indicates the number of queues supported by the network card.

What does network card refer to in linux?

The above is the detailed content of What does network card refer to in linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template