您的位置:首页 > 运维架构 > Linux

VMware虚拟机克隆Linux系统后找不到eth0网卡的问题解决

2017-08-11 03:48 357 查看
参考文章http://www.linuxidc.com/Linux/2013-01/78427.htm

自己写个脚本解决一下:

#!/bin/sh
#读出新的mac地址
eth0Address=$(/bin/grep "eth1" /etc/udev/rules.d/70-persistent-net.rules |/bin/sed 's/,/\n/g'|/bin/grep ATTR{address}|sed 's/==/\n/g' |/bin/grep -E "[1-9]+" | sed 's/"//g')
#删除旧mac地址
sed -i '7d' /etc/sysconfig/network-scripts/ifcfg-eth0
#写入新地址
echo "HWADDR=$eth0Address" >> /etc/sysconfig/network-scripts/ifcfg-eth0
#删除,让它重新生成
rm -f /etc/udev/rules.d/70-persistent-net.rules
#重启
reboot
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: