How can I add a network card driver in CentOS?

The steps to add a network card driver in CentOS are as follows:

  1. Confirm the network card model and driver: First, you need to identify the network card model and its corresponding driver. You can use the lspci command to view the installed PCI devices, locate the relevant information for the network card, and then use a search engine to find the corresponding driver.
  2. Download and compile the driver: Once you find the corresponding driver, download the source code of the driver. Then follow the installation instructions provided by the driver for compiling and installing.
  3. Load the driver: After the driver installation is complete, use the modprobe command to load the driver module. For example, if the driver module’s name is mydriver, you can use the following command to load the driver: modprobe mydriver.
  4. Configure network interface: open network interface configuration file /etc/sysconfig/network-scripts/ifcfg-ethX, where ethX is the name of the network card, and modify the file content according to the actual situation. Add or modify the following parameters:
  5. DEVICE=ethX: Specify the name of the network card to match with the configuration file name.
  6. BOOTPROTO=static: configure the network interface with a static IP address, if DHCP is needed, then set it to dhcp.
  7. IPADDR=xxx.xxx.xxx.xxx: Specify a static IP address.
  8. NETMASK=xxx.xxx.xxx.xxx: Specify the subnet mask.
  9. GATEWAY=xxx.xxx.xxx.xxx: Specifies the gateway address.
  10. Save and exit the configuration file.
  11. Restart network services: Use the following command to restart the network services for the configurations to take effect:
  12. restart the service network
  13. Or alternatively:
  14. Restart the network using systemctl.

After completing the above steps, the network card driver will be added and configured. You can use the ifconfig command to view the newly added network card.

bannerAds