如何在您的VPS上打开Windows防火墙端口

列印
  • 0

Windows防火墙控制哪些入站连接被允许进入您的Windows VPS。如果您安装了游戏服务器、Web服务、数据库或远程工具,您可能需要先允许其端口,以便玩家或用户可以连接。

仅打开您的软件实际需要的端口。打开额外的端口会增加可以到达VPS的流量。

 

使用PowerShell打开端口

  1. 使用远程桌面或VPS控制台连接到Windows VPS。
  2. 以管理员身份打开PowerShell。

    Windows VPS with PowerShell open

  3. 运行类似这样的命令,将7777替换为您需要的端口:
New-NetFirewallRule -DisplayName "Allow TCP 7777" -Direction Inbound -Protocol TCP -LocalPort 7777 -Action Allow

对于UDP端口,将-Protocol TCP更改为-Protocol UDP:

New-NetFirewallRule -DisplayName "Allow UDP 7777" -Direction Inbound -Protocol UDP -LocalPort 7777 -Action Allow

某些游戏服务器需要多个端口。为每个端口/协议添加一个规则,或者如果相同协议适用于所有端口,则使用逗号分隔的列表:

New-NetFirewallRule -DisplayName "Allow Game Ports" -Direction Inbound -Protocol UDP -LocalPort 7777,7778,27015 -Action Allow

 

检查端口

启动监听该端口的软件,然后从VPS外部进行测试。仅有防火墙规则并不能使端口响应;服务也必须在该端口上运行并监听。

如果您的VPS还应用了面板防火墙计划,请确保面板防火墙也允许相同的端口。Windows防火墙和面板级防火墙规则都可能影响访问。


這篇文章有幫助嗎?

相關文章

« 返回

Follow us on Social Media

Stay in the loop! Follow our social media accounts and stay up-to-date with the latest news, announcements, tips & tricks and behind-the-scenes insights!