How to install NIC Driver in CentOS

Source: Internet
Author: User

Preface

A few weeks ago, I had a computer, a Gigabit Z77-DS3H, and CentOS 6.4. It is depressing that this system does not support NIC with built-in points on the motherboard. No way, I have been alone for a long time, and finally I have solved it. In this process, I have made a record of all kinds of hits.

Body Problems

This is what I did after installing the system. On the terminal, you can find that there is only one lo connection but No eth0. In the upper right corner, the "No network device availabal" prompt is displayed under the Internet icon ". It is determined that the system has no proper driver.

View Devices

Run the following command to view the NIC information:

lspci | grep -i eth

The result is as follows:

02:00.0 Ethernet controller: Atheros Communications Inc. AR8161 Gigabit Ethernet (rev 10)

I found a post on the CentOS forum. In the reply to #6, I found a feasible solution.

Having tried countless times before, it's a nightmare...

In the reply, the author wants us to download the driver here.

Here I will provide a link to the file. You can download the file directly using wget or other download tools:

Http://fichiers.touslesdrivers.com/34178/alx-linux-v2.0.0.6.rar

The downloaded file name is alx-linux-v2.0.0.6.rar.

According to the operating system you used when reading this article:

Windows

To install the 7zcompressed software, you can pack and compress the folder in the tar.gz/bz2 format (of course, rar format is supported, and unlike rar, it is a free software... This is a good promotion of 7z. of course, tar.gz/bz2 and other files are also supported to be decompressed.

In this way, if you download the rarfile, You can decompress it and compress it into the tar format, and then transfer it to the Linux System for compilation and installation using a USB flash disk and other storage devices. Otherwise, Linux generally cannot decompress the rarfile, but most of the compressed files on the Internet are in the rar format.

Linux

It may be that there are other NICs, so they can still be connected to the Internet. You can also see this article. Or two Linux Hosts, one of which can be downloaded over the Internet.

You don't have to worry about downloading to tar or another format. Download To rar format. Search for rar with yum.

Ah, tragedy. The downloaded files are in the rar format. I downloaded it in windows, so I decompress it with 7Z and compress it, and then transfer it with my mobile phone (because there is no USB disk Orz ...)

Prerequisites for compilation and Installation

You have installed kernel-headers and kernel-devel. Of course, there is also gcc.

However, by default, gcc is not installed on CentOS. If you are not sure whether or not gcc is installed, enter gcc directly in the terminal. If not, a prompt is displayed, bash: gcc: comman not found.

What if gcc is not installed if it is really tragic? I inserted a bin DVD, modified the yum configuration file, and changed the yum software source to a Local CD. This method will be introduced later.

To install kernel-headers and kernel-devel, you need the following two commands:

sudo yum install kernel-headers 2 sudo yum install kernel-devel 

The above two must be installed once, and other drivers will not be installed after compilation.

Compile

Decompress the downloaded package, a directory (alx-linux-v2.0.0.6) appears, we enter this directory, directly execute make.

Then, go to the src directory of the current directory and use ls to find that there is a file named alx. ko, which is the NIC Driver we are using.

Install driver

Run pwd, we should be in the xxxx/alx-linux-v2.0.0.6/src directory. Next, we just need to copy that alx. ko to the specified directory.

Here:

As long as you follow the steps shown above, the results will be effective immediately-see the figure in the upper right corner, from the original Red Cross into a green circle.

Command:

Sudo mkdir/lib/modules/$ (uname-r)/kernrl/net/wireled # Here $ (uname-r) will be replaced with the current version number of the System 2 sudo cp alx. ko/lib/modules/$ (uname-r)/kernrl/net/wireled # copy the driver file to the specified position. 3. sudo depmod-a # Check the dependency of the module, after the driver file under lib changes, it is best to execute 4 sudo modprobe alx # Load alx in the default location. ko

For lsmod | grep alx, the driver is loaded successfully to check whether the driver is loaded successfully. If the driver is not loaded, nothing is displayed.

Before and after modprobe is executed, it is significantly different.

Display: alx 90654 0 indicates that the driver has been loaded successfully.

After the restart, the driver is still running. Therefore, you don't have to be as troublesome as that person in the Forum.

Solve the problem

All right, whether it's using ifconfig or the icon in the upper right corner, the problem seems to have been completely solved. Next, configure the NIC as needed. I configured a dial-up connection.

Postscript
  • If you cannot see eth0 after using ifconfig after the driver is loaded successfully, use:
  • Ifconfig-a # This way you can find eth0 (eth0 is the first one. If you have other NICs, there will be eth1, 2, 3 ...) 2 sudo ifconfig eth0 up # Replace eth0 as shown above, usually eth0

  • To compile a driver, you must first install kernel-headers and kernel-devel.

  • View the device information. Use:
    Lspci # more complete with-v Options

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.