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

如何解决Linux *** 作系统找不到网卡的问题,第1张

Unpack the tarball : # tar vjxf r8168-8.aaa.bb.tar.bz2 Change to the directory: # cd r8168-8.aaa.bb If you are running the target kernel, then you should be able to do : # make clean modules (as root or with sudo) # make install # /sbin/depmod -a # /sbin/insmod ./src/r8168.ko (or r8168.o in linux kernel 2.4.x) You can check whether the driver is loaded by using following commands. # /sbin/lsmod | grep r8168(看看有没有加载网卡驱动) # /sbin/ifconfig –a(看看有没有相关网卡被启动的信息) If there is a device name, ethX, shown on the monitor, the linux driver is loaded. Then, you can use the following command to activate the ethX. # ifconfig ethX up ,where X=0,1,2,... 这里也可以通过系统→管理→网络来设置IP地址等,最后激活。 1. Set manually a. Set the IP address of your machine. # ifconfig ethX "the IP address of your machine" b. Set the IP address of DNS. Insert the following configuration in /etc/resolv.conf. nameserver "the IP address of DNS" c. Set the IP address of gateway. # route add default gw "the IP address of gateway" 2. Set by doing configurations in /etc/sysconfig/network-scripts /ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network /ifcfg-ethX for SuSE. There are two examples to set network configurations. a. Fix IP address: DEVICE=eth0 BOOTPROTO=static ONBOOT=yes TYPE=ethernet NETMASK=255.255.255.0 IPADDR=192.168.1.1 GATEWAY=192.168.1.254 BROADCAST=192.168.1.255 2. 修改:#vi /etc/hosts,在该文本中,增加两行: 127.0.0.1 localhost.localdomain localhost 192.168.4.101 node3(根据机器本身情况设置) 修改:vi /etc/hosts.equiv,增加一行:(如果没有该文本,可建立一个) node3 3. 启动ssh服务 大部分的Linux版本应该都会自带该程序 #ssh-keygen #cd .ssh #cp id_rsa.pub authorized_keys #ssh node3(如果成功,会显示上次登陆的时间, node3是主机名) 附加信息: ifup eth0看看能否启动eth0 lsmod看看有没有加载网卡驱动 dmesg看看有没有网卡启动时的错误信息 (责任编辑:云子)

这个提示是指网口的mac地址已经变化,但是设备名称没有变化,导致设备名称和mac地址无法匹配,linux无法挂载该网口。换种说法就是该网口的配置文件里的mac地址和该网口实际的mac地址不符合。

这种情况一般发生在虚拟机迁移,或者更换网卡的时候,解决方案如下:

1:记录网口的实际地址,执行ifconfig eth0

其中HWaddr后面就是网口实际的mac地址

2:更改配置文件中的mac地址

打开eth0的网口配置文件: /etc/sysconfig/network-scripts/ifcfg-eth0

(该地址可能随着不同的 *** 作系统有所不同)

在文件中寻找 HWADDR= 这行,如果没有就新加一行。把这行后面的值改成第一步看到的mac地址值,例如 HWADDR="00:0C:29:2D:2D:CF",然后保存退出

3:通过service network restart重启网卡,或者通过ifup eth0启动网卡(该命令会检查配置文件)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8743830.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-20
下一篇 2023-04-20

发表评论

登录后才能评论

评论列表(0条)

保存