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

Hi,
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
HOSTNAME=foobar.example.com
IPADDR=192.168.133.7

However this does not work on vEOS.

The firmware driver (https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-testing&id=75f3e8e47f381074801d0034874d20c638d9e3d9) 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?

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

Hello,

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.

Thx
Patrik

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:127.0.0.1:5030,server,nowait -monitor tcp:127.0.0.1:45997,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=127.0.0.1:10403,localaddr=127.0.0.1:10402
-device e1000,mac=0c:29:54:f6:56:01,netdev=gns3-1 -netdev socket,id=gns3-1,udp=127.0.0.1:10405,localaddr=127.0.0.1:10404
-device e1000,mac=0c:29:54:f6:56:02,netdev=gns3-2 -netdev socket,id=gns3-2,udp=127.0.0.1:10407,localaddr=127.0.0.1:10406
-device e1000,mac=0c:29:54:f6:56:03,netdev=gns3-3 -netdev socket,id=gns3-3,udp=127.0.0.1:10409,localaddr=127.0.0.1:10408
-device e1000,mac=0c:29:54:f6:56:04,netdev=gns3-4 -netdev socket,id=gns3-4,udp=127.0.0.1:10411,localaddr=127.0.0.1:10410
-device e1000,mac=0c:29:54:f6:56:05,netdev=gns3-5 -netdev socket,id=gns3-5,udp=127.0.0.1:10413,localaddr=127.0.0.1:10412
-device e1000,mac=0c:29:54:f6:56:06,netdev=gns3-6 -netdev socket,id=gns3-6,udp=127.0.0.1:10415,localaddr=127.0.0.1:10414
-device e1000,mac=0c:29:54:f6:56:07,netdev=gns3-7 -netdev socket,id=gns3-7,udp=127.0.0.1:10417,localaddr=127.0.0.1:10416
-device e1000,mac=0c:29:54:f6:56:08,netdev=gns3-8 -netdev socket,id=gns3-8,udp=127.0.0.1:10419,localaddr=127.0.0.1:10418
-device e1000,mac=0c:29:54:f6:56:09,netdev=gns3-9 -netdev socket,id=gns3-9,udp=127.0.0.1:10421,localaddr=127.0.0.1:10420

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

vEOS
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
3)Reboot
And
Then use them in your ZTP

https://eos.arista.com/forum/using-veos-for-ztp-tests-cannot-find-any-serial-number/

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

Hello

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.

Thanks
Patrik

Post your Answer

You must be logged in to post an answer.