Enabling VNC access to virtual machine console

From b0rken.org
Jump to: navigation, search

Enable VNC console for a VM

Locate the VM's .vmx file, for example /vmfs/volumes/datastore2/freebsd82test/freebsd82test.vmx.

Add the following lines:

remoteDisplay.vnc.enabled = "TRUE"
remoteDisplay.vnc.port = "5900"
remoteDisplay.vnc.keymap = "uk"

Assign a different port number for each VM that you want VNC access to. I start at 5900 (the standard VNC port) and increment by one for each VM.

Allow VNC access through ESXi 5.0 firewall

Create a file /etc/vmware/firewall/rfb.xml containing the following:

<ConfigRoot>
<service id='0032'>
 <id>RFB</id>
 <rule id = '0000'>
  <direction>inbound</direction>
  <protocol>tcp</protocol>
  <porttype>dst</porttype>
  <port>
   <begin>5900</begin>
   <end>5964</end>
  </port>
 </rule>
 <enabled>true</enabled>
</service>
</ConfigRoot>

This will open ports 5900-5964 for incoming TCP connections.

Incorporate it into existing ruleset with:

# esxcli network firewall refresh

To make the change persistent across reboots of the ESXi host:

# cp /etc/vmware/firewall/rfb.xml /vmfs/volumes/datastore1/rfb.xml

and add the following to the end of /etc/rc.local:

# Copy Remote Frame Buffer (vnc) firewall rule definition and enable it
cp /vmfs/volumes/datastore1/rfb.xml /etc/vmware/firewall/
esxcli network firewall refresh
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox