1. Open the Windows Firewall app in Windows 10
Press the Start button and type “Windows Defender Firewall”. Click the top result to open it.
2. Open advanced iFrewall settings
In the left side-bar of the Firewall, click the “Advanced settings” header and press “Yes” to any admin prompts.
3. Click ‘Inbound Rules’ in the sidebar
4. Press ‘New Rule…’ in the right sidebar
Adding this Windows Firewall Rule will let us control the traffic it does and doesn’t let through.
5 Select the ‘Port’ rule type and press ‘Next’
6. Choose your protocol
There are two choices when it comes to Windows 10 ports – TCP and UDP. We won’t dive into the differences between the two, as the software you’re using probably has a list of the exact ports you need to open and which protocols. Press “Next”.
7. Enter the Windows 10 ports you want to open or close
Now that you’ve selected your protocol, turn your eye to the “Does this rule apply to all local ports or specific local ports” heading. Check “Specific local ports” and enter the Windows 10 ports you want to open or block.
You can seperate different ports by a comma, or add a “-” between two numbers to add a range of ports to your Windows firewall rule. Press “Next”.
8. How to open or close a port in Windows 10 Firewall
Now we get to the exiciting part. On the “Action” screen, we can choose what we want the the Windows Firewall rule to do. To let Firewall allow a port, check “Allow the connection”. Alternatively, block a port by checking “Block the connection”. Click “Next”.
9. Choose where the Firewall rule applies
A firewall rule is not network specific, so it may apply outside of your home network. This is important, as there are situations where you might want to keep certain ports closed, such as in a coffee shop or hotel.
Tick “Domain” to apply the rule at work, “Private” at home, and “Public” for shared networks. You may want to check what type your current network is by running the Get-NetConnectionProfile
command in PowerShell. Click “Next” when you’re done.
10. Give your Firewall rule a name
Make sure you’re descriptive with this so you can find it later. In the description, you may want to enter why you opened the port. Press “Finish”.
Reference: https://winbuzzer.com/2021/03/31/how-to-open-or-close-a-port-in-windows-10-firewall-xcxwbt/