vmware workstation克隆虚拟机后使用 ifconfig命令只显示回环网卡eth0却不见了
[root@localhost ~]# ifconfig
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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
可以用下面的方法把eth0改回来:
1. 修改 70-persistent-net.rules 文件
[root@localhost ~]# vim /etc/udev/rules.d/70-persistent-net.rules
# 把原来的配置注释掉
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:51:56:9c:00:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x15ad:0x07b0 (vmxnet3)
# 把新出现的eth1改为eth0
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:51:56:9c:00:9a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
2. 更改网卡配置文件 ifcfg-eth0
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
# 把MAC地址改成新的地址
HWADDR=00:50:56:9C:00:3A
TYPE=Ethernet
UUID=1992b477-1f45-4228-a010-a9d7dfd580fe
ONBOOT=yes
NM_CONTROLLED=yes
#BOOTPROTO=dhcp
BOOTPROTO=none
IPADDR=192.168.196.157
NETMASK=255.255.255.0
GATEWAY=192.168.196.2
3. DNS域名解析的配置文件增加DNS服务器的IP地址/etc/resolv.conf 文件
解决 “Couldn't resolve host 'mirrorlist.centos.org” 问题
nameserver 192.168.196.2
#search 168.91.101
3. 重启服务器,完成。