Linux下安装网卡驱动程序详解

来源:互联网 发布:安智市场软件 编辑:程序博客网 时间:2024/05/16 08:00

一、查看网卡型号和机器位数

1、查看网卡型号

linux系统下通过以下命令,可以查看当前的网卡驱动信息;

[box color="white" icon="none"]

[root@localhost zhangy]# lspci |grep -i eth

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

[/box]

2、查看机器位数

驱动程序是要区分系统是32位系统还是64位系统的, 所以通过以下linux命令,就可以知道操作系统的位数了;

[box color="white" icon="none"]

[root@localhost ~]# uname -a

Linux localhost.localdomain 2.6.18-308.13.1.el5PAE #1 SMP Tue Aug 21 17:50:26 EDT 2012 i686 i686 i386 GNU/Linux

[/box]

下载前先看一下你的网卡驱动,如果是最新的就不用在重新装了。

[box color="white" icon="none"]

[root@localhost zhangy]# ethtool -i eth0

driver: r8169

version: 2.3LK-1-NAPI

firmware-version:

bus-info: 0000:03:00.0

[/box]

RTL8111/8168B就是网卡的型号,这样你可以网卡的型号来找一下网卡驱动的官方网站,然后下载最新的网卡驱动,驱动分64位和32位的,i386,i686是32位的机器,x86_64表示是64位的机器,不要选错驱动了。

二、下载驱动,并安装

1、解压

[box color="white" icon="none"]

[root@localhost download]# tar jxvf r8168-8.032.00.tar.bz2

[/box]

2、安装

[box color="white" icon="none"]

[root@localhost r8168-8.032.00]# make && make install

[/box]

如果报以下错误

make -C /lib/modules/2.6.18-308.8.2.el5PAE/build SUBDIRS=/home/zhangy/r8168-8.032.00/src INSTALL_MOD_DIR=kernel/drivers/net modules_install
make: *** /lib/modules/2.6.18-308.8.2.el5PAE/build: 没有那个文件或目录。 停止。
make: *** [install] 错误 2

说明你kernel源码没有安装。安装kernel源码

[box color="white" icon="none"]

[root@localhost r8168-8.032.00]# yum install kernel-xen kernel-xen-devel kernel \
> kernel-PAE kernel-PAE-devel kernel-devel kernel-headers

[/box]

安装完以后,一定要重启机器。不然下面操作就过不去了,会报FATAL: Module r8168 not found.

[box color="white" icon="none"]

[root@localhost r8168-8.032.00]# depmod -a

[root@localhost r8168-8.032.00]# modprobe r8168

[/box]

编辑配置文件/etc/modprobe.cof,如果以前没有添加alias eth0 r8168,如果已经有了修改一下成alias eth0 r8168。

查一下驱动是不是加载了,如果有以下内容说明驱动安装成功了。

[box color="white" icon="none"]

[root@localhost r8168-8.032.00]# lsmod |grep r8168
r8168 231132 0

[/box]

必须重新启动一下机器,用ethtool查看驱动才会改变,不然还是老样子。下面是新的驱动。

[box color="white" icon="none"]

[root@localhost ~]# ethtool -i eth0

driver: r8168

version: 8.032.00-NAPI

firmware-version:

bus-info: 0000:02:00.0

[/box]

转自点击打开链接