Firewalls protect you from Internet threats (both Internet traffic and local applications trying to gain access if they are not). In some cases, you may want to allow restricted traffic through your firewall. You must open a port to do this.
When a device connects to another device on a network, including the Internet, it specifies a port number that allows the receiving device to know how to handle the traffic. When an IP address indicates traffic on how to reach a particular device on a network, the port number informs the receiving device which program receives that traffic. Most unwanted traffic from the Internet is blocked by the Windows Firewall by default. If you have something like a game server, you might need to open a port to allow that particular type of traffic through the firewall.
Note: This article describes how to open a port on the firewall of a particular PC. If you have a router on your network (which you are likely to do), you must allow the same traffic through this router by: Forward the port there.
Opening a Port on Windows 1
Click Start, type "Windows Firewall" in the search box, and then click "Windows Defender Firewall."
After opening Windows Firewall, click Advanced Settings.
This starts the Windows Defender Firewall with enhanced security. Click on the category "Incoming Rules" on the left. In the far right pane, click the New Rule command.
If you need to open an outbound rule instead of clicking Inbound Rule, click Outbound Rule. "Most apps are pretty good at making their own outgoing rules when you install them, but occasionally you come across one that's not possible.
On the" Rule Type "page, select select "Port" and then click "Next."
On the next screen, you must select whether the port you want to open will be the Transmission Control Protocol (TCP) or the User Datagram Protocol (UDP) Unfortunately, we can not tell you exactly what to use because different apps use different protocols, port numbers can range from 0 to 65535, with ports reserved for privileged services up to 1023. See the Wikipedia page an unofficial list of (most) TCP / UDP ports, and you can search for the app you are using, if you can not determine the protocol to use for your app, you can use two n Create new rules – one for TCP and one for UDP.
Select the "Specific local ports" option and enter the port number provided in the protocol box. If you open more than one port, you can separate them with commas. If you need to open a range of ports, use a hyphen (-).
Click "Next" when done.
On the next page, click "Allow the Connection." Then click Next".
Note: For this tutorial, we use the "Allow the Connection" option because we trust the connection for which we are creating a rule. If you want to think more deeply, the "Allow connection if it is secure" rule uses Internet Protocol Security (IPsec) to authenticate the connection. You can try this option, but many apps do not support it. If you try the safer option and do not work, you can always switch to the less secure one.
Next, choose when the rule applies and click Next. You can select one or all options the following:
- Domain: If a PC is connected to a domain controller, Windows can authenticate access to the domain.
- Private: When a PC is connected to a private network, such as a home network, or a network that you trust.
- Public: When a PC is connected to an open network, such as a café, airport or library, where anyone can participate and security is unknown to you.
RELATED: What is the difference between private and public networks in Windows?
Give your last rule a new 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 Inbound or Outbound Rules list, right-click it, and then click Disable Rule. 
That's all that goes with it. If you need to open other ports for another program or rule, repeat the steps above and use other ports to open.
RELATED: Creating advanced firewall rules in the Windows Firewall