38 Firewalls: pfSense Part 2

Dante Rocca; Mathew J. Heath Van Horn, PhD; and Jacob Christensen

The previous chapter had you add a pfSense server and configure the Intranet side to allow some normal network traffic on the network.  This chapter specifically addresses the firewall configurations to access the outside Internet.

Overview

We will take up where we left off with the following lab configuration. Ensure you have completed the previous lab before starting this one.

gns3
Figure 1 – Final GNS3 network

Estimated time for completion: 60 minutes

Learning Objectives

  • Allow internet hosts to reach the DMZ without reaching the LAN

Prerequisites

  • pfSense Intranet

Deliverables

  • Screenshot of NAT rules
  • Screenshot of the Ubuntu Server webpage accessed from an internet host

Resources

Contributors and Testers

  • Calvin Lindemann, Cybersecurity Student, ERAU-Prescott
  • Morgan Finch, Cybersecurity Student, ERAU-Prescott
  • Sarah Davis, Cybersecurity Student, ERAU-Prescott
  • Andersen Keller Cybersecurity Student, ERAU-Prescott
  • Tyler Jane McClure, Cybersecurity Student, ERAU-Prescott

Professional Alignment

Enterprise firewalls serve as the primary security boundary between trusted internal networks and untrusted external networks. In this chapter, you will configure pfSense to regulate Internet access by implementing firewall rules that control inbound and outbound traffic while observing the effects of those rules with Wireshark. These activities reinforce the principles of perimeter security and demonstrate how firewall policies protect enterprise resources without unnecessarily restricting legitimate communications.

DCWF Work Roles

The knowledge and skills developed in this chapter align with the following Department of Defense Cyber Workforce Framework (DCWF) work roles:

  • 451 – System Security Analyst
  • 511 – Network Operations Specialist
  • 531 – Systems Administrator

NICE Work Roles

This chapter supports competencies associated with the following NICE Workforce Framework for Cybersecurity work roles:

  • Cyber Defense Infrastructure Support Specialist
  • Network Operations Specialist
  • Systems Administrator

Professional Skills

By completing this chapter, you will begin developing the ability to:

  • Configure firewall policies that regulate Internet access.
  • Apply the principle of least privilege when developing firewall rules.
  • Analyze how firewall policies affect inbound and outbound network traffic.
  • Validate firewall behavior using Wireshark packet captures.
  • Troubleshoot Internet connectivity issues related to firewall configuration.
  • Evaluate firewall rule sets to improve enterprise network security.

What You’ll Be Able to Do

After completing this chapter, you should be able to:

  • Configure pfSense firewall rules that control Internet access for enterprise hosts.
  • Verify that authorized network traffic is permitted while unauthorized traffic is blocked.
  • Capture and analyze network traffic with Wireshark to validate firewall operation.
  • Test firewall policies from internal and external network perspectives.
  • Diagnose and resolve connectivity issues caused by firewall rule configurations.
  • Explain how perimeter firewall policies protect enterprise resources while supporting legitimate business communications.

Phase I – Access the Internet

Our web server needs access to the Internet. So, we will add a rule to allow this to occur. Remember, we are going to use the ISP_Test_PC as our simulated Internet. We will allow only Webserver to access the Internet through the Firewall. We are going to introduce using Aliases in pfSense for this phase.

  1. Select Firewall->Aliases->Ports
    1. Select Add and adjust the properties of the Alias as follows
      Option Value
      Name Internet_Ports
      Description Access to the Internet
      Type Port(s)
      Port(s) Description
      443 https
      80 http
      53 DNS
      pfsense login
      Figure 25 – Opening firewall ports to the Internet
    2. Save and apply changes
  2. Select Firewall->Aliases->IP
    1. Select Add and adjust the properties of the Alias as follows
      Option Value
      Name DMZ_Internet_Enabled_Hosts
      Description Allows machines in DMZ to access the Internet
      Type Host(s)
      Host(s) Description
      20.0.0.5-20.0.0.100 DMZ network
    2. Save and apply changes
  3. Select Firewall->Rules->DMZ
    1. Select Add and adjust the properties as follows in Figure 27 below
      Option Value
      Action Pass
      Interface DMZ
      Address Family IPv4
      Protocol TCP/UDP
      Source Address or Alias  (some versions say single host or alias)
      Source Address DMZ_Internet_Enabled_Hosts              (it looks like it only takes numbers, but you can type in an alias name)
      Destination Any
      Description Allow DMZ Internet access
      Destination Port Range Value
      From (other)
      Custom Internet_Ports
      To (other)
      Custom Internet_Ports
    2. Save and apply changes

Phase II – ICMP

If you were working ahead, you might have noticed that you can’t ping from the webserver to the ISP_Test_IP.  Remember, we opened some ports, but Ping is a function of ICMP that doesn’t use ports. We need a separate Alias to allow this.

  1. Navigate back to Firewall->Rules->DMZ
    1. Add another rule below the others with the following settings:
      Option Value
      Action Pass
      Interface DMZ
      Address Family IPv4
      Protocol ICMP
      ICMP Subtypes Any
      Source DMZ net       (DMZ subnets)
      Destination Any
      Description Allow for Pings
    2. Save and apply changes
  2. Verify that you now have three firewalls in place for the DMZ network
  3. Test the communication of the network as it currently stands
    1. From the Webserver, ping the External PC
    2. From PC1, ping the webserver (it should be successful)
    3. From the External PC, ping the Webserver…

      Failure! The external PC cannot communicate with our DMZ, whether we try to ping or view the default Apache webpage. So, how are people going to be able to reach our web server?

       

Checkpoint

Phase III – Allow Inbound Access

The primary purpose of having a web server is to enable visitors from the Internet to access the information you have placed on the web server. Our internal users can reach the web service, which can be helpful, but potential Internet visitors cannot. We will make some assumptions and declare our public IP address as 192.168.122.X (replace X with whatever address DHCP assigned you) and our private web server IP address as 20.0.0.5. We need to forward traffic from the public interface to our internal machine.

  1. Open the pfsense GUI from the Management Desktop

    NOTE: As a reminder, the default username is admin, and the default password is pfsense. If you changed it when completing the previous chapter, you are on your own.

  2. Due to the way GNS3 works, we will need to allow private networks in the firewall
    1. Go to Interfaces–>ISP
    2. Scroll down this page and uncheck Block private networks and loopback addresses, and uncheck Block bogon networks

      NOTE: This isn’t something you would do on a real network. A “bogon” is jargon for a bogus network, meaning it is an IP that the IANA has not yet delegated. Both rules are set by default to prevent malicious actors who pretend to be from a non-existent network from getting traffic through the firewall. However, GNS3 uses bogons behind the scenes to manage connectivity.

    3. Save and Apply Changes
      pfsense login
      Figure 2 – Disable blocking of bogons
  3. Now, we will utilize port forwarding to allow the External PC to access the web server
    1. In pfSense, navigate to Firewall–>NAT–>Port Forward
    2. Click Add and set the following values
      Option Value
      Interface ISP
      Address Family IPv4
      Protocol TCP
      Destination ISP address
      Destination Port Range From/To Port: HTTP
      Redirect Target IP Single host: 20.0.0.5 (replace with your web server IP)   [depending on version the option might be ‘Address or Alias’]
      Redirect Target Port HTTP
      Description Allow ISP to reach DMZ
      pfsense login
      Figure 3 – Firewall rule for NAT
    3. Save and Apply Changes
  4. Check the firewall rules and notice that a new firewall rule was automatically created to pass HTTP traffic to the DMZ
    pfsense login
    Figure 4 – A new firewall rule was created
  5. Test to make sure that you can access the web server
    1. From the external PC, open Firefox and go to the address http://192.168.122.66:80 (replace with the IP address of your ISP interface on the pfSense server)
    2. You should see the web server’s webpage
      default webpage
      Figure 5 – Successful connection from external PC to webserver

      NOTE: If you are having trouble getting this to work…

      1. Double-check your IP address assignments

      2. Verify that the Apache2 service is online on the webserver

      3. Double-check that the Port Forwarding rules match Step 4 and the figure provided

      4. Double-check that pfSense accepts WAN–>DMZ HTTP traffic to pass through the firewall

Congratulations! Users from the Internet can reach your webserver!

Checkpoint

Career Connection

Perimeter firewalls are a critical component of enterprise cybersecurity. Network engineers, systems administrators, and cybersecurity professionals routinely develop, test, and refine firewall policies that regulate Internet access while protecting organizational systems from unauthorized activity. The ability to implement, validate, and troubleshoot firewall rules is an essential operational skill, helping organizations balance security, availability, and business requirements while maintaining a strong defensive posture.

End of Lab

Deliverables

2 Screenshots are needed to earn credit for this exercise:

  • Screenshot of NAT rules
  • Screenshot of the Ubuntu Server webpage accessed from the internet host

Homeworks

Assignment 1 – Merging with another organization

The CIO has come down and said we can no longer use the IP space 10.x.x.x/24 for our internal (BLUE) network, nor can we continue to use 99.x.x.x/24 for our management LAN.  Your job is to change the environment to use new IP spaces for the BLUE LAN and the MANAGEMENT LAN.

RECOMMENDED GRADING CRITERIA:

  • Screenshot of the GNS3 workspace with all devices placed and labeled (Phase II)
  • Screenshot of the pfSense services dashboard after DHCP has been set up (Phase III)
  • Screenshot of the web server successfully pinging a LAN PC and the Management PC (Phase IV)
  • Screenshot of the 3 rules for the DMZ (Phase VII)

Assignment 2 – Verify the new network space by running network scans

  • Import a Kali Linux VM into the GNS3 environment.  Use the same network settings as the other devices used in this chapter.
  • Attach a cable from the Kali machine to a switch and run nmap looking for active IP addresses and open ports. (type man nmap at the command prompt to read instructions about using nmap)
    • Screenshot of ISP switch
    • Screenshot of Management Switch
    • Screenshot of DMZ switch
    • Screenshot of LAN Switch

RECOMMENDED GRADING CRITERIA:

  • Screenshot of ISP has port 80 open
  • Screenshot of the Management has open or closed ports (it depends on what OS you are using as the management VM)
  • Screenshot of DMZ open ports
  • Screenshot of LAN open ports (if these are closed, then your bogon settings didn’t take. Try checking the settings and restarting your pfSense server. Maybe you missed the above instructions and aren’t using the correct Nmap switches.)
Feedback email
Figure 00 – Contact us via prmaster@erau.edu

License

Icon for the Creative Commons Attribution-NonCommercial 4.0 International License

Mastering Enterprise Networks (3rd Ed) Copyright © 2026 by Mathew J. Heath Van Horn is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License, except where otherwise noted.