通过esxcli network firewall命令配置ESXi 8.0防火墙规则的核心步骤如下:
- 查看防火墙状态:
esxcli network firewall get
- 启用/禁用全局防火墙:
esxcli network firewall set --enabled true|false
- 列出所有规则集:
esxcli network firewall ruleset list
- 允许特定服务(如SSH):
esxcli network firewall ruleset set --enabled true --ruleset-id=sshServer
- 自定义端口规则:
- 创建规则集:
esxcli network firewall ruleset add --ruleset-id=CustomRule
- 配置端口:
esxcli network firewall ruleset allowedip add --ruleset-id=CustomRule --ip-address=all
- 设置协议:
esxcli network firewall ruleset config set --ruleset-id=CustomRule --protocol=tcp --allowed-ports=8080
- 创建规则集:
- 应用配置后需重启防火墙服务:
esxcli network firewall refresh
注意:操作需root权限,建议通过SSH或Host Client操作,配置前应验证网络连通性。