vmware red hat 5.3系统复制后网卡配置

linux虚拟机在vmware workstation 上复制后,网卡使用手工配置后总是从net8上自动获得地址,无法完成自己配置的地址

[root@cell1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:5C:5C:4A 
          inet addr:192.168.83.134  Bcast:192.168.83.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:84 errors:0 dropped:0 overruns:0 frame:0
          TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9911 (9.6 KiB)  TX bytes:7415 (7.2 KiB)
          Interrupt:177 Base address:0x1400

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1725 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1725 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:98764 (96.4 KiB)  TX bytes:98764 (96.4 KiB)

[root@cell1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
HWADDR=00:0c:29:5c:5c:4a
IPADDR=192.168.83.11
NETMASK=255.255.255.0
GATEWAY=192.168.83.1

将网卡目录下备份的所有网卡设备名eth0修改

[root@cell1 ~]# cd /etc/sysconfig/network-scripts/
[root@cell1 network-scripts]# ls
ifcfg-eth0       ifdown-isdn    ifup-eth    ifup-routes
ifcfg-eth0.bak   ifdown-post    ifup-ippp   ifup-sit
ifcfg-eth0.bak2  ifdown-ppp     ifup-ipsec  ifup-sl
ifcfg-lo         ifdown-routes  ifup-ipv6   ifup-tunnel
ifdown           ifdown-sit     ifup-ipx    ifup-wireless
ifdown-bnep      ifdown-sl      ifup-isdn   init.ipv6-global
ifdown-eth       ifdown-tunnel  ifup-plip   net.hotplug
ifdown-ippp      ifup           ifup-plusb  network-functions
ifdown-ipsec     ifup-aliases   ifup-post   network-functions-ipv6
ifdown-ipv6      ifup-bnep      ifup-ppp
[root@cell1 network-scripts]# vi ifcfg-eth0.bak

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth00
BOOTPROTO=static
HWADDR=00:0C:29:23:CA:C5
ONBOOT=yes
IPADDR=192.168.204.10
NETMASK=255.255.255.0
GATEWAY=192.168.204.1

修改后的效果

[root@cell1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:5C:5C:4A 
          inet addr:192.168.83.11  Bcast:192.168.83.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:437 errors:0 dropped:0 overruns:0 frame:0
          TX packets:330 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:41000 (40.0 KiB)  TX bytes:43033 (42.0 KiB)
          Interrupt:177 Base address:0x1400

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2101 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2101 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:120432 (117.6 KiB)  TX bytes:120432 (117.6 KiB)

 

原理:linux下设备udev采用动态管理和UUID号有关系

网上有人修改

 vi /etc/modprobe.conf 

也有人修改

rm -f /etc/udev/rules.d/70-persistent-net.rules 

也有人先删除网卡,再添加网卡解决问题

 

但是5.3遇到的情况是

[root@cell1 rules.d]# ls
05-udev-early.rules  51-hotplug.rules  60-pcmcia.rules      90-alsa.rules  95-pam-console.rules
40-multipath.rules   60-net.rules      60-raw.rules         90-dm.rules    98-kexec.rules
50-udev.rules        60-net.rules.bak  85-pcscd_ccid.rules  90-hal.rules   bluetooth.rules

没有70-persistent-net.rules 这个文件,最后想到是备份网卡修改设备名称解决问题。图形化界面可以在网卡管理里,删除copy产生的网卡,重启网络服务即可。

 

希望对大家有帮助

本文出自 “测试” 博客,请务必保留此出处http://33205687.blog.51cto.com/6173537/1621130

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。