To open a port in the Windows 11 firewall, you need to select a graphical interface or command line method according to the usage scenario: 1. When using the graphical interface, open Windows Defender Firewall, enter advanced settings, create inbound rules, select the port type (TCP/UDP), enter the port number, allow connections, select applicable network profiles and name rules; 2. When using the command line, you can run the netsh command through the CMD with administrator privileges or run the New-NetFirewallRule command to add rules; 3. Verify whether the port is open, you can use telnet, Get-NetTCPConnection or external tools to detect. After the operation is completed, only the necessary ports should be retained to ensure security.
Opening ports in Windows 11 firewall is useful when you're running a server, using remote desktop, hosting a game, or running certain apps that need specific network access. Here's how to do it properly using the built-in Windows Defender Firewall.

1. Open a Port Using Windows Defender Firewall (GUI Method)
This is the easiest way if you're not comfortable with command-line tools.
Steps:
- Press
Windows S
, type "Firewall" , and select "Windows Defender Firewall" . - Click on "Advanced settings" on the left (you'll need admin rights).
- In the new window, right-click "Inbound Rules" and choose "New Rule..." .
- Select "Port" → Click Next .
- Choose TCP or UDP (or both if needed), then enter the specific port(s):
- Example:
3389
for Remote Desktop,80
for HTTP,3000
for dev servers. - You can enter a single port (
3000
) or a range (3000-3010
).
- Example:
- Click Next .
- Select "Allow the connection" → Next .
- Choose when the rule applies (Domain, Private, Public) — usually check all unless you have security concerns.
- Click Next , then give the rule a name (eg, "Open Port 3000 for Node.js").
- Optionally add a description, then click Finish .
? Tip: For better security, only enable the rule on Private networks unless you need external access.
![]()
2. Open a Port Using Command Line (netsh or PowerShell)
Use this method for automation or scripting.
Using netsh
(Legacy but still works):
Open Command Prompt as Administrator and run:

netsh advfirewall firewall add rule name="Open Port 3000" dir=in action=allow protocol=TCP localport=3000
Replace 3000
with your desired port and TCP
with UDP
if needed.
Using PowerShell (Recommended):
Run PowerShell as Administrator:
New-NetFirewallRule -DisplayName "Open Port 8080" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow
You can also restrict the rule further:
New-NetFirewallRule -DisplayName "Allow TCP 3389 Private Only" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow -Profile Private
3. Verify the Port Is Open
After opening the port, test it:
- Use
telnet
(if enabled):telnet your-ip-address 3000
- Or use PowerShell to check listening ports:
Get-NetTCPConnection -LocalPort 3000
- From another device, use tools like
nmap
or online port checkers to verify external accessibility.
?? Note: Opening ports can be a security risk. Only open what you need, and consider using a router/firewall for public exposure.
Final Notes
- Always run tools as Administrator when modifying firewall rules.
- If the app still can't connect, check your router's port forwarding and antivirus software , which might have its own firewall.
- Close unused ports later with:
Remove-NetFirewallRule -DisplayName "Open Port 3000"
Basically, just pick the method you're comfortable with — GUI for one-offs, PowerShell for automation.
The above is the detailed content of How to open ports in Windows 11 firewall. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The problem of slow booting can be solved by the following methods: 1. Check and disable unnecessary booting programs; 2. Turn off the quick boot function; 3. Update the driver and check disk health; 4. Adjust the number of processor cores (only for advanced users). For Windows 11 systems, first, the default self-start software such as QQ and WeChat are disabled through the task manager to improve the startup speed; if you use dual systems or old hardware, you can enter the power option to turn off the quick boot function; second, use the device manager to update the driver and run the chkdsk command to fix disk errors, and it is recommended to replace the mechanical hard disk with SSD; for multi-core CPU users, the kernel parameters can be adjusted through bcdedit and msconfig to optimize the startup efficiency. Most cases can be corrected by basic investigation

If you're having trouble reading your desktop icons' text or simply want to personalize your desktop look, you may be looking for a way to change the font color on desktop icons in Windows 11. Unfortunately, Windows 11 doesn't offer an easy built-in

Fixed Windows 11 Google Chrome not opening Google Chrome is the most popular browser right now, but even it sometimes requires help to open on Windows. Then follow the on-screen instructions to complete the process. After completing the above steps, launch Google Chrome again to see if it works properly now. 5. Delete Chrome User Profile If you are still having problems, it may be time to delete Chrome User Profile. This will delete all your personal information, so be sure to back up all relevant data. Typically, you delete the Chrome user profile through the browser itself. But given that you can't open it, here's another way: Turn on Windo

When Windows cannot detect a second monitor, first check whether the physical connection is normal, including power supply, cable plug-in and interface compatibility, and try to replace the cable or adapter; secondly, update or reinstall the graphics card driver through the Device Manager, and roll back the driver version if necessary; then manually click "Detection" in the display settings to identify the monitor to confirm whether it is correctly identified by the system; finally check whether the monitor input source is switched to the corresponding interface, and confirm whether the graphics card output port connected to the cable is correct. Following the above steps to check in turn, most dual-screen recognition problems can usually be solved.

Have problems uploading files in Google Chrome? This may be annoying, right? Whether you are attaching documents to emails, sharing images on social media, or submitting important files for work or school, a smooth file upload process is crucial. So, it can be frustrating if your file uploads continue to fail in Chrome on Windows PC. If you're not ready to give up your favorite browser, here are some tips for fixes that can't upload files on Windows Google Chrome 1. Start with Universal Repair Before we learn about any advanced troubleshooting tips, it's best to try some of the basic solutions mentioned below. Troubleshooting Internet connection issues: Internet connection

Mini PCs have undergone

Microsoft's latest Windows updates can generally be installed safely, but they need to be judged based on the update type and usage scenario. Ordinary users can update their daily office work, video watching, etc. directly; professional software or game users should be cautious. Regular quality updates (such as the monthly "Tuesday Patch") have low risks, so it is recommended to install them in time; updates to functions (such as large version upgrades) may cause compatibility issues. It is recommended to back up data, confirm software and hardware support, and check community feedback before installing. Overall, quality updates are safe and reliable, and functional updates are suitable for optional installation after observation.
