---
title: How to Configure the Firewall on Windows Server 2019
url: https://docs.vultr.com/how-to-configure-the-firewall-on-windows-server-2019
description: Learn how to configure the Windows Firewall on Server 2019 to enhance security. Step-by-step guide for setting up rules, profiles, and advanced settings.
publish_date: 2021-11-03T00:00:00Z
last_updated: 2024-07-25T21:12:11.193179Z
header_image: https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/95745b64089122f7.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

Windows Server 2019 contains a firewall program called Windows Defender Firewall with Advanced Security. The firewall filters incoming and outgoing traffic on your Windows Server 2019 instance to safeguard it from common network attacks. By default, the firewall is configured to allow access to all pre-installed system programs.

However, several programs may use multiple different ports for operation, and these will be automatically blocked because they don't match with the rules in your firewall configuration. In this case, you need to open the specific port on Windows Server.

## Prerequisites

* Deploy a Windows Server 2019 Instance on Vultr
* A Remote Desktop Connection App

Establish a connection to your server by logging in through any remote desktop app or click the console on your Vultr dashboard to access your server. After you connect you can start configuring your Windows server 2019 firewall rules.

## Turn Windows Firewall ON

By default, Windows Defender Firewall is turned on, but in any case, you should confirm the current status and turn on firewall. To do this, click the tools node under server manager and select Windows Defender Firewall with Advanced Security from the drop down list.

![firewall](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/31cb72bc77ef4b4f.jpg)

From the open group policy management window, check the current status of Windows Firewall profiles if it is set to **ON**; otherwise, click the Windows Defender Firewall properties option and turn the service on per profile.

![firewall console](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/77a75effb8b6ec18.jpg)

## Firewall Rules

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.

## Open an Inbound Port (Incoming connections)

Launch windows defender firewall from the tools sub-menu under server manager. Then, select Inbound Rules on the left panel of the Firewall console.

A list of current rules will be displayed. Now, on the left **Inbound Rules** sub-menu under actions, click **New Rule**.

![New rule](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/c71cb8918f237472.jpg)

Select **Port** as the rule type in the rule wizard and click **Next**.

![port rule](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/105345e8155809a5.jpg)

Now, choose whether the new rule applies to a TCP or UDP port on your server. Then, select `specific ports` and enter your target port number, you can enter a ports range, or multiple ports separated by `-` and `,` respectively, then click Next.

![Inbound Port selection](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/ae1950dee3167d30.jpg)

Define your TCP or UDP port rule.

![allow rule](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/14d5b88f5b4ce08e.jpg)

* `Allow the connection` will allow incoming connections to the specified server port
* `Allow the connection if it is secure` will authenticate with IP security and either deny or allow the connection. For example, `https` connections will be allowed and `http` blocked.
* `Block the connection` will block all incoming connections to your server through the specified port

In this case, choose `Allow the connection` to open the port.

Click **Next** to assign the new rule to one or more profiles. You can select between Domain, Private, and Public, or choose all to apply the firewall rule on multiple profiles.

Next, give your new firewall rule a custom name and description for easy identification. Then, Click finish to enable the new rule. Your new Inbound (Incoming) port rule will be enabled, and all connections to the server that match the port will be accepted.

## Open an Outbound Port (Outgoing connection)

From the Windows Defender Firewall console, click `Outbound Rules` on the left pane, and a list of available outgoing connection rules will be displayed.

Now, click `New Rule` on the right pane under the outbound rules node.

In the new outbound rule wizard, select *Port* as the rule type and click **Next**.

![Outbound port](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/6aea955034cc6cc1.jpg)

Now, let's choose whether the new rule applies to a TCP or UDP port. Then, select `specific remote ports` and enter the target server port number; you can enter a range of ports, a single port, or multiple different ports you intend to open.

![Outbound port selection](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/71dd8a862624a545.jpg)

Next, on the Action page, select **Allow the connection**, then click next to select the server profile on which the rule should be enabled.

Give the new outbound rule a name and description that uniquely describes it. Then, click `Finish` to enable the outbound rule for the target port to be open on all selected server profiles.

![Rule in Action](https://assets.vultrdevrel.com/docs-main-doc-assets-1/1060/b8ab77fd7f8df5c9.jpg)

## 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

Your Output should be similar to the one below.

    PS C:\Users\Administrator> New-NetFirewallRule  -Enabled:True  -LocalPort 21  -Protocol TCP  -Direction Inbound  -Profile Domain  -Action Allow  -DisplayName "example opening a port rule"


    Name                  : {427a1b12-ece6-4d54-847d-de482b227c6c}
    DisplayName           : example opening a port rule
    Description           :
    DisplayGroup          :
    Group                 :
    Enabled               : True
    Profile               : Domain
    Platform              : {}
    Direction             : Inbound
    Action                : Allow
    EdgeTraversalPolicy   : Block
    LooseSourceMapping    : False
    LocalOnlyMapping      : False
    Owner                 :
    PrimaryStatus         : OK
    Status                : The rule was parsed successfully from the store. (65536)
    EnforcementStatus     : NotApplicable
    PolicyStoreSource     : PersistentStore
    PolicyStoreSourceType : Local

Congratulations, you just opened a network port on your Windows Server 2019. The server will accept incoming and outgoing connections through the selected ports, but the firewall will block connections from a profile that doesn't match the port rule.
