How To Open Ports In Windows Firewall And Check Open Ports

This is a step-by-step guide about how to Open Ports in Windows Firewall on multiple platforms. Also learn how to check open ports on Windows, Mac, etc:

A firewall is an essential safety precaution for your system and you should never be without it. That’s the reason Windows comes with a standard firewall in place. They protect your network from incoming and outgoing threats by blocking network-enabled ports.

When a program communicates through this port, your firewall checks it with its rules database to see whether it is allowed or not. If it doesn’t know for certain, it asks you for permission to check if a certain program is allowed to access the Internet. This could be very annoying.

Also, sometimes these firewalls might interfere with certain programs. To prevent that from happening, you will need to tell your firewall to allow those programs to communicate with the network. You do this by opening a port in your firewall.

How to Open Ports in Windows Firewall

In this article, we will tell you how to open ports in Windows, Mac, and Linux and how to open TCP ports. Also, we will guide you through the process on how to check if ports are open.

How To Open Ports In Windows Firewall

Here we will take you step-by-step on how to open firewall ports on various platforms.

Windows 10 And 7

Sometimes, when you are not connecting properly to the Internet, you might face issues with certain apps and processes on Windows 10.

Firewalls can cause these connectivity issues when it is having trouble in determining whether the incoming and outgoing connections are a threat or not. To avoid this issue, open a port for both incoming and outgoing connections.

Here’s how to open a port in Windows 10.

Opening a Port for Incoming Traffic:

#1) Press Windows Key+S together.

#2) Type Windows Firewall.

#3) Click on Windows Firewall.

Windows Firewall

#4) Click on Advanced Settings.

Click on Advanced Settings

#5) Go to Inbound Rules.

Inbound Rules

#6) Go to the right-hand side pane.

#7) Select New Rule.

Select New Rule

#8) Click Port.

#9) Select Next.

Select Next

#10) Select the Type of Port TCP or UDP.

#11) Go to Specific Local Ports.

#12) Enter a Port Number.

#13) Hit Next.

Hit Next

#14) Select Allow a Connection.

#15) Click on Next.

Select Allow a Connection

#16) Select Network Type.

#17) Click Next.

Click Next

#18) Name your rule.

#19) Click on Finish.

Name your rule

Opening a Port for Outgoing Traffic

Steps for opening a port for outgoing traffic are exactly the same as opening one for the incoming traffic. All you have to do is select Outbound Rules instead of Inbound Rules. Follow the other steps exactly to the mark.

Outbound Rules

For Mac

Opening ports for Mac is easy, however, when compared to opening one in Windows, it seems a little difficult. macOS firewall, by default, is disabled. That means your machine will accept all incoming and outgoing connections. But if you have turned on the firewall, you might need to open a port to allow a connection in.

This is how you can do it:

#1) Go to the Terminal app.

the Terminal app

[image source]

#2) Type sudo pfctl -d to stop the packet filter firewall.

#3) Now enter sudo nano /etc/pf.conf.

#4) Go to the bottom of all configurations.

#5) Type ‘pass in inet proto tcp from any to any port (add port number) no state. This roughly translates to allowing incoming TCP from any machine to any other machine on that specific port number without inspection.

#6) Hold down Ctrl+X together to exit the nano.

#7) Press Y and hit Enter.

For Linux

There are three ways you can open ports in Linux.

Uncomplicated Firewall for Ubuntu:

#1) Press Ctrl+Alt+T to launch the terminal window.

#2) If Ubuntu Uncomplicated Firewall is running, you will see a status message along with a list of firewall rules and opened ports.

#3) If you see the ‘Status: inactive’ message, type ‘sudo ufw enable’.

#4) Hit Enter.

Hit Enter

[image source

#5) Type sudo ufw allow (port number) to open a specific port.

#6) If the port service is listed in https://www.fosslinux.com/41271/how-to-configure-the-ubuntu-firewall-ufw.htm/etc/services, instead of the port number, type the name of the service.

#7) To open a specific range of ports, replace the port number in the command with the port start number: the end number/tcp or udp, whichever it is.

#8) For specifying an IP address that can access a port, type sudo ufw allow from (IP address) to any port (port number)

Using ConfigServer Firewall

#1) Log in to your server.

#2) Type ‘cd /etc/csf’.

#3) Hit Enter.

#4) Type ‘vim csf.config’.

#5) Hit Enter.

#6) To add Inbound TCP, go to TCP_IN.

#7) Press i to get into typing mode on vim.

#8) Type the port number you want to open.

#9) For multiple ports, separate each port number with commas.

#10) For outbound TCP, go to TCP_OUT.

#11) Type the port numbers, separated by commas.

outbound TCP

[image source]

#12) Hit ESC.

#13) Type ‘:wq!’.

#14) Press Enter.

#15) Type ‘service csf restart’.

#16) Exit vim.

Using Advanced Policy Firewall

#1) Log in to your server

#2) Type ‘cd /etc/apf’

#3) Type ‘vim conf.apf’

#4) Press Enter

#5) To add inbound ports, go to IG_TCP_CPORTS

#6) Press i to get into typing mode on vim

#7) Type the port numbers, separated by commas

#8) To add outbound ports, go to EG_TCP_CPORTS

#9) Type the port numbers, separated by commas

Type the port numbers, separated by commas

[image source]

#10) Hit Esc.

#11) Type ‘:wq!’.

#12) Hit Enter.

#13) Type ‘service apf -r’.

#14) Press Enter.

How To Check If Ports Are Open

If you are not sure if a certain port is open, you can always check it as explained below.

In Windows

There are a few ways you can check if ports are open in Windows.

Through Windows Firewall Logs:

#1) Right-click on the start menu.

#2) Select Control Panel.

#3) Go to Administrative Tools.

#4) Click on Windows Firewall with Advanced Settings.

#5) From the right pane, select Properties.

Properties

#6) Click on an appropriate firewall profile tab (public/private/domain) or enable logging on all three of them.

Click on an appropriate firewall profile tab

#7) Go to Customize.

#8) Click on Log Dropped Packets.

#9) Select Yes.

Select Yes

#10) Note the file path.

#11) Click OK.

#12) Go to the file path.

#13) Check for port numbers that are blocked.

 Check for port numbers that are blocked

#14) If the port number you are looking for is not here, that means it is open.

Via Command Line

#1) Right-click on the start menu.

#2) Select Command Prompt (Admin).

#3) Type ‘netsh firewall show state; or Netstat -ab.

#4) Hit Enter.

Command Prompt

#5) You will get a list of all blocked and open ports.

#6) To make sure no external program is blocking the port type ‘netstat -ano | findstr -i SYN_SENT’.

#7) If you find nothing, the port is open.

By Using Apps

You can also use apps like CanYouSeeMe or SolarWinds Free Port Scanner to scan the status of your ports. Here I am using CanYouSeeMe.

#1) Go to the website.

#2) Enter your IP address or click on use current IP.

#3) Enter a Port number or select from the drop-down menu on the right side.

#4) Click Check.

Click Check

You will see which ports are open and which ones are closed.

In Mac

Follow these steps:

#1) Select Applications.

#2) Go to Utilities.

#3) Click on Network Utility.

#4) Select Port Scan.

#5) Type your IP address.

#6) Click on Scan.

Scan

[image source]

You will see the open ports.

In Linux

Here are the steps:

#1) Launch Linux terminal application.

#2) Type sudo netstat -tulpn | grep LISTEN.

Linux terminal application

[image source]

#3) Or, type sudo ss -tulpn.

#4) Or, type sudo lsof -i -P -n | grep LISTEN.

Any of these three commands can tell you which ports are open.

Frequently Asked Questions

Q #1) How do I open ports in Windows 10 firewall?

Answer: From the Control Panel, navigate to System and Security, and click on Windows Firewall. Go to the Advanced settings and right-click on Inbound Rules on the left pane.

Select New Rule, add the port and click Next. Pick the Protocol and the Port Number, click Next again. Select Allow the connection and click on Next. Pick the network type, click Next, name the rule, select Finish.

Q #2) How do I open ports in Windows Firewall 2016?

Answer: From the Start menu, go to Windows Administrative Tools and click on Windows Firewall With Advanced Security. Now click on Inbound Rules, and select New Rule.

Select the Port Radio button and click Next. Select TCP/UDP, specify the port, select either All local ports or specific local ports, enter the port number for a specific port, and click on Next. Select a Profile, click Next, name the rule, click Finish.

Q #3) Does port 445 need to be open?

Answer: TCP 445 is required for file and printer sharing. So, if you need these services, that port will need to be open.

Q #4) Should I open port 139?

Answer: If you are not using a network with NetBios, there is no need for port 139 to be open.

Q #5) How do I know if my port 445 is open?

Answer: Open the Run command and type cmd to open the command prompt. Type: “netstat –na” and hit enter. Find port 445 under the Local Address and check the State. If it says Listening, your port is open.

Conclusion

Usually, you don’t have to worry about ports, your Operating System, network hardware, and application manage them. However, it is always a good idea to keep tools handy in case anything goes wrong and you need to figure out what is causing the issue.

Opening or closing the ports or finding if a port is open or not is not a difficult task. You just have to know the right keys to push.