Windows Server 2016 Firewall Inbound & Outbound

Tech Kin 1 Reputation point

Dear Teams,
I want to deploy inbound and outbound ports configure in server 2019. First of all, I will block all inbound and outbound ports and allow the specified inbound and outbound ports.
is this possible? i will wait for advice.


Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
11,750 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Manu Philip 16,916 Reputation points MVP

    Windows Defender Firewall can help to configure the port restrictions in your windows 2019 server
    You may refer the following link to understand how carefully configure the Windows Defender Firewall for various ports

    0 comments No comments

  2. Limitless Technology 39,206 Reputation points

    Hello, @Tech Kin ,

    Windows Firewall rules allow you to either permit or block specific incoming and outgoing network packets on your server. You can choose multiple parameters for each inbound or outbound rule. A rule can consist of a TCP or UDP port, program name, service, or a protocol to filter for every server profile.

    Windows server profiles are grouped into, Domain, Private and Public. Domain represents your server's connection to a corporate domain network, Private applies to your home or workplace network connection, and Public represents non-secure public network locations.

    It should be a matter of creating an inbound port rule and outbound port rule:

    Create an Inbound Port Rule

    Create an Outbound Port Rule

    In addition:

    Open a Port through Windows PowerShell
    From the Windows start menu, open PowerShell. Then, edit the following command and replace it with your settings.

    New-NetFirewallRule -Enabled:True -LocalPort 21 -Protocol TCP -Direction Inbound -Profile Domain -Action Allow -DisplayName example opening a port rule"
    New-NetFirewallRule Creates a new Firewall rule.
    Enabled This enables the new rule, by default, it will be set to True.
    LocalPort Your target port number.
    Protocol Specifies the protocol associated with your port number.
    Direction Sets your target direction to either Inbound (Incoming) or Outbound (Outgoing).
    Profile Assigns the new rule to a server profile; you can choose domain, private, or public.
    Action defines the state for the new firewall rule, enter allow.
    DisplayName sets a custom name for the new firewall rule


    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments