Watch Demo×

See NinjaOne in action!

By submitting this form, I accept NinjaOne's privacy policy.

What is a Firewall Configuration? How to Set Up Your Firewall

how to setup your firewall blog banner image

With organizations adopting cloud services from multiple providers and the digital world’s emphasis on collaboration and connectedness, information is being transmitted across networks at an unprecedented pace. Ensuring the security of data has become a prime concern. 

Firewalls play a pivotal role in network security by monitoring and controlling network traffic based on defined security rules. A firewall is the first line of defense against malicious activities, making it an indispensable component of any comprehensive network security strategy.

While having a firewall is crucial, its effectiveness is directly related to proper configuration and ongoing management. Without a well-tailored set of rules and vigilant oversight, it is all too easy for a firewall to allow malicious traffic or impede legitimate communication. This guide provides guidance on firewall configuration, outlining the process and best practices to fortify your network security.

What is firewall configuration?

Firewall configuration refers to the rules and settings that dictate how a firewall should handle incoming and outgoing network traffic. These configuration settings determine which connections are permitted and which are blocked, forming the backbone of a secure network. 

There are three key types of firewall rules:

  1. Packet filtering: Examines packets of data and allows or blocks them based on predetermined criteria.
  2. Proxy service: Acts as an intermediary between users and the internet, forwarding requests on behalf of the user and filtering responses.
  3. Stateful inspection: Keeps track of the state of active connections and makes decisions based on the context of the traffic.

These rules are configured with a source IP address, destination IP address, port permitted, and labels and notes helpful to the administrator. Other key elements of firewall rule configuration include logging and monitoring to capture information about network traffic and events for analysis and auditing, and Virtual Private Network (VPN) Support, which enables secure communication over the internet by encrypting data.

Software vs hardware firewalls and their configuration

Hardware firewall appliances and software firewalls perform similar services but do so from different positions in the network. They are suited for different network deployments, as below:

Software firewalls

  • Typically installed on individual devices.
  • Configured through user-friendly interfaces.
  • Ideal for personal use or small business environments.

Hardware firewalls

How to select the right firewall

The steps to take when selecting and commissioning a firewall are:

  • Identify network requirements: Determine the needs and characteristics of your network to tailor firewall rules accordingly.
  • Choose between software and hardware firewalls: Software firewalls are installed on individual devices, while hardware firewalls are standalone devices protecting an entire network.
  • Define rule sets: Establish rules for both inbound and outbound traffic based on security policies.

Importance of rule order and how to optimize for security and performance

A firewall processes its rulebase from top to bottom, so it is important to order rules logically to achieve the desired outcome. It is common to end a firewall rulebase with a deny-all rule, preventing any traffic not meeting any other rule from passing. Adding this rule at the start of a rulebase would block all traffic. 

Place more critical rules higher in the rulebase order to ensure they are evaluated first, and make sure to regularly review and adapt rules to meet evolving security needs, as well as remove obsolete rules to streamline performance.

Firewall configuration examples

Firewall configurations differ based on the specific needs and requirements of an organization. The security posture of an organization can change often based on the current threat level. Additionally, the command line interface as well as firewall software and any firewall management software vary from vendor to vendor. To illustrate the practical implementation of firewall configurations, we will look at two common examples using a software firewall:

Securing web servers

  1. Open firewall management console: Navigate to the firewall management console on your system. On Windows, you can access this through the Control Panel or Windows Security settings.
  2. Create a new rule for HTTP traffic: Choose the option to create a new inbound rule. Select “Port” as the rule type, and specify the port number for HTTP, typically port 80. Choose “Allow the connection” and proceed.
  3. Create a new rule for HTTPS traffic: Repeat the process to create a new inbound rule. This time, specify the port number for HTTPS, typically port 443. Choose “Allow the connection” and proceed.
  4. Block unnecessary protocols: Review the list of existing inbound and outbound rules. Identify rules related to unnecessary protocols (e.g., FTP, Telnet) and disable or delete them. Ensure that only essential rules for web traffic are active.
  5. Test web server access:  Verify that users can access the web server by browsing to the HTTP and HTTPS URLs. Ensure that attempts to access other protocols are blocked.

Remote access policies

  1. Identify remote access ports:  Determine the ports used for your remote access solution. For VPN connections, this is often port 1723 (PPTP) or port 443 (SSL VPN).
  2. Create an inbound rule for VPN traffic: Open the firewall management console. Create a new inbound rule and select “Port” as the rule type. Specify the port number identified in Step 1. Choose “Allow the connection” and proceed.
  3. Configure outbound rules for VPN traffic: Repeat the process to create outbound rules for the same port. Ensure bidirectional traffic for the chosen port is allowed.
  4. Specify IP address or range for remote access: Modify the rules to specify the source IP address or range from which remote access is permitted. This enhances security by restricting access to authorized locations.
  5. Test remote access: Verify that remote access is functional by establishing a VPN connection from an authorized device. Ensure that attempts from unauthorized devices are blocked.

These step-by-step instructions provide a basic overview for implementing firewall configurations in the specified scenarios. Specific steps might vary depending on the firewall software or hardware you are using. Always refer to the documentation provided by your firewall solution for detailed instructions tailored to your system.

Firewall rules configuration best practices

Keep the following best practices in mind for a robust and effective firewall configuration:

Control incoming traffic proactively

  • Enhance specificity: Specify the source IP addresses or ranges from which incoming traffic is expected. This adds an extra layer of security by narrowing down the allowed sources.
  • Application awareness: If your firewall supports it, consider application-aware rules instead of port-based rules. This allows you to control access based on the application layer, adding granularity to your security posture.
  • Dynamic rules: Utilize dynamic rule generation based on threat intelligence feeds. Implementing dynamic rules helps the firewall adapt to emerging threats in real-time.

Specify allowed ports and protocols

  • Default deny policy: Adopt a default deny policy for inbound traffic. Only explicitly allow traffic that is necessary for your organization’s operations. 
  • Least privilege principle: Follow the principle of least privilege when specifying allowed ports. Only open the ports that are required for specific services or applications.

Logging and monitoring

  • Enable logging for critical rules: For rules that allow important traffic, enable logging. This facilitates detailed monitoring and analysis of allowed traffic, aiding in incident response and forensic investigations.
  • Regularly review logs: Establish a routine for reviewing firewall logs. Regularly analyze inbound traffic patterns to identify anomalies or potential security incidents.

Govern outgoing traffic effectively

  • Outbound application control: Implement outbound application control to restrict access to certain applications. This prevents potential data exfiltration through unauthorized applications.
  • Destination IP filtering: Specify destination IP addresses or ranges for outbound traffic. This adds an extra layer of control, preventing data from being sent to unauthorized destinations.

Prevent unauthorized data exfiltration

  • Deep packet inspection: If your firewall supports it, enable deep packet inspection for outbound traffic. This allows the firewall to inspect the content of packets, adding an extra layer of security against data exfiltration.
  • Data Loss Prevention (DLP): Integrate DLP solutions with outbound rules to prevent sensitive data from leaving the network. DLP policies can be configured to identify and block confidential information from being transmitted.

Logging and alerting

  • Log egress traffic: Enable logging for outbound rules, especially those governing sensitive or critical traffic. This facilitates visibility into data leaving the network and aids in identifying potential security incidents.
  • Alert for unusual activity: Implement alerting mechanisms for unusual outbound activity. Set up alerts for patterns that might indicate a security incident, such as large data transfers or connections to known malicious IP addresses.

Additional considerations

  • Scheduled audits: Conduct regular audits of firewall rules to ensure alignment with organizational policies and security requirements.
  • Documentation: Keep detailed documentation of firewall rules, including the purpose of each rule and the associated security justification.
  • Cross-functional collaboration: Foster collaboration between IT and security teams in the rule-setting process. IT teams have valuable insights into operational needs, and security teams contribute risk assessment perspectives. 
  • Test rules in a controlled environment: Before deploying new rules in a production environment, test them in a controlled environment. This helps identify any unintended consequences and ensures that critical services are not disrupted.

The importance of regular updates and maintenance

Regardless of the firewall technology you choose, the boundary of your network must be protected by an up-to-date solution. Updating firmware and software per vendor recommendations ensures that the firewall is equipped with the latest security patches and addresses vulnerabilities to prevent exploitation.

It is important to regularly review and update firewall configuration to ensure your network remains protected against emerging threats, while balancing the need to permit outbound access with data exfiltration prevention.

A well-configured firewall is the guardian of your digital assets

By following best practices, understanding different configurations, and regularly managing and updating your firewall, you can create a robust perimeter defense against cyber threats.

Customize rules based on your network’s specific needs and characteristics, keep firmware, software, and rules up to date to address emerging threats, and continuously monitor firewall logs to ensure success. Baseline firewall configuration can be enhanced with additional security solution integrations. For further insights into network security, check out our blog post What is a Firewall?, which includes information on antivirus integration to advance security strategy and safeguard your digital assets.

Next Steps

The fundamentals of device security are critical to your overall security posture. NinjaOne makes it easy to patch, harden, secure, and backup all their devices centrally, remotely, and at scale.

You might also like

Ready to become an IT Ninja?

Learn how NinjaOne can help you simplify IT operations.

NinjaOne Terms & Conditions

By clicking the “I Accept” button below, you indicate your acceptance of the following legal terms as well as our Terms of Use:

  • Ownership Rights: NinjaOne owns and will continue to own all right, title, and interest in and to the script (including the copyright). NinjaOne is giving you a limited license to use the script in accordance with these legal terms.
  • Use Limitation: You may only use the script for your legitimate personal or internal business purposes, and you may not share the script with another party.
  • Republication Prohibition: Under no circumstances are you permitted to re-publish the script in any script library belonging to or under the control of any other software provider.
  • Warranty Disclaimer: The script is provided “as is” and “as available”, without warranty of any kind. NinjaOne makes no promise or guarantee that the script will be free from defects or that it will meet your specific needs or expectations.
  • Assumption of Risk: Your use of the script is at your own risk. You acknowledge that there are certain inherent risks in using the script, and you understand and assume each of those risks.
  • Waiver and Release: You will not hold NinjaOne responsible for any adverse or unintended consequences resulting from your use of the script, and you waive any legal or equitable rights or remedies you may have against NinjaOne relating to your use of the script.
  • EULA: If you are a NinjaOne customer, your use of the script is subject to the End User License Agreement applicable to you (EULA).