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
best-practices-configuring
Windows Server 2016 Firewall Inbound & Outbound
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.
Thanks
2 answers
Sort by: Most helpful
-
Manu Philip 17,671 Reputation points MVP
2021-12-08T18:37:42.593+00:00 -
Limitless Technology 39,511 Reputation points
2022-01-06T09:28:49.6+00:00 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
https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-firewall/create-an-inbound-port-ruleCreate an Outbound Port Rule
https://learn.microsoft.com/en-us/windows/security/threat-protection/windows-firewall/create-an-outbound-port-ruleIn 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--