HowTo Install Virtual Machine on Mellanox Ethernet Switches

Version 11

    This post shows how to install a VM on Mellanox Ethernet switches (SX1710, SX1400 - x86 based CPU)

     

    References

    • MLNX-OS User Manual

     

    Procedure

    1. Enable virtual machine globally.

    switch (config) # virtual-machine enable

     

    2. Create a VM (give it a name e.g. neo)

    switch (config) # virtual-machine host neo

     

    3. Create a disk space (e.g. 5GB) and exit.

    switch (config virtual-machine host neo) # storage create disk size-max 5000

    100.0%  [############################################################################################################################################################]

    Created empty virtual disk volume 'vdisk001.img' in pool 'default'

    Device attached to drive number 1.

    switch (config virtual-machine host neo) # exit

    switch (config) #

     

    4. Fetch an ISO image.

    In this case I used minimal CentOS 6.5 version (Can be found at http://archive.kernel.org/centos-vault/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso that was downloaded to an external server)

    switch (config) # virtual-machine volume fetch url scp://root@my-server-name/tmp/CentOS-6.5-x86_64-minimal.iso

    Password (if required): ******

    100.0%  [############################################################################################################################################################]

     

    5. Install the VM, the window will stack.

    switch (config) # virtual-machine host neo install cdrom file CentOS-6.5-x86_64-minimal.iso

     

    Note: The window will be frozen at this point and wait for your console connection to the VM

     

    6. Connect to the console VM (via another terminal).

    Open another terminal (e.g. VNC window) and connect to the console VM via the switch IP address:

    Note: Leave the switch window open (frozen)

    # vncviewer -via admin@10.20.2.54 127.0.0.1:0

     

    VNC Viewer Free Edition 4.1.2 for X - built Mar 24 2009 19:52:30

    Copyright (C) 2002-2005 RealVNC Ltd.

    See http://www.realvnc.com for information on VNC.

     

    Mellanox MLNX-OS Switch Management

     

    Thu May 28 00:48:20 2015

    CConn:       connected to host localhost port 5599

    CConnection: Server supports RFB protocol version 3.8

    CConnection: Using RFB protocol version 3.8

     

    Thu May 28 00:48:21 2015

    TXImage:     Using default colormap and visual, TrueColor, depth 16.

    CConn:       Using pixel format depth 6 (8bpp) rgb222

    CConn:       Using ZRLE encoding

     

    Thu May 28 00:48:22 2015

    CConn:       Throughput 18888 kbit/s - changing to hextile encoding

    CConn:       Throughput 18888 kbit/s - changing to full colour

    CConn:       Using pixel format depth 16 (16bpp) little-endian rgb565

    CConn:       Using hextile encoding

    ...

     

    The Installation procedure should start:

    VM1-3.PNG

     

    Continue and install the OS (follow the wizard questions).

     

    7. Once you complete the installation of the VM, you can go back to the switch window and see that the installation is completed.

    switch (config) # virtual-machine host neo install cdrom file CentOS-6.5-x86_64-minimal.iso

    Installation complete.

     

    8. Check the status of the VM (currently off).

    switch (config) # show virtual-machine host neo

    VM 'neo'

       Status:       shut off                   Architecture:     x86_64

       VCPU used:    0 sec                      Number of VCPUs:  1

       Boot order:   hd, cdrom                  Memory size:      512 MB

       Consoles:     text, graphics

       Storage:

          IDE bus, drive 1: default/vdisk001.img (5000 MB capacity)

       Interfaces:

          1: on bridge 'mgmt0'            address unknown   (MAC 52:54:00:9D:27:2D)

     

    9. In case you wish to use DHCP for IP allocation, use the MAC address for the DHCP server and map an IP and hostname of the VM.

    In this case

    • VM hostname: switch-vm
    • IP: 10.20.2.56/24

     

    10. (Optional) Set the memory size for this VM (2GB is the maximum allowed, the default is 512MB)

    switch (config) # virtual-machine host neo memory 2048

     

    11. (Optional) Add CPU cores (2 cores is the maximum, default is 1)

    switch (config) # virtual-machine host neo vcpu count 2

     

    12. Power on the VM and verify that the new status is "running". Verify that the IP address was given.

    switch (config) # virtual-machine host neo power on

    switch (config) # show virtual-machine host neo

    VM 'neo'

       Status:       running                    Architecture:     x86_64

       VCPU used:    0.980 sec                  Number of VCPUs:  1

       Boot order:   hd, cdrom                  Memory size:      512 MB

       Consoles:     text, graphics

       Storage:

          IDE bus, drive 1: default/vdisk001.img (5000 MB capacity)

       Interfaces:

          1: on bridge 'mgmt0'           10.20.2.56   (MAC 52:54:00:9D:27:2D)

     

    In case, there is no IP address, you might need to connect again via the console again (see step 6) and make sure that the eth0 port got IP address and hostname from the DHCP server (or just configure the IP statically if DHCP is not used).

    CentOS release 6.6 (Final)

    Kernel 2.6.32-504.el6.x86 on an x86_64

     

    switch-vm login: root

    Password:

    Last Login The May 5 22:39:54 from ssh

     

    [root@switch-vm ~] # cat /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0

    HWADDR=52:54:00:9D:27:2D

    TYPE=ETHERNET

    ONBOOT=yes

    BOOTPROTO=dhcp

     

    [root@switch-vm ~] # ifconfig eth0

    eth0      Link encap:Ethernet  HWaddr 52:54:00:9D:27:2D

              inet addr:10.20.2.56  Bcast:10.20.2.255  Mask:255.255.255.0

              inet6 addr: fe80::5054:ff:fe9d:272d/64 Scope:Link

              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

              RX packets:1211 errors:0 dropped:160 overruns:0 frame:0

              TX packets:13 errors:0 dropped:0 overruns:0 carrier:0

              collisions:0 txqueuelen:1000

              RX bytes:98885 (8.9 TiB)  TX bytes:2113 (1.9 TiB)

     

    Note: in cast the VNC you are using is not in the same subnet of the management network, you many need to add the route to the default gateway within the ifcfg-eth0 file, or just manually by running:

    # route add default gw <gw ip address>

     

    Note: In case you use static IP address, you may need to add nameserver resolution (public known IP address) to the /etc/resolv.conf

    For example:

    nameserver 8.8.8.8

    Click here for more info.

     

    14. Connect directly to the VM via ssh.

    # ssh root@10.20.2.56

    root@10.20.2.56's password:

    Last login: Tue May  5 22:38:53 2015

    [root@switch-vm ~] #