For services such as game or web servers to be reachable from the outside, you have to open the required ports in the Windows Firewall. This guide shows you both ways – via the graphical interface and via PowerShell.
Via the graphical interface
-
Open the firewall
PressWindows + R, typewf.mscand confirm withEnter. The Windows Defender Firewall with Advanced Security opens. -
Create a new inbound rule
Click Inbound Rules on the left and then New Rule… on the right. -
Choose the rule type
Select Port and click Next. -
Specify protocol and port
Select TCP or UDP and enter the desired port under Specific local ports (e.g.25565). Click Next. -
Allow the connection
Select Allow the connection and click Next. -
Select the profiles
Leave all profiles (Domain, Private, Public) enabled and click Next. -
Name the rule
Give it a meaningful name (e.g.Minecraft Server) and click Finish.
Via PowerShell
Alternatively, you can open a port directly via PowerShell – which is often faster.
-
Open PowerShell as administrator
Right-click the Start menu and select Windows PowerShell (Admin) or Terminal (Admin). -
Create the rule
Run the following command and adjust the name, port and protocol:New-NetFirewallRule -DisplayName "Minecraft Server" -Direction Inbound -LocalPort 25565 -Protocol TCP -Action AllowFor a UDP port, replace
TCPwithUDP.