Rover12421's Blog

The End.

Linux下不能上网,驱动问题

安装的centOS不能上网,配置好了IP,网关,DNS,关闭了防火清,Selinux,就是不能上网,能ping自己,但是ping不通局域网和网关,真是郁闷。真想不出问题出在哪了。
搞了两天,最后决定把驱动重新安装。结果装好驱动就能上网了。
我的网卡是RealTek RTL8168B/8111B的,下面把安装过程贴上来。驱动到官方去下就是了。

?View Code BASH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
[root@localhost ~]# cd Desktop/
[root@localhost Desktop]# ls
curly-00e2bcfc47.desktop gegl-00e6524faf.desktop
frobate-007e678f03.desktop r8168-8.011.00.tar.bz2
[root@localhost Desktop]# lsmod | grep r8169
r8169 32969 
[root@localhost Desktop]# rmmod r8169
[root@localhost Desktop]# vi /etc/modprobe.conf
[root@localhost Desktop]# tar vjxf r8168-8.011.00.tar.bz2
r8168-8.011.00/
r8168-8.011.00/src/
r8168-8.011.00/src/r8168_n.c
r8168-8.011.00/src/Makefile
r8168-8.011.00/src/r8168_asf.h
r8168-8.011.00/src/r8168.h
r8168-8.011.00/src/r8168_asf.c
r8168-8.011.00/src/Makefile_linux24x
r8168-8.011.00/Makefile
r8168-8.011.00/readme
[root@localhost Desktop]# cd r8168-8.011.00
[root@localhost r8168-8.011.00]# make clean modules
make -C src/ clean
make[1]: Entering directory `/root/Desktop/r8168-8.011.00/src'
rm -rf *.o *.ko *~ core* .dep* .*.d .*.cmd *.mod.c *.a *.s .*.flags .tmp_versions Module.symvers Modules.symvers *.order
make[1]: Leaving directory `/root/Desktop/r8168-8.011.00/src'
make -C src/ modules
make[1]: Entering directory `/root/Desktop/r8168-8.011.00/src'
make -C /lib/modules/2.6.18-92.el5/build SUBDIRS=/root/Desktop/r8168-8.011.00/src modules
make[2]: Entering directory `/usr/src/kernels/2.6.18-92.el5-i686'
CC [M] /root/Desktop/r8168-8.011.00/src/r8168_n.o
/root/Desktop/r8168-8.011.00/src/r8168_n.c: In function ‘rtl8168_tx_clear’:
/root/Desktop/r8168-8.011.00/src/r8168_n.c:4154: 警告:未使用的变量 ‘dev’
CC [M] /root/Desktop/r8168-8.011.00/src/r8168_asf.o
LD [M] /root/Desktop/r8168-8.011.00/src/r8168.o
Building modules, stage 2.
MODPOST
CC /root/Desktop/r8168-8.011.00/src/r8168.mod.o
LD [M] /root/Desktop/r8168-8.011.00/src/r8168.ko
make[2]: Leaving directory `/usr/src/kernels/2.6.18-92.el5-i686'
strip --strip-debug r8168.ko
make[1]: Leaving directory `/root/Desktop/r8168-8.011.00/src'
[root@localhost r8168-8.011.00]# make install
make -C src/ install
make[1]: Entering directory `/root/Desktop/r8168-8.011.00/src'
install -m 744 -c r8168.ko /lib/modules/2.6.18-92.el5/kernel/drivers/net/
make[1]: Leaving directory `/root/Desktop/r8168-8.011.00/src'
[root@localhost r8168-8.011.00]# depmod -a
[root@localhost r8168-8.011.00]# modprobe r8168
[root@localhost r8168-8.011.00]# lsmod | grep r8168
r8168 43796 
[root@localhost r8168-8.011.00]# lsmod | grep r8168
r8168 43796 
[root@localhost r8168-8.011.00]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0B:2F:2C:85:5F
inet addr:192.168.1.23 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20b:2fff:fe2c:855f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:92 errors: dropped: overruns: frame:
TX packets:35 errors: dropped: overruns: carrier:
collisions: txqueuelen:1000
RX bytes:10371 (10.1 KiB) TX bytes:8098 (7.9 KiB)
Interrupt:50 Base address:0xc000
 
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1724 errors: dropped: overruns: frame:
TX packets:1724 errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes:3147726 (3.0 MiB) TX bytes:3147726 (3.0 MiB)
 
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 b) TX bytes: (0.0 b)
 
[root@localhost r8168-8.011.00]# ifconfig eth0 up
[root@localhost r8168-8.011.00]# ifconfig eth0 192.168.1.23
[root@localhost r8168-8.011.00]# vi /etc/resolv.conf
nameserver 202.96.128.86
nameserver 202.96.128.166
search localdomain
[root@localhost r8168-8.011.00]# route add default gw 192.168.1.2
SIOCADDRT: 文件已存在
[root@localhost r8168-8.011.00]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
 
# Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=00:0B:2F:2C:85:5F
IPADDR=192.168.1.23
IPV6INIT=yes
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes

这步骤都是按照说明文档来的,驱动安装包中的 Readme 说的很清楚。

Comments