Whenever a program needs to access the internet or another computer within the network, it will require access to an open network port to transfer information. For enhanced security, Windows Firewall will automatically close all the ports that are not in use at any given time. This helps prevent your computer from unauthorized access.
In other words, ports in windows operating systems are only opened whenever they are required and closed after use. While this is meant to happen automatically, there have been cases where Windows 7 has failed to open the required port(s).
This, in turn, causes related programs and processes to fail. Throughout this guide, you will learn how to scan your computer for open ports as well as how to open the closed ports in Windows 7.
If the required port is closed—usually blocked by Windows Firewall for security reasons—programs that require it will not run successfully. In such a case, ensure that the web application is running and that it is configured to the right port (which should be open).
To allow for incoming and outgoing traffic through a port, you should navigate to Windows Firewall settings and configure inbound as well as outbound rules accordingly. This guide includes the steps you need to follow to accomplish this.
TCP Vs. UDP Ports
User Datagram Protocol (UDP) and Transmission Control Protocol (TCP) are the two types of network ports available on the Windows 7 operating system (OS). As you can imagine, the two use different network protocols to facilitate a connection.
You need to understand the difference between the two as you will need to choose the right one while opening a port on Windows 7. UDP is essentially a connectionless protocol that runs on an Internet Protocol (IP). Connectionless, in this case, means that the host can send a message to another host without having to establish a connection with the recipient, as is the case with TCP.
TCP, on the other hand, TCP is a connection-oriented protocol that runs on an IP. Network systems often use the UDP protocol for broadcasting messages—sending from one sender to many recipients. DNS registration and name resolution queries are some of the common UDP packets and are sent through port 53.
How to Scan for Open Ports in Windows 7
Before you try to open a port(s) on your Windows 7 computer, you first need to ensure that there is no other service or program already using the port. To display the ports that are currently open in Windows 7, you need to execute a netstat command on a command prompt.
Here are the steps you need to follow, in this regard;
Step 1: Open Command Prompt as Administrator
To begin with, open a command prompt as administrator on your desktop. To do this, press the Windows key on the keyboard to bring up the Start menu. Type CMD into the search box at the bottom of the Start menu then press the Enter key to run the search.
On the search results, however the mouse pointer over the Command Prompt option—the first item on the list—and right-click on it. Now select ‘Run as administrator’ on the context menu that just came up. This will launch a command prompt with administrative rights on your computer.
Step 2: Run a Netstat Command on the Prompt
To find out which of the ports on your computer are currently in use, type the following into the command prompt you opened:
Now press the Enter key to run the command. The numbers that appear on the ‘Local Address’ column, just after the colon are the ports that are currently in use. The information before this colon is the IP address. The information contained in the brackets is the name of the program or process that is using the port.
UDP or TCP on the left column indicates the type of protocol being employed by the port. If you would like to view the blocked ports as well, run the following command instead:
netsh firewall show state
Running this command will display all the open as well as blocked ports on your Windows 7 computer. If Windows Firewall is not blocking the port you are interested in, check whether the router is blocking the port as well.
In this case, you should scan for any instance of external port blocking by running the following command:
netstat -ano | findstr -i SYN_SENT
If some ports are listed, they are being blocked by the router or your internet service provider (ISP). If this happens to be the case, you should just open the blocked port(s) on the router, as illustrated in Method 2 below. If no hits are listed, then no port on your computer is being blocked externally.
You could also scan for the open ports on your computer by running NetStat.exe (a Windows command-line utility). By default, the utility tool is installed in the ‘System32’ folder. Using this tool, you can view all the ports that are either open or currently in use on a specific host.
To check which ports are open (listening) on your localhost using this command-line utility, open a command prompt as administrator—as illustrated by step 1 above. Next, you need to enter the following command into the prompt and press the Enter key to run it:
netstat –an ¦find /i “listening”
Executing this command should display the port information in four columns, including the protocol type, local IP address/associated port number, and foreign IP address columns. If you would like to know which program or service is using each of the open ports, just add an ‘o’ parameter to this command, as follows:
netstat –ano ¦find /i “listening”
This introduces a gift column on the search results. This column has information regarding the application process ID (PID) associated with each of the open ports.
How to Open a Port on a Windows 7 Computer
Having confirmed that the port is not open, or blocked, you can now proceed to open it. While Windows has numerous network ports, most of them remain closed for enhanced security. A considerable number of connectivity problems on Windows 7 may be resolved by opening the right network port.
The following procedure will help you open a port on Windows Firewall:
Method 1: How to Open a Windows Firewall Port
The following steps will help you open a closed port on the Windows Firewall on your computer:
Step 1: Open Windows Firewall
Click on the Start icon to launch the Start Menu. Next, click on the Control Panel option to open it. On the Control panel window, navigate to the ‘System and Security’ category, and then select Windows Firewall.
Alternatively, you could just press the Windows key on your keyboard and then type ‘Windows firewall’ into the search box on the Start Menu. Press the Enter key on the keyboard to run the search. Finally, you need to click on the Windows Firewall link on the search results to open it.
Click on the ‘Advanced Settings’ link on the left column of the Windows Firewall window to expand its settings menu. Enter your password, if prompted to do so—enter the administrator’s password to proceed. Depending on how you intend to use the port, here are the steps you should take:
Open a Port for Incoming Traffic in Windows 7
Will the port be used exclusively for incoming communication or outgoing communication as well? If you only need a port for incoming traffic, you should select the ‘Inbound Rules’ option under the Actions pane.
Step 3: Add a New ‘Allow Rule’ on Windows Firewall
Next, select the ‘New Rule’ option to add a new allow rule for the port on Windows Firewall. This operation will launch the ‘New Inbound Rule Wizard’ window on your computer.
Step 4: Manually Add the Port to Open it
On the ‘New Inbound Rule Wizard’ window, select the ‘Port’ option, then click on the Next button at the bottom of the window. On the ‘Protocol and Parts’ screen, select the type of protocol you would like the port to use—either TCP or UDP.
Just to be safe, check your program support documentation to know which protocol to apply. After selecting the appropriate protocol, click on the Next button to proceed.
Step 5: Enter the Port Range Manually
The next screen will display the fields you need to fill in order to open a port on Windows Firewall. To begin with, you need to check the ‘Specific local ports’ option before grilling in the port details.
Now enter the port number for the port you wish to open into the box adjacent to the ‘Specific local ports’ option.
It is also possible to open multiple individual ports at the same time on Windows 7. To do this, you should just type their numbers into this box, separated by a comma. To open a range of ports, input the two ends of the range into the box separated by a dash.
For instance, typing 8830 into the box will open port 8830. Entering 8830, 8824 will open both ports 8830 and 8824. If you entered 8830-8835 instead, the system will open a range of ports from 8830 through 8835. Once you have entered the appropriate values, press the Next button to proceed.
Step 6: Allow the Connection
Clicking Next on the previous step will open the ‘Action’ screen. Here, click on the ‘Allow the connection’ option to select it. This is the selection you should go with if you trust the connection that will be using the port.
If you have some doubts regarding the connection, you should select the ‘Allow the connection if it is secure’ option.
With this option selected, the system will first authenticate the connection—using Internet Protocol security (IPsec)—before connecting.
Note: Some programs do not support the latter option, be sure to use it only where applicable. If it does not work in your case, you can always navigate back and change it.
Once you have selected the appropriate option, click on the Next button to open the Profile screen.
Step 7: Choose the Appropriate Connection Types for the Rule
Select the connection type to be allowed for the port you are opening. The available options are:
- Domain – Check this one if your computer is connected to a domain controller, and Windows can authenticate access to the said domain.
- Private – Check this option if your PC is connected to a private network, such as a home network or any other network you can trust.
- Public – this is the connection type to choose if you are connected to an open network, such as Wi-Fi at the café, librar, or airport.
If you wish for the port to remain open at all times or are not sure of the type of connection you are using, it is advisable to check all three options. Once you are done, click Next to proceed.
Step 8: Save the New Rule
Finally, you need to name and save the rule you just created to open the associated network port(s). Type a unique name for the rule into the Name field, such as FHMRport. You may then add a few details into the Description field to describe the rule further.
However, this is optional—the Name is just enough to save the new rule and open a port.
Having entered the appropriate details, click on the Finish button. This operation will save the new rule, open the port(s) and close the window. At this point, the new port should be open and ready to use exclusively for incoming traffic.
Open a Port for Outgoing Traffic in Windows 7
If you would rather open a port that allows for outgoing traffic, open the Windows Firewall Advanced settings, as described in steps 1 and 2 above. Next, select the ‘Outbound Rules’ option from the Actions pane on the left-hand side.
This will launch the ‘New Outbound Rule Wizard’ window showing the ‘Rule Type’ screen. Now repeat steps 3 to 8 to create a new rule on your Firewall and open a port.
Services like FTP and Web pages require the associated ports to be open on your server in order to be publicly available. A closed port in Windows 7 will reject connections or just ignore the packets directed at it. This will, in turn, cause the associated program or process to fail.
To facilitate such connections, you may need to open the right port(s) manually. From the Windows Firewall advanced settings, you can open any port for incoming, and or outgoing traffic. With this guide, you can configure any TCP or UDP port on Windows 7 to accept packets.