Posted on August 12, 2019 10:07 am
 |  Asked by Alan Sergeant
Print Friendly, PDF & Email

I am trying to make use of qemu’s -fw_cfg flag.

Usage: -fw_cfg name=opt/GuestInfo,file=/guest_infos/guestinfo.txt

This allows a config to be passed into qemu vms.

For example, on fedora 30:

cat /sys/firmware/qemu_fw_cfg/by_name/opt/GuestInfo/raw

However this does not work on vEOS.

The firmware driver ( i believe is included in kernels 4.6 and above.

I am using vEOS 4.22.0F which has a kernel above 4.6

Any help much appreciated?

Posted by Patrik Olsson
Answered on August 12, 2019 10:51 am


since EOS first starts About (a busy box Linux), the actual configuration you are trying to send forward to the actual EOS Linux instance will never reach it. If it is received at all, it is stuck in BusyBox.

What kind of configuration are you after? Hostname and IP address? This can be provided via Option 67 in BOOTP/DHCPv4. Option 67 can either forward a complete EOS config file or a Python script that runs onboard the EOS device and configures it locally.


Hi Patrick,

Thanks for your answer. I’m trying to simulate ztp configuration, whereby a virtual switch will come up, will receive the ztp script to run, and configure itself.

Yes, i could use dhcp to provide hostname, but if you have several switches starting at once, how do you tell which is which?

The problem is, in the physical world you have prior knowledge, serial number and mac address so when the switch asks for its hostname, you can have that already configured (in your dhcp config or ztp script).

In my simulation, i want to start several switches, then the ztp script to look at the environment variables, and send a request to the api containing the hostname (if its virtual) or serial (if its physical). From there the correct config can be sent to the correct switch.

(Alan Sergeant at August 12, 2019 2:13 pm)

HI Alan wouldn’t it be simpler to use MAC address (System Mac) for the vEOS ?
That one can set using QEMU easily. Though I haven’t had the opportunity to explicitly set one.
And use the System MAC as vendor identifier to distinguish the vEOS instances and set their ZTP

(Dharmesh Shah at August 12, 2019 6:24 pm)

Ok, that sounds good. How do i set it via Qemu?

The command at the moment looks something like ….

Start QEMU with /usr/bin/qemu-system-x86_64 -name p17c10-ls-00-00-a -m 2048M -smp cpus=1 -enable-kvm -machine smm=off -boot order=c -drive file=/var/lib/gns3/GNS3/projects/ae79b48b-97d3-420c-ba5f-74766f7e2954/project-files/qemu/1f730bdb-77b9-4b57-a2a9-2ddda4d2f656/hda_disk.qcow2,if=ide,index=0,media=disk -drive file=/var/lib/gns3/GNS3/projects/ae79b48b-97d3-420c-ba5f-74766f7e2954/project-files/qemu/1f730bdb-77b9-4b57-a2a9-2ddda4d2f656/hdb_disk.qcow2,if=ide,index=1,media=disk -uuid 1f730bdb-77b9-4b57-a2a9-2ddda4d2f656 -serial telnet:,server,nowait -monitor tcp:,server,nowait -net none
-device i82801b11-bridge,id=dmi_pci_bridge1 -device pci-bridge,id=pci-bridge1,bus=dmi_pci_bridge1,chassis_nr=0x1,addr=0x1,shpc=off
-device e1000,mac=0c:29:54:f6:56:00,netdev=gns3-0 -netdev socket,id=gns3-0,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:01,netdev=gns3-1 -netdev socket,id=gns3-1,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:02,netdev=gns3-2 -netdev socket,id=gns3-2,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:03,netdev=gns3-3 -netdev socket,id=gns3-3,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:04,netdev=gns3-4 -netdev socket,id=gns3-4,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:05,netdev=gns3-5 -netdev socket,id=gns3-5,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:06,netdev=gns3-6 -netdev socket,id=gns3-6,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:07,netdev=gns3-7 -netdev socket,id=gns3-7,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:08,netdev=gns3-8 -netdev socket,id=gns3-8,udp=,localaddr=
-device e1000,mac=0c:29:54:f6:56:09,netdev=gns3-9 -netdev socket,id=gns3-9,udp=,localaddr=

I would therefore expect the EOS system MAC to use the lowest Mac address, i.e. 0c:29:54:f6:56:00

but a show version reports

Hardware version:
Serial number:
System MAC address: 0c29.546d.38eb

Software image version: 4.22.0F
Architecture: i386
Internal build version: 4.22.0F-12170486.4220F
Internal build ID: 2c34e816-9aa7-4c63-9a32-05140aec7dbd

Uptime: 0 weeks, 0 days, 0 hours and 23 minutes
Total memory: 2014584 kB
Free memory: 1246808 kB

(Alan Sergeant at August 13, 2019 6:26 am)

HI Alan
I haven’t had much luck figuring out how you could set system Mac or serial number via QEMU.
Apparently some internal digging around suggests, that system Mac is randomly generated using the 1st 3 OUI from the Management Interface.
Thus your system Mac has common 0c29:54 (and remaining is randomly generated with Ma1 as seed)
So we can’t force it via QEMU

but, there is a workaround.
1)Perhaps you could start your QEMU instances,
2)Assign System MAC and/or Serial Number
Then use them in your ZTP

(Dharmesh Shah at August 15, 2019 1:17 pm)
Posted by Patrik Olsson
Answered on August 13, 2019 7:53 am


I agree with Dharmesh. If a script starts the virtual instance, the MAC for it is easy to set.
Then use that in a standard ZTP setup to determine config for the device.


Post your Answer

You must be logged in to post an answer.