Firewalls are there to protect you from threats on the internet (both traffic from the internet and from local applications trying to gain access when they shouldn’t). Sometimes, though, you’ll want to allow otherwise restricted traffic through your firewall. To do so, you’ll have to open a port.

防火墙可以保护您免受Internet上的威胁(Internet上的流量和本地应用程序在不该访问时试图获得访问权限)的威胁。 但是,有时候,您可能希望允许通过防火墙的其他受限制的流量。 为此,您必须打开一个端口。

When a device connects to another device on a network (including the internet), it specifies a port number that lets the receiving device know how to handle the traffic. Where an IP address shows traffic how to get to a particular device on a network, the port number lets the receiving device know which program gets that traffic. By default, most unsolicited traffic from the internet is blocked by Windows Firewall. If you’re running something like a game server, you might need to open a port to allow that specific kind of traffic through the firewall.

当设备连接到网络(包括Internet)上的另一台设备时,它会指定一个端口号,该端口号可使接收设备知道如何处理流量。 IP地址显示流量如何到达网络上的特定设备时,端口号可让接收设备知道哪个程序获取了该流量。 默认情况下,Windows防火墙阻止来自Internet的大多数未经请求的流量。 如果您正在运行类似游戏服务器之类的设备,则可能需要打开端口以允许特定类型的流量通过防火墙。

Note: This article shows you how to open a port on a particular PC’s firewall to let traffic in. If you have a router on your network (which you likely do), you will also need to allow the same traffic through that router by forwarding the port there.


如何在Windows 10上打开端口 (How to Open a Port on Windows 10)

Clicking Start, type “Windows Firewall” into the search box, and then click on “Windows Defender Firewall.”

单击“开始”,在搜索框中键入“ Windows防火墙”,然后单击“ Windows Defender防火墙”。

Once Windows Firewall opens, click on “Advanced Settings.”


This launches Windows Defender Firewall with Advanced Security. Click the “Inbound Rules” category on the left. In the far right pane, click the “New Rule” command.

这将启动具有高级安全性的Windows Defender防火墙。 点击左侧的“入站规则”类别。 在最右边的窗格中,单击“新建规则”命令。

If you need to open a rule for outgoing traffic, instead of clicking “Inbound Rule,” you’d click “Outbound Rule.” Most apps are pretty good about creating their own outbound rules when you install them, but you might occasionally run into one that cannot.

如果您需要为传出流量打开规则,则无需单击“入站规则”,而是单击“出站规则”。 大多数应用程序在安装时都非常擅长创建自己的出站规则,但有时可能会遇到无法运行的规则。

On the Rule Type page, select the “Port” option and then click “Next.”


On the next screen, you’ll have to choose whether the port you’re opening uses the Transmission Control Protocol (TCP) or User Datagram Protocol (UDP). Unfortunately, we can’t tell you specifically which to use because different apps use different protocols. Port numbers can range from 0-65535, with ports up to 1023 being reserved for privileged services. You can find an unofficial list of (most) TCP/UDP ports on the Wikipedia page, and you can also search for the app you’re using. If you can’t determine the specific protocol to use for your app, you can create two new inbound rules—one for TCP and one for UDP.

在下一个屏幕上,您必须选择要打开的端口使用传输控制协议(TCP)还是用户数据报协议(UDP)。 不幸的是,由于不同的应用使用不同的协议,因此我们无法具体告诉您使用哪个。 端口号的范围可以是0-65535,保留最多1023个端口用于特权服务。 您可以在Wikipedia页面上找到(大多数)TCP / UDP端口的非官方列表,也可以搜索正在使用的应用程序。 如果无法确定要用于应用程序的特定协议,则可以创建两个新的入站规则-一个用于TCP,一个用于UDP。

Select the “Specific Local Ports” option and then type the port number into the field provided. If you’re opening more than one port, you can separate them by commas. If you need to open a range of ports, use a hyphen (-).

选择“特定本地端口”选项,然后在提供的字段中键入端口号。 如果要打开多个端口,则可以用逗号分隔。 如果需要打开一系列端口,请使用连字符(-)。

Click “Next” when you’re done.


On the next page, click “Allow the Connection” and then click “Next.”


Note: For this guide, we’ll be using the “Allow the Connection” option, as we trust the connection for which we’re creating a rule. If you want a little more piece of mind, the “Allow the connection if it is secure” rule uses Internet Protocol security (IPsec) to authenticate the connection. You can try that option, but many apps do not support it. If you try the more secure option and it doesn’t work, you can always come back and change to the less secure one.

注意:在本指南中,我们将使用“允许连接”选项,因为我们信任要为其创建规则的连接。 如果您需要多加注意,则“如果安全则允许连接”规则使用Internet协议安全性(IPsec)来验证连接。 您可以尝试该选项,但是许多应用程序不支持该选项。 如果尝试使用更安全的选项,但该选项不起作用,则可以随时返回并更改为较不安全的选项。

Next, choose when the rule applies and click “Next.” You can choose one or all of the following:

接下来,选择规则的适用时间,然后点击“下一步”。 您可以选择以下一项或全部:

  • Domain: When a PC is connected to a domain controller that Windows can authenticate access to the domain.


  • Private: When a PC is connected to a private network, like a home network or a network that you trust.


  • Public: When a PC is connected to an open network, like a cafe, airport, or library where anyone can join, and the security is unknown to you.


In the final window, give your new rule a name and an optional, more detailed description. Click “Finish” when you’re done.

在最后一个窗口中,为新规则命名,并提供一个可选的更详细的描述。 完成后,单击“完成”。

If you want to disable the rule at any point, locate it in the list of Inbound or Outbound Rules, right-click it, and then click “Disable Rule.”


That’s all there is to it. If you need to open any other ports for a different program or with a different rule, repeat the steps above using a different set of ports to open.

这里的所有都是它的。 如果您需要打开其他端口以使用不同的程序或使用不同的规则,请使用一组不同的端口来重复上述步骤。

翻译自: https://www.howtogeek.com/394735/how-do-i-open-a-port-on-windows-firewall/

  • 0
  • 7
  • 0


  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页
钱包余额 0