I want to create multiple qemu guest vm through packer but both the vm getting same ip 10.0.2.15 and mac address also is same.
Then i have added mac address for both the vm as below, but still same mac and same ip is getting assigned and mac address hardcoded is different that what assigned to guest vm every time, can anyone please help
Also after updating default.xml through sudo virsh net-edit default , destroyed and started it and restart libvirtd.
this is my default.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh net-edit default
or other application using the libvirt API.
-->
<network>
<name>default</name>
<uuid>987ec465-087a-4a1b-9b46-218b92df34f0</uuid>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:f7:e2:09'/>
<domain name='testenv' localOnly='no'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
<host mac='52:54:00:0a:f3:8d' name='aux-node' ip='192.168.122.20'/>
<host mac='52:54:00:90:bf:39' name='app-node' ip='192.168.122.21'/>
</dhcp>
packer json file through building 2 guest vm, i am using these 2 parameters also “net_device”: “virtio-net”, “disk_interface”: “virtio”,
{
"builders": [
{
"type": "qemu",
"name": "aux-node",
"qemu_binary": "/usr/libexec/qemu-kvm",
"iso_url": "/var/lib/libvirt/images/test.iso",
"iso_checksum": "md5:14029d4c94b74492ee4c97f2f736390a",
"output_directory": "/var/lib/libvirt/images/iso-dir/auxtest",
"disk_size": "350G",
"headless": "true",
"qemuargs": [
[
"-m",
"8000"
],
[
"-cpu",
"host"
],
[
"-smp",
"4"
]
],
"format": "qcow2",
"accelerator": "kvm",
"ssh_username": "*****",
"ssh_password": "*****",
"ssh_timeout": "20m",
"vm_name": "auxtest",
"net_device": "virtio-net",
"disk_interface": "virtio",
"http_directory": "/home/sogouser/http",
"boot_wait": "10s",
"boot_command": [
"<down><tab><bs><bs><bs><bs><bs>text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks.cfg<enter><wait>"
]
},
{
"type": "qemu",
"name": "app-node",
"qemu_binary": "/usr/libexec/qemu-kvm",
"iso_url": "/var/lib/libvirt/images/test.iso",
"iso_checksum": "md5:14029d4c94b74492ee4c97f2f736390a",
"output_directory": "/var/lib/libvirt/images/iso-dir/apptest",
"disk_size": "150G",
"headless": "true",
"qemuargs": [
[
"-m",
"40000"
],
[
"-cpu",
"host"
],
[
"-smp",
"8"
]
],
"format": "qcow2",
"accelerator": "kvm",
"ssh_username": "***",
"ssh_password": "****",
"ssh_timeout": "20m",
"vm_name": "apptest",
"net_device": "virtio-net",
"disk_interface": "virtio",
"http_directory": "/home/sogouser/http",
"boot_wait": "200s",
"boot_command": [
"<tab><bs><bs><bs><bs><bs>text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks-app.cfg<enter><wait>"
]
}
]