Configure advanced firewall in Windows 2008 using NETSH CLI
In the previous article, I introduced how to configure the advanced firewall in Windows Server 2008 using the MMC snap-in. In this article, I will show you how to configure the same Windows 2008 Server Advanced Firewall using the command line interface (CLI) using the netsh utility. There are many reasons you want to do this, let's find out .
Definition of netsh utility for firewall
In Windows 2008 Server, you see a high-end firewall for the base server. Here are some of the new features that I mentioned in the article Configuring Advanced Firewall in Windows Server 2008 using the MMC snap-in:
- New GUI interface - The MMC snap-in is available to configure the firewall.
- Bi-directional - Filters traffic in and out.
- Works better with IPSEC - The rules of firewalls and IPSec encryption configurations have been integrated together.
- Advanced Rules configuration - You can set rules for Windows Active Directory (AD) accounts, groups, and destinations for dynamic IP addresses, protocol numbers, sources, and destinations for TCP / port UDP, ICMP, IPv6, and Windows Server interfaces.
Netsh advfirewall is a command line used for the Advanced Firewall Windows 2008 Server configuration. Is CLI used for configuring Windows firewall?
While some people like to use the MMC snap-in interface to configure a firewall, others prefer to use CLI for the following reasons:
- Faster - Know how to use the netsh advfirewall commands, making access to the screen interface faster.
- Editing - You can edit the main commands with this tool.
- Working when the screen interface is not displayed - Like the CLI tool, you can use netsh advfirewall when the screen is not displayed, for example: Window Server 2008 Core.
Which command is used with netsh advfirewall?
Here are the 9 most important commands you need to know when using the netsh advfirewall command.
Help (?)
This is the most used statement. Whenever you type the command, this command will allow you to see all the options available in the corresponding command (see Figure 1).
Figure 1: The help option in netsh advfirewall
Consec command (securely connect to the required profile)
The connection information will allow you to create IPSEC VPNs between the two systems. In other words, the consec statement allows to ensure that the traffic through the firewall is limited or filtered.
This option will create a safe connection configuration as follows:
netsh advfirewall> consec
netsh advfirewall consec>
Here, if you type the command? You will see 6 different situations in netsh advfirewall consec (see Figure 2).
If typing? Here, you can change the security information with the following commands:
- Add : Added the new connection security rule
- Delete : Delete a connection security rule.
- Dump : This command does not work in this context.
- Help : Display all commands.
- Set : Set a new value for an existing rule.
Figure 2: The netsh option advfirewall consec
Show command
You use the Show command to list what the firewall will do next. There are 3 options for this command:
- Show alias will list aliases.
- Show helper lists high-level helpers.
- Show mode notifies the firewall is active or inactive.
Export
You should export all current firewall configurations to a file. This command will be very useful because you can back up all file settings and restore them when you don't like the new profiles you have created.
Firewall command
With this command you can add new internal and external rules for the firewall. This command also allows changing rules on the firewall.
Figure 3: The netsh command advfirewall firewall
In the firewall command there are four important commands:
- Add : Add firewall rules in and out.
- Delete : Delete a rule.
- Set : Set a new value for the established rules.
- Show : Displays a specified firewall rule.
The following is an example of the Add and Delete commands:
Add a rule for messenger.exe
netsh advfirewall firewall add rule name = "allow messenger"
dir = in program = "c: programfilesmessengermsmsgs.exe 'action = allow
Delete all the rules in port 21
netsh advfirewall firewall delete name rule name = all protocol = tcp localport = 21
Import
The import command allows importing firewall profiles from a file. With this command you can load into a file that you exported. For example:
netsh advfirewall import 'c: advfirewall.wfw'
Reset
This command will reset the firewall permissions back to default. Be careful with this command because as soon as you type this command it will reset the terms without asking if you agree. Here is an example:
netsh advfirewall reset
Set
The Set command changes the firewall state to various information. There are 6 types of content for this command:
Figure 4: netsh advfirewall set
- Set allprofiles : Change the setting of all profiles.
- Set currentprofile : Change the settings for the current profile.
- Set domainprofile : Change the settings for profiledomain
- Set global : The general setting of the firewall.
- Set privateprofile : Change the setting of personal information.
- Set publicprofile : Change the setting of general information.
Example command set:
- Turn off the firewall for all profiles:
netsh advfirewall set allprofiles state off - Set the default for locking connections and allow outbound connections on all profiles:
netsh advfirewall set allprofiles firewallpolicy blockinbound, allowoutbound - Enable remote management mode on all profiles:
netsh advfirewall set allprofiles settings remotemanagement enable - Login connections on all profiles:
netsh advfirewall set allprofiles logging droppedconnections enable
Show
The show command displays all the settings you have made for all other profiles.
Conclude
In this article, we identified the main commands needed to configure the Windows 2008 firewall with the netsh advfirewall command. Now you need to decide whether to use the user interface or the commands to configure the firewall. Both methods have the same options. The command line interface will not be much different from the Windows 2008 firewall when you already know the commands.
You should read it
- Instructions to enable / disable Windows Firewall with Command Prompt
- Configure wireless connection of Windows Vista from CLI with netsh wlan
- 5 reasons why you should use a firewall
- What is a firewall? Overview of Firewall
- 10 free firewall software is most worthwhile
- How to check the firewall
- How to turn on the router's built-in firewall
- Instructions allow applications to communicate with each other via Windows Firewall
May be interested
- ZoneAlarm Free Firewall 158_181_18901, download ZoneAlarm Free Firewall herezonealarm free firewall is software that provides advanced layers of protection to monitor and block unwanted traffic, protect personal data, and prevent hackers and malware from performing bad behavior with the system. .
- Install and configure email handling solutions on TMG 2010 Firewall - Part 2: E-Mail Policyin part 2 of the install and configure email handling solution on this tmg 2010 firewall, we will show you how to configure email protection policies.
- Install and configure email handling solutions on TMG 2010 Firewall - Part 5in part 5 of this series, i will show you how to configure the edge subscription feature on the tmg 2010 firewall.
- 10 ways to open the Control Panel Windows Firewall applet in Windows 11sometimes users need to configure what software is allowed through windows defender firewall with allowed application options. some users may even need to temporarily disable wdf for troubleshooting purposes.
- Configure the firewall after installing Windows XP SP2after installing windows xp service pack 2 (sp2), you will see some changes to the firewall system; and depending on the system, you may have to adjust the firewall's configuration to make it more stable.
- How to turn on and off Windows 10 firewall, Windows 10 Firewall fastestto enable or disable the firewall on windows 10, you can access the security and firewall settings in control center. this allows you to manage network access for software and services. follow the steps to toggle windows 10 firewall to adjust windows defender firewall settings, windows 10 firewall and protect your computer.
- 3 ways to turn off the Windows 10 firewall, steps to turn off the firewall on Windows 10windows firewall, also known as firewall, is responsible for ensuring the safety of your windows computer. it will filter and prevent malicious data streams from attacking the computer.
- How to Customize Windows Firewall with Windows Firewall Controlwindows' default firewall and anti-virus program should be more than enough for most people. however, there is one thing these programs lack, and that is customizability. and that's where malwarebyte's windows firewall control comes into play.
- Overview of Windows Server 2008 Firewall with advanced security featureswindows server 2003 already has a fairly basic firewall that protects your computer against external connections that you don't want them to connect to the server. this problem is very useful in protecting windows server 2003 machines, though
- How to turn firewall (Firewall) on Win 7how to turn off the firewall (firewall) on windows 7. a firewall is a software that comes with windows and it is responsible for filtering information on and off the computer. firewalls are also an advantage of windows 7 when they protect against malicious files. viruses invade their computers