Tag Archives: virtualisation

Adding Arista vEOS images to UnetLab

Arista provides a number of VM type images that you can use. The one with the software forwarding plane is vEOS-lab. This image has all the control plane features of standard EOS from Arista, with a software dataplane – the downside to this is that features that rely on the hardware e.g. NAT aren’t available.

There are two files required to get a working vEOS switch. The vmdk file and the Aboot ISO. To create a working vEOS on 4.17.5M we need:

  • vEOS-lab-4.17.5M.vmdk
  • Aboot-veos-serial-8.0.0.iso

To create an image that UnetLab will recognise the following steps should turn the trick

  1. Create the directory for the version in question
  2. Copy the two files in there
  3. Convert the vEOS-lab-4.17.5M.vmdk to a qcow image
  4. Rename the Aboot ISO to cdrom.iso file
  5. All done – fire up your Lab and select Arista vEOS as the template
mkdir /opt/unetlab/addons/qemu/veos-4.17.4M/
/opt/qemu/bin/qemu-img convert -f vmdk -O qcow2 ./vEOS-4.17.5M.vmdk hda.qcow2
mv Aboot-veos-serial-8.0.0.iso /opt/unetlab/addons/qemu/veos-4.17.5M/cdrom.iso
rm ./vEOS-4.17.5M.vmdk
/opt/unetlab/wrappers/unl_wrapper -a fixpermissions

 

Host-Guest Networking with macvtap

I’ve been working with a lot of VMs lately and was using the “new” macvtap + bridge mode for the VM networking as this is supposed to offer great performance, while being simpler to configure. A key point is that each macvtap has its own mac address on the same Ethernet segment – think of this as an Ethernet sub-interface. The physical interface to which the macvlan is attached is often referred to as “the lower device”, with the macvtap itself referred to as the “upper device”.

macvtap has a number of different modes that it can be run in;

  • Bridge: this works almost like a traditional bridge, in that data received on a macvlan in bridge mode and destined for another macvlan of the same lower device is sent directly to the target (if the target macvlan is also in bridge mode), rather than being sent outside. Basically no learning, and no STP – simple and fast
  • VEPA: Virtual Ethernet Port Aggregator is the default mode. If the lower device receives data from a macvlan in VEPA mode, this data is always sent “out” to the upstream switch or bridge, even if it’s destined for another macvlan in the same lower device. The benefit to this is that the traffic between VMs becomes visible externally, the downside being that the external switch must support hair-pin mode (a.k.a reflective relay).
  • Private: this is essentially like VEPA mode, but with the added feature that no macvlans on the same lower device can communicate, regardless of where the packets come from – basically think of it as acting like a private VLAN.
  • Passthrough: No idea yet about this mode

There is one big disadvantage to macvlan though – by design it is not possible for the host to connect directly with the guests.

There is however a workaround – we add a new macvtap interface to the host, and route all VM communications through that bridge. Basic steps are;

Create a new macvlan bridge and bring it up

sudo ip link add link eth0 macvlan0 type macvlan mode bridge
sudo ifconfig macvlan0 up
sudo ifconfig macvlan0
macvlan0  Link encap:Ethernet  HWaddr fa:ab:14:97:fd:ec
inet6 addr: fe80::f8ab:14ff:fe97:fdec/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B)  TX bytes:508 (508.0 B)

Assign an IP address to the macvtap interface (192.168.1.3), and add a static host route towards the VM IP (192.168.1.10)

sudo ifconfig macvlan0 192.168.1.3 netmask 255.255.255.0
sudo ip route add 192.168.1.10/32 via 192.168.1.3 dev macvlan0

And there you go – host-guest communications via macvtap interfaces

ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=0.282 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=0.134 ms

The downside to this being;

  1. You lose 1 extra IP address on the host, so it can network to the guest
  2. You have to add a lot of static routes unless you further subnet your network between VM and non-VM hosts, and route the VM subnet through the macvap interface

Using KVM on top of ESXi

KVM and VMware

I’ve been playing with SDN, VMs etc. in a lab. Given that I don’t have a load of servers lying around I tend to use VMs (so nested virtualisation) on ESXi. As I learned the hard way there are a few little details you have to watch if you want to use the KVM hypervisor.

ESXi5.1 (or later)

Virtualized HV is fully supported for virtual hardware version 9 VMs on hosts that support  Intel VT-x and EPT or AMD-V and RVI.

Virtual Hardware

Something I learned the hard way was that the VMs I created have virtual hardware VM version 8 by default. This was the default under ESXi 5.0 and doesn’t support virtualised HVs. Using the Web Client stop the VM and upgrade the hardware to VM Version 9 (or later)

vm-hardware-upgrade

vSphere Web Client – Exposing Hardware Virtualisation

With vSphere 5.1 you cannot create a new VM in the Windows vSphere client and allow the virtualization features of the processor to be presented.  So you will want to use the web client to create the shell not the windows client. This seems to be the way it will stay going forward – only the web client will have all the features shown.

Check the ‘Expose hardware virtualisation to Guest OS’ box under the CPU settings.

webClient_virtual_hardwareAnd that should do it – your Guest OS will now be able to run KVM hypervisor (or any other one of your choice)