您的位置:首页 > 理论基础 > 计算机网络

克隆或复制VMware虚拟机时的网络设置

2016-05-05 21:09 609 查看
在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 ~]# 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  vmware 虚拟机 网络 mac