I use the leaked Nexus 7000 emulator (codename Titanium) VM on my Windows 7 laptop from time to time. It runs as a guest under VMware Workstation v9. One of the interesting items about this VM is that you access the Nexus 7000 console via a virtual serial port.
I recently decided to install a trial version VMware Workstation on a 64-bit Fedora 20 platform and imported the Nexus 7000 OVA (OVF Archive) which I built from the VM on my Windows platform. The problem I then encountered was how to connect to the virtual serial port.
The installation of the Linux version of VMware Workstation went smoothly and quickly, and the Nexus 7000 OVA was imported without a problem. I downloaded the VMware-Workstation-Full-10.0.2-1744117 image and installed it with the following command:
# sh VMware-Workstation-Full-10.0.2-1744117.x86_64.bundle
The look and feel of the Linux version is generally constant with the UI of the Microsoft Windows 7 version of VMware Workstation.
As you can see the Nexus 7000 VM requires the use of a serial port. So how do you access this serial port from the host command line or an application running on the host? On Windows, I can just use PUtty to access the emulated serial port via a named pipe as shown below:
On a Linux host, it turns out that the easiest way to get access to the emulated serial port is to configure the Nexus 7000 VM to redirect the datastream of the emulated serial port to a named pipe (/tmp/serial0) on the host as shown below:
Here is what the Nexus 7000 VM displays when it is powered up. Just ignore the “Ancient bootloader” warning message.
I want to redirect the named pipe, /tmp/serial0, to a socket, i.e. convert the named pipe serial data stream to an TCP/IP stream. I can then use telnet to interface with the emulated serial console of the Nexus 7000 VM. Probably the most common way of doing this is to use the socat (SOcket CAT) utility.
The socat command line utility, written by Gerhard Rieger, can be used to establish two bidirectional byte streams and transfers data between them. To put it another way, socat is a relay for bidirectional data transfer between two independent data channels. It is available in the Fedora 20 repos. The manpage for socat is denser and terser than normal. Fortunately, a good introduction to socat can be found at linux.com.
If you look carefully at the above image, you will see that I established my bidirectional steam to a TCP/IP socket with the following command:
# socat -d -d -d /tmp/serial0 tcp-listen:9999
The -d -d -d options direct socat to print fatal, error, warning, notice, and info messages.
I can now telnet to the loopback address (127.0.0.1), port 9999, and login to the Nexus 7000 VM serial console as shown below:
The following image shows part of the output from the NX-OS command show running-config:
One problem with accessing IOS or NX-OS via telnet is the brain dead and unconfigurable implementation of a telnet server that Cisco supplies in both IOS and NX-OS. There is no way to turn off echoing of responses. For this reason, I sometimes prefer to use the screen command to access the emulated serial console of the VM.
# socat -d -d -d UNIX-CONNECT:/tmp/serial0 PTY # screen /dev/pts/5 < ---- you need to determine pty device from socat debug output
The above commands provide you with a pure serial console into the Nexus 7000 VM.
If you know of a better way to access the emulated serial port of a VMware VM on a Linux host, please let me know the details.