操作步骤(以 443 → 8443 为例)
准备工作
开启 TSM-SSH:ESXi Shell 或 vSphere Client 启用,备份 /etc/vmware/rhttpproxy/config.xml 到数据存储。
检查端口:esxcli network ip connection list | grep :8443;无占用再继续。
记录当前防火墙状态:esxcli network firewall get。
编辑配置文件
ssh root@ESXi_IP,执行 vi /etc/vmware/rhttpproxy/config.xml。
找到 80 与 443,改为 8080 与 8443。
按 Esc,输入 :wq 保存退出。
开放防火墙(持久化)
在数据存储创建 custom_web_port.xml,内容如下:
custom_web_port
inbound
tcp
dst
8443
true
false
复制到防火墙目录:cp /vmfs/volumes/ 你的数据存储 /custom_web_port.xml/etc/vmware/firewall/。
刷新规则:esxcli network firewall refresh;验证:esxcli network firewall ruleset list | grep custom_web_port。
重启服务并验证
重启 rhttpproxy:/etc/init.d/rhttpproxy restart。
验证监听:esxcli network ip connection list | grep :8443。
访问测试:https://ESXi_IP:8443;vSphere Client 连接时需指定端口。
防止重启失效
编辑 /etc/rc.local.d/local.sh,在 exit 0 前添加:
cp /vmfs/volumes/ 你的数据存储 /custom_web_port.xml/etc/vmware/firewall/
esxcli network firewall refresh
保存后执行 chmod +x /etc/rc.local.d/local.sh。
暂无评论