How To Close TCP/UDP Ports In Windows 8 For Better Security

Computer network communication works using software ports. Ports are application specific end points 65,535 ports of which 1024 are pre-defined also known as well-known ports. You can learn more about computer ports through this Wiki article. Viruses and hackers use open ports in the Operating System to have illegal access to the system. The simplest way to stop hackers from connecting to your computer is to close all the opened ports. But this means that all your network communication will come to a halt.

The solution to this problems is that you should only open those ports which are needed by the running applications in your computer. For example, if you are using FTP services, you should open port 21 which is the default port for FTP services. Similarly, if you are using an SSH client, you should open port 22 for the application to communicate.

Windows 8 Firewall

A firewall is used for this very purpose, to close and open computer ports at will. A good firewall can detect inbound and outbound connections to the computer. Windows also comes with a basic firewall which is capable of controlling only inbound connections. This means that if there is a virus in the computer, it will be able to communicate with a remote server without any problems if you are using only Windows Firewall. But if you are using an antivirus like Windows Defender, you are most likely safer from outbound connection attacks.

In this article, we will discuss how to open or close the TCP/UDP ports in Windows for better security and control over your computer. This article applies to all Windows which have Windows Firewall enabled. This includes Windows XP SP2+, Windows Vista, Windows 7 and Windows 8. We will be using Windows 8 for this tutorial. So all the screenshots will be taken from Windows 8. The same steps with some visual changes can be applied to Windows 7 and earlier Operating Systems.

To open or close a port in Windows 8, follow the steps below:

  1. Go to Control Panel (Windows Key + X + P) –> System and Security –> Windows Firewall
  2. In the left hand pane, click on the “Advanced Settings” link.
  3. On the left hand pane, click on Inbound Rules. You will see a list of rules that have already been made by Windows Firewall.
  4. To create a new rule, click on “New Rule” in the right hand pane.
  5. You will need to select the type of rule that needs to be created. The options include Program, Port, Predefined and Custom. Since we are opening or closing a port, we will select the type as Port.
    New inbound rule type
  6. On the next screen, you will get an option to select the port type as TCP or UDP. Most of the times, TCP is the port type that we will need to select.
    New inbound rule protocol and ports
  7. In the next step, you will need to select whether this rule should apply to all local ports or specific ports. You can specify a port number if you want the rule to be applied on a specific port.
  8. On the next screen, you will actually make the rules. The rules include “Allow the connection”, “Allow the connection if it is secure” and “Block the connection. If you want to open the port, you will need to select the first option and if you want to close a port, you will need to select the last option.
    New inbound rule action
  9. On the next screen, you will get an option to apply the rule on specific network types like Domain, Private or Public.
  10. In the last step, just give a name to your rule and press the Finish button.

If you want to see which ports are currently open in your computer, you can use the command “netstat” from Command Prompt. This command will display all the open ports in Windows. CurrPorts is a utility which can display open ports inĀ  graphical user interface which can be better understood by the user.

I hope this tutorial will help you in configuring your Windows 7 or Windows 8 Firewall better and I’d like to thank you for reading. Any comments and suggestions are always welcome.