VMWare esxi中开放 VNC功能及端口实现远程管理 完整篇

在多个论坛上看了相关文章,总的写得不完整。现将各方资源整编写完整版。详文如下!

 

步骤1. 修改ESXi主机的firewall配置

ESXi主机的/etc/vmware/firewall目录下增加vnc的防火墙配置文件,vnc.xml,内容如下:

(忽略此行vi /etc/vmware/firewall/service.xml)

 

编辑/etc/vmware/firewall # cat  vnc.xml

<!-- FirewallRule for  VNC Console-->

<ConfigRoot>

<service>

 <id>VNC</id>

  <rule id = '0000'>

  <direction>inbound</direction>

  <protocol>tcp</protocol>

  <porttype>dst</porttype>

   <port>

 <begin>5900</begin>

   <end>5910</end>

   </port>

   </rule>

   <rule id = '0001'>

  <direction>outbound</direction>

   <protocol>tcp</protocol>

   <porttype>dst</porttype>

   <port>

    <begin>0</begin>

    <end>65535</end>

   </port>

   </rule>

  <enabled>true</enabled>

  <required>false</required>

 </service>

</ConfigRoot>

步骤2. 刷新防火墙规则

/etc/vmware/firewall# esxcli networkfirewall refresh

检查规则是否生效:

/etc/vmware/firewall# esxcli networkfirewall ruleset list | grep VNC

VNC                   true 说明 看到提示VNC ,状态true即开启

/etc/vmware/firewall#

步骤3. Vsphere Client 虚拟机配置

步骤如下:

关闭虚拟机,然后对虚拟机“编辑设置”。

鼠标右击选择 Edit settings”;

配置选择 Options 标签页;

选项在 Advanced 下选择 General”;

高级下面的常规点击 Configuration Parameters 按钮;

编辑配置参数最后加入如下配置参数:

RemoteDisplay.vnc.enabled= true

RemoteDisplay.vnc.password=<password>

RemoteDisplay.vnc.port= <port>

设置完成以后,重新启动虚拟机。

步骤4. 客户端测试

通过VNC-Viewer连接刚才的虚拟机控制台

wKiom1nZ3kOhrT6TAACifgsTo8s926.jpg

VNC Server里面输入的是ESXiIP地址,端口号为RemoteDisplay.vnc.port=<port>所配置的端口号。

wKiom1nZ3pSQqH5DAADDCswe0wQ734.jpg

这里的密码为:RemoteDisplay.vnc.password = <password>所配置的密码。

wKioL1nZ3mGjuxQ1AAMx8lSuhdY181.jpg