Linux虚拟机识别网卡错位问题+整理小问题

解决方法:

编辑/etc/udev/rules.d/70-persistent-net.rules,找到与ifconfig -a得出的MAC相同的一行(NAME='eth1'这一行),把它改为"NAME=eth0 ",然后把上面一行(NAME='eth0')删除掉。

vim /etc/udev/rules.d/70-persistent-net.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:bb:41:2b", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

2.编辑/etc/sysconfig/network-script/ifcfg-eth0,把MAC改为正确的,把UUID删掉。

3.编辑/etc/sysconf/network,把hostname也改一下。

4.重启生效!

在/etc/rc.local中添加
如果不想将脚本粘来粘去,或创建链接什么的,
则:
step1. 先修改好脚本,使其所有模块都能在任意目录启动时正常执行;
step2. 再在/etc/rc.local的末尾添加一行以绝对路径启动脚本的行;
如:
$ vim /etc/rc.local

!/bin/sh

#

This script will be executed after all the other init scripts.

You can put your own initialization stuff in here if you don't

want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
. /etc/rc.d/rc.tune
/opt/pjt_test/test.pl

DEVICE=eth1
BOOTPROTO=static
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
IPADDR=8.8.8.8
NETMASK=255.255.255.0
GATEWAY=14.14.14.14


标签: none

添加新评论