【问题标题】:How can i change default port 80 and 443 in esxi host 6.7?如何更改 esxi 主机 6.7 中的默认端口 80 和 443?
【发布时间】:2019-04-23 08:03:06
【问题描述】:

我正在免费运行 esxi 6.7。

我想通过我的路由器将我的 esxi 暴露在互联网上。但我想更改默认端口为 80 和 443。

我发现许多可用于 esxi 5.0 和 6.0 的教程/知识库,但这些都不起作用。

在这些教程中,有防火墙和反向代理的部分,但无论我做什么,都没有工作,主要是当我重新启动防火墙时。

【问题讨论】:

    标签: port esxi


    【解决方案1】:

    我想它已经解决了,但对其他人来说......

    如何在 ESXi 6.7 主机视频上通过 ssh 更改端口 -> https://www.youtube.com/watch?v=a7kuwmLuwvU 或者在可能的情况下在路由器端口中设置从 443 重定向到所需端口。

    编辑: 对于他们喜欢阅读的人:-)

    1. enable ssh on esxi host
    2. connect via ssh or press alt + f1 on esxi host
    3. edit this file by command vi /etc/vmware/rhttpproxy/config.xml
    4. find text https by command :/https
    <!-- HTTPS port to be used by the reverse proxy -->
    <httpsPort>443</httpsPort>
    5. change port to eg. 9443 
    (press insert before editing and after finished press esc save it by :wq)
    6. reboot needed by command reboot
    7. after reboot connect to ssh and create new file changedport.xml by command 
    vi /etc/vmware/firewall/changedport.xml
    8. copy this text to console.
    <ConfigRoot>
      <service>
        <id>changedport</id>
        <rule id='0000'>
          <direction>inbound</direction>
          <protocol>tcp</protocol>
          <porttype>dst</porttype>
          <port>9443</port>
        </rule>
        <enabled>true</enabled>
        <required>false</required>
      </service>
    </ConfigRoot>
    9. save it by :wq
    10. refresh firewall rules by command esxcli network firewall refresh
    

    这不是一个永久的解决方案。 重启后需要重新添加防火墙规则 并执行命令 esxcli network firewall refresh

    【讨论】:

    • 你能简单描述一下如何做而不是仅仅发布一个 YouTube 链接吗?
    【解决方案2】:

    感谢您的帮助。

    正如你所描述的,这不是一个永久的解决方案。

    要使其永久化,您需要执行相同操作,但将其保存在 VIB 文件中,如下所述:

    https://www.altaro.com/vmware/how-to-create-persistent-firewall-rules-on-esxi/#comment-18186

    按照本指南,我创建了自己的自定义 vib,允许端口 444

    你可以在这里下载:https://multifilemirror.com/hik1l28cf6du/firewall444.vib.html

    此 VIB 文件是一个简单的存档,因此您可以多次解压它以查看其中的 xml 文件以验证它只是这个并且没有其他恶意附加设置。

    只需将 VIB 文件上传到 ESXI 服务器并运行“esxcli software vib install”命令即可使用 SSH 安装它

    【讨论】:

      【解决方案3】:

      步骤:

      1. 编辑“/etc/vmware/rhttpproxy/config.xml”(&lt;httpsPort&gt;443&lt;/httpsPort&gt;&lt;httpsPort&gt;4444&lt;/httpsPort&gt;

      2. 运行命令“/etc/init.d/rhttpproxy restart”

      3. 创建新文件“/etc/vmware/firewall/changes.xml”

      4. 将此文本复制到文件中:

      <ConfigRoot>
          <service>
              <id>changedport</id>
              <rule id='0000'>
                  <direction>inbound</direction>
                  <protocol>tcp</protocol>
                  <porttype>dst</porttype>
                  <port>4444</port>
              </rule>
              <enabled>true</enabled>
              <required>false</required>
          </service>
      </ConfigRoot>
      
      1. 运行命令“/sbin/esxcli network firewall refresh”

      2. 将上述文件复制到 /vmfs/volumes/xxxxxxx-80925220-52bf-b8ac6f41950b/changes.xml

      3. 将以下代码添加到“/etc/rc.local.d/local.sh”以在重启后工作:

      /sbin/cp /vmfs/volumes/xxxxxxx-80925220-52bf-b8ac6f41950b/changes.xml/ etc/vmware/firewall/
      
      /sbin/esxcli network firewall refresh
      
      exit 0
      

      完成。

      【讨论】:

        猜你喜欢
        • 2019-08-21
        • 1970-01-01
        • 2015-06-21
        • 1970-01-01
        • 2017-06-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多