cd /etc/vmware/firewall

chmod 777 service.xml  修改service.xml的属性,否则无法修改该文件

chmod +t service.xml


vi service.xml

<service id='0099'>

    <id>AAAA</id>

    <rule id='0000'>

      <direction>inbound</direction>

      <protocol>tcp</protocol>

      <porttype>dst</porttype>

      <port>5555</port>

    </rule>

    <rule id='0001' >

      <direction>outbound</direction>

      <protocol>tcp</protocol>

      <porttype>src</porttype>

      <port>5555</port>

    </rule>

    <enabled>true</enabled>

    <required>false</required>

  </service>


chmod 444 service.xml  修改完之后要将该文件的属性修改回来

esxcli network firewall refresh  刷新一下防火墙设置

esxcli network firewall ruleset rule list | grep AAAA  验证自定义服务AAAA是否生效,也可在vSphere client中查看