1.下载配置文件
下载地址:vnc.xml 提取码:0000
不想下载的复制下面代码创建名为:"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. 上传文件至ESXI(推荐使用WinSCP上传)
ESXI开启安全SSH
临时修改上传至:/etc/vmware/firewall
(这里不详解)
直接SSH执行命令可临时启动VNC(重启ESXI需重新配置):
esxcli network firewall refresh
永久修改上传至ESXI系统主路径如:
/vmfs/volumes/609f0e0e-8e44629c-48ff-4cedfbca2e23
3. 配置开机启动脚本
定位至ESXI路径:/etc/rc.local.d
修改启动脚本:
local.sh
#!/bin/sh
# local configuration options
# Note: modify at your own risk! If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading. Changes are not supported unless under direction of
# VMware support.
# Note: This script will not be run when UEFI secure boot is enabled.
# 加入下面代码"609f0e0e-8e44629c-48ff-4cedfbca2e23"修改为你刚刚ESXI主目录储存文件的路径
cp -f /vmfs/volumes/609f0e0e-8e44629c-48ff-4cedfbca2e23/vnc.xml /etc/vmware/firewall/
esxcli network firewall refresh
exit 0
修改权限0775,执行一次脚本
4. 检测是否配置成功
4.1
查看/etc/vmware/firewall
路径下是否有vnc.xml
文件
4.2
SSH连接ESXI执行以下命令:
esxcli network firewall ruleset list | grep VNC
输出如图则配置成功
5. 配置虚拟机
ESXI配置文件添加参数如图例:
#添加3行参数参数
RemoteDisplay.vnc.enabled= true
RemoteDisplay.vnc.password=<password>
RemoteDisplay.vnc.port= <port>
#RemoteDisplay.vnc.password后面输入设置连接vnc的密码
#RemoteDisplay.vnc.port后面设置连接vnc的端口
保存文件重启虚拟机
6. 效果图
ESXI IP+刚刚设置的端口+刚刚设置的密码访问