# virsh list --all # virt-clone -o server1 -n server2 -f /var/lib/libvirt/images/server2.img # diff /etc/libvirt/qemu/dev-cent01.xml /etc/libvirt/qemu/dev-cent02.xml
# cd /var/lib/libvirt/images/ # cp server1.img server2.img
# cd /etc/libvirt/qemu/ # cp server1.xml server2.xml
# vi server2.xml (abbr) <name>server2</name> <uuid>xx.xxx-xx-xx</uuid> <source file='/var/lib/libvirt/images/server2.img/'> <mac address='xx'/> (abbr)
You need interface slots like 0x10, 0x11 etc.
[root@centos7 ~]# uuidgen c1222343-561f-4a06-80a2-b2dbde45be12 [root@centos7 ~]#
[root@centos7 ~]# vi macgen.py ----------------------------------------------- #!/usr/bin/python # macgen.py script to generate a MAC address for Red Hat Virtualization guests # import random # def randomMAC(): mac = [ 0x00, 0x16, 0x3e, random.randint(0x00, 0x7f), random.randint(0x00, 0xff), random.randint(0x00, 0xff) ] return ':'.join(map(lambda x: "%02x" % x, mac)) # print randomMAC() ----------------------------------------------- [root@centos7 ~]# chmod 755 macgen.py [root@centos7 ~]# ./macgen.py 26:a7:3a:99:c9:9e [root@centos7 ~]#
# virsh define /etc/libvirt/qemu/server2.xml
KVM CLI Commands Cheet Sheat and Configuration Examples