Unable to connect to the MKS: Failed to connect to server

If you get this error: “Unable to connect to the MKS: Failed to connect to server” and cannot open the console of a virtual machine from the VMware vSphere client, don’t let it mislead you, it’s not a network connectivity or firewall issue. As unlikely as it may sound, the problem is related to your name server…

I ran into this a couple of months ago while trying to troubleshoot a VM that had lost connectivity to the rest of the network.

Scenario

We deployed a VMware vCenter server 5.5 Virtual Appliance and added some ESX hosts that we had installed in 8 UCS B200 M3 blade servers.

We deployed some .ovf and .ova files, created several virtual machines and distributed them among the ESX hosts, forming a cluster in a data center as you usually do.

After a power outage, most of the VMs recovered, but one or 2 did not.

Troubleshooting

All the network devices were up and running: a couple of catalyst 6509 acting as the distribution layer as a VSS, a couple of Nexus 5000 at the access layer and a couple of UCS Fabric Interconnects 6248, managing 2 UCS chassis with 10 B200 blade servers.

The Nexus 5K switches were connected in a dual vPC topology: to the upstream Catalyst switches and also to the UCS Fabric Interconnects.

There was also one Catalyst 3850X acting as access switch from another building, where we had a PC to test with.

We made sure that all the vPCs were up and that the required Vlans were configured and working correctly all the way.

We also checked that the FW (a couple of ASA service modules inserted into the Cat 6509s) was not blocking this traffic.

Coming from the networking world, this was the most logical approach for us. It had to be something else then.

We connected to the vCenter server with the vSphere client and were able to see that the VM was actually running.

The next logical step was to check if the VM was able to ping its default gateway, one of the interfaces of the FW.

Error message in vSphere 5.5 Client

To our surprise, we were not able to access the console of the virtual machine.

How to launch the console of a VMware virtual machine from a vSphere 5.5 client

How to launch the console of a VMware VM from a vSphere client

 

This is the error message we got after trying to open the console of the VM from the vSphere client: “Unable to connect to the MKS: Failed to connect to server”:

VM console error in vSphere client - Unable to connect to the MKS: Failed to connect to server

Error opening console of a VM in vSphere client

It sort of makes you think that the vSphere client cannot access the IP of your vCenter on port 902.

Don’t check your firewall, the problem is certainly NOT with your client accessing your vCenter server on TCP port 902.

Solution

However, we found out that the problem had to do with DNS resolution. The vSphere client is actually trying to look for the IP address of the ESX host where the VM is currently running. If it’s not able to solve for the hostname of the ESX host, this error message will pop up.

If you want a temporal solution, as I did, you just need to focus on the current ESX host where the virtual machine is currently running in.

 

To do this, simply select the virtual machine in the left pane and then cluck on the “Summary” tab. You’ll be able to see current location of the VM after “Host:” as shown here:

Find the location of a virtual machine (which ESX host in whih runs) in a VMware cluster

VM location (ESX host where it runs) in a VMware cluster

A more escalable approach would be to  create an A record for each ESX host’s hostname at the DNS server.

Since I needed a quick fix, I decided to edit the hosts file on my windows 7.

You do need to run notepad as “administrator”, though:

 

How to run Notepad as an Administrator in Widnows 7

Run Notepad as Administrator in Widnows 7

This is the location of the “hosts” file in Windows 7: Windows-System32-drivers-etc. It may vary from one distribution of Windows to another, but it more or less the same in most of them.

The path of the "hosts" file in Windows 7

“hosts” file path in Windows 7

There should be one line that maps the hostname of the ESX host where the VM is running to the management IP address of its VMKernel.

In our case, we had to map 172.16.70.17 to its hostname, esx07.   This is what the content should look like:

Windows 7 hosts file content for ESXi host in vCenter

“hosts” file content for an ESXi host in vCenter

As soon as this line was added we were able to open the console of the VM.

Console of a Windows 8 virtual machine in VMware vCenter

Console of a Windows 8 VM in a VMware ESX host

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>