Allow Ports on Windows Firewall

Using CMD (Command Prompt / PowerShell)

netsh advfirewall firewall add rule name="Allow Port XYZ" dir=in action=allow protocol=TCP localport=PORT_NUMBER

# To allow port 8080 for TCP:
netsh advfirewall firewall add rule name="Allow TCP 8080" dir=in action=allow protocol=TCP localport=8080

# To allow port 53 for UDP:
netsh advfirewall firewall add rule name="Allow UDP 53" dir=in action=allow protocol=UDP localport=53

# To delete the rule:
netsh advfirewall firewall delete rule name="Allow TCP 8080"

Using GUI (Graphical User Interface)

  • Press Win + R, type wf.msc, and press Enter (opens Windows Defender Firewall with Advanced Security).

  • In the left pane, click on Inbound Rules.

  • In the right pane, click New Rule...

  • In the New Inbound Rule Wizard:

    • Select "Port" → Click Next

    • Choose TCP or UDP

    • Enter the specific port number (e.g., 8080) → Click Next

    • Choose "Allow the connection" → Click Next

    • Select where this rule applies (Domain, Private, Public) → Click Next

    • Give the rule a name (e.g., "Allow TCP 8080") → Click Finish

Notes:

Last updated

Was this helpful?