克隆或複製VMware虛擬機時的網絡設置

在clone之後的虛擬機裏,啓動之後更改MAC地址和設備文件名。

[root@sparkworker1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:16:ED:6A"
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR="192.168.10.81"
NETMASK="255.255.255.0"
GATEWAY="192.168.10.1"
DNS1="192.168.10.1"
[root@sparkworker1 ~]# cat /etc/udev/rules.d/70-persistent-net.rules 
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.


# PCI device 0x8086:0x100f (e1000)




# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:e1:7b:39", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
[root@sparkworker1 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
//這裏把/etc/sysconfig/network-scripts/ifcfg-eth0 裏的MAC改成"00:0c:29:e1:7b:39"

[1]+  Stopped                 vim /etc/sysconfig/network-scripts/ifcfg-eth0
[root@sparkworker1 ~]# fg
vim /etc/sysconfig/network-scripts/ifcfg-eth0
[root@sparkworker1 ~]# vim /etc/udev/rules.d/70-persistent-net.rules 
[root@sparkworker1 ~]# ifdown eth0  //重啓網卡即可
[root@sparkworker1 ~]# ifup eth0
Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
state: activated
Connection activated
[root@sparkworker1 ~]# 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章