我爱电脑技术论坛's Archiver

bbs23 发表于 2008-6-11 07:21

如何解决Linux操作系统找不到网卡的问题

1. 安装网卡
;v-R`-EIhU5T
$?,ks-TbZ(m8tB
.z#qr!e$X 机器太新,以至于现有的Linux版本无法认出,比如机器找不到网卡,这时候怎么办呢? ](Ui&[0}3?,H4K&__j
&B@2x#Mcp:C X
]1p0_b6v/Q,W V
别急,首先你需要知道网卡是什么型号的,以本实验室新购入的电脑为例,它的网卡是集成的,型号是Realtek RTL8168/8111 PCI-E Gigabit Ethernet NIC。然后我们到Realtek的官方网站去下载相应的Linux驱动程序r8168-8.005.00.tar.bz2,按照说明安装。 P Dl%Q'Wl&N^?j

\$H&[%K pk
R*i(Ln(lx f!}c Unpack the tarball : 5?"q,qQ;wdFpd
I-y E3~9g4E${Gk
# tar vjxf r8168-8.aaa.bb.tar.bz2 S#E0\Y(K])ER+xM
5|N-W1eZ!X
Change to the directory: ;Q9XxP,Nk k8y@A
jb4C4V1y3~/U `q
# cd r8168-8.aaa.bb
uk.F9cI7TV~T 9E*?0Tx$O(I1R
If you are running the target kernel, then you should be able to do :
r"c r \ Yw
7?i0C/[l#l}%W aZ # make clean modules (as root or with sudo) "|1jY8i2v,g9F-WN
@u\)V t
# make install
D:Ds-|qcR
9U3J0E?D{ # /sbin/depmod -a
]P"Cy]x O)W%U(q0g?H)@ P"Y
# /sbin/insmod ./src/r8168.ko (or r8168.o in linux kernel 2.4.x)
M'qE ?@} #u$Uzu p-KF!y6N`

yfuSG!?Z You can check whether the driver is loaded by using following commands.
.Acf4m x+p
z"sAFx|a9q
%S(l7Uj,zp~4A%s # /sbin/lsmod | grep r8168(看看有没有加载网卡驱动)
f ]o^BG$m*\9` *eu/SmSH@
# /sbin/ifconfig –a(看看有没有相关网卡被启动的信息) :Y5f o^`j

T|+Q9k9t n'A,M sb7f7Q;m
If there is a device name, ethX, shown on the monitor, the linux C4vifB*v/hc
FV;X8KZ$T7q

PrU!gN}tr driver is loaded. Then, you can use the following command to activate 'RgN j z.p

r-DN:]C the ethX. ;VNG2Qj? Q&Z&[
|,W9X|jz
x}hc&pA;q
# ifconfig ethX up 2u$Kz^B]N$K\b
+n1Q0LV^:sh
,where X=0,1,2,...
peY;b2o$V4@ B^"g[)^)dS:u

r AH(ZL!t 这里也可以通过系统→管理→网络来设置IP地址等,最后激活。 }3sNt f"i?,YE3iK

5H [&r"KX&X+h $Oq2E$b(gl
1. Set manually R"jEt.n7c3}2x
|V1YD+h/G

:z$M f8a%Xf OJ a. Set the IP address of your machine.
H1ee5|'[ F tGF;E:JO}
\^I(m S-mw
# ifconfig ethX "the IP address of your machine"

bbs23 发表于 2008-6-11 07:21

b. Set the IP address of DNS. &m h/L_(s [@Y
-DpG0r5J
/Z%B0B9TavQ;e
Insert the following configuration in /etc/resolv.conf. 8^*f ]:o1m0P4S:H
4cv q1o\q
nameserver "the IP address of DNS"
:Ry cWE6s0D,@ I %x!A$k]%En

K l6yt/EWK#T2q c. Set the IP address of gateway.
F3jLR:x(w1z g&Wnr YY

JReXH} P|(za # route add default gw "the IP address of gateway"
e ]elqp
0pt|0za'S7Y-J 7xn.j&SQ&BO
2. Set by doing configurations in /etc/sysconfig/network-scripts
lNnA@ V2v,fR8C K:i!@ g8v.Kr3Y
3pEV5@j8UHh8c
/ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network s0}!dqM
y+^QT%??
/ifcfg-ethX for SuSE. There are two examples to set network
+t o(F3o%Cj t
x9i8PG\$C configurations.
7B[{j Rh (bd*v PK-ZwB

/Xtm$?a,|z_J a. Fix IP address: V0Es8R2_/VS
9x5yg#k)wU(GPa

$y kW(W r DEVICE=eth0 (H)w H)V3P1]%O

Y#m0_/HZ'Fz:H BOOTPROTO=static mj1HgF1[6|

@G3A*e_/X.i ONBOOT=yes X;|RT:n"[+UZ/B
b:N;i@_^7T
TYPE=ethernet 2|)Z6n(fy2o1V$?!^9~
%g$a0st7m.n9U7^IW
NETMASK=255.255.255.0 0IH%_L{

~ o VT/UR IPADDR=192.168.1.1 I)H"P)KIS
im!U%gw WZ4X6m
GATEWAY=192.168.1.254
B` jQn ]J6q
@Z.[u(b~+\e BROADCAST=192.168.1.255 w*S7C?K%WU

'}2sB8C*jBw9Q9J
qO^7kO$o 2. 修改:#vi /etc/hosts,在该文本中,增加两行:
f}(J(b R`4j dr-Y!N-b ])Z(M
+XL] {@$SdqMa
127.0.0.1 localhost.localdomain localhost 7wvBa0FaY

\!@gQ-J"fl8N 192.168.4.101 node3(根据机器本身情况设置)
(TAf!q]2_4n0{
1S8{~ iWC
X6g`:_gI&L2G:pS 修改:vi /etc/hosts.equiv,增加一行:(如果没有该文本,可建立一个)
OJ1[hU @1Uf 5S*JH Vvobw

X y5b@Q5x node3
S5S#@`4A.~(i Z -RQ}'b ST+^Fn

&YFm/e J.Kh3MzKK)~ 3. 启动ssh服务
x;`-]AIWT
D)aQ5`/\RLr ]P,j4ju5ym
大部分的Linux版本应该都会自带该程序
0[Z/q(~3?:G0u
Sq8p+O+xj K2O%b
&akq.P)I;if-T y o #ssh-keygen
:S#Pa-F$v f3z
e4WX9G1pQja #cd .ssh GJa[`RIB,k

,N!R"~/c9X #cp id_rsa.pub authorized_keys
#vB/Of XS8UL Unq'w9hj
#ssh node3(如果成功,会显示上次登陆的时间, node3是主机名)
VpJ:Hf'?X w(a0P rr.{ob
0B/vd$x u(g:sbnz
附加信息: WnuFV"j4k

{!b4{r&zvlG qN3pu ifup eth0看看能否启动eth0 Xhl e4t${7ShW
-m mZa d%H3yy\
lsmod看看有没有加载网卡驱动 *Com'PLL
w!{p+q&F5m
dmesg看看有没有网卡启动时的错误信息

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.