Learn how to efficiently install pfSense Firewall on Ubuntu and CentOS for network security. Our pfSense Support team is ready to assist you.

Install pfSense Firewall on Ubuntu and CentOS

pfSense is a free firewall and router system built on FreeBSD. It runs as a full operating system, giving you stronger control, security, and performance. You can install it on hardware or inside a virtual machine to filter traffic, set up VPNs, manage connections, and monitor usage through an easy web interface. Running pfSense in a VM on Ubuntu or CentOS keeps it isolated while protecting your network reliably.

Introduction to pfSense

pfSense is a free, open source firewall and router built on FreeBSD. Unlike typical applications on Ubuntu or CentOS, it runs as a full operating system, giving complete control over the machine to manage and secure network traffic effectively.


With pfSense you can turn ordinary hardware or a virtual machine into a strong network firewall. It allows you to set rules for traffic, create secure VPN connections, manage multiple internet links, provide DNS and DHCP services, and monitor how your network is being used. You can also use the pfSense Limiter to control bandwidth and prioritize traffic. All of this can be done through a clean web interface that is designed for easy management.

Install pfSense Firewall on Ubuntu and CentOS

pfSense works by sitting at the edge of your network and acting as the main gateway between the local network and the internet. Every connection is inspected and filtered, which gives you the ability to apply detailed security policies. Because of this design, pfSense needs direct control over the system and the network cards. Running it as just another program on top of Ubuntu or CentOS would reduce its performance and security.

For that reason, the correct way to use pfSense on a server running Ubuntu or CentOS is to set it up in a virtual machine. The host operating system continues to run normally, while pfSense operates in its own secure environment as a dedicated firewall. This setup gives you the stability, protection, and flexibility that users expect when they search for a dependable firewall solution, and it also allows you to easily enable UPnP in pfSense for smoother device connectivity and network management.

Core Features of pfSense Firewall

pfSense delivers powerful firewall and routing features that secure and manage networks effectively.

  • Traffic Filtering: Inspects packets by IP, port, and protocol, enforcing precise rules.
  • NAT: Translates private IPs to public ones, protecting internal networks while supporting port forwarding and one-to-one mapping.
  • VPN: Supports OpenVPN, IPsec, and L2TP for secure remote access and site-to-site links.
  • Monitoring: Offers traffic graphs, logs, alerts, and IDS/IPS integration for visibility and threat detection.

Default Configuration
Out of the box, pfSense provides a secure baseline:

  • LAN traffic to the internet is allowed.
  • Inbound WAN traffic is blocked by default.
  • Outbound NAT is enabled automatically.
  • Web interface access is available on the LAN for management.

This setup ensures safe internal browsing while preventing unsolicited external access, ready for customization.

Requirements and Preparation

Hardware and Software Prerequisites
To run pfSense on Ubuntu or CentOS hosts, you need a 64-bit processor with virtualization support, at least 1 GB of RAM, and 8–16 GB of free disk space. Two network interfaces are required so the firewall can separate WAN and LAN traffic. On the host system, install a virtualization platform such as VirtualBox, VMware, or KVM.

Need for Virtualization (VirtualBox, KVM, VMware)
pfSense is not a simple package that installs on top of Linux. It is a complete operating system based on FreeBSD. Virtualization provides a secure and isolated environment where pfSense can function as a dedicated firewall and router without interfering with the host operating system. This method also makes testing and deployment easier without additional hardware.

Downloading and Preparing the pfSense ISO
Visit the official Netgate website and download the latest pfSense Community Edition ISO for AMD64 systems. Verify the integrity of the download to ensure it is error-free. If the file comes in a compressed format, extract it to get the ISO. Finally, attach this ISO file to the virtual machine’s CD/DVD drive during setup so you can install pfSense.

Installing pfSense on a Virtual Machine

pfSense runs as its own operating system, so the correct way to use it on Ubuntu or CentOS is inside a virtual machine. You can set this up using VirtualBox, KVM, VMware, or Proxmox.

1: Create the Virtual Machine

  1. Download the pfSense ISO from the official Netgate website, choosing the AMD64 version.
  2. Create a new VM in your hypervisor and select BSD with FreeBSD 64-bit as the operating system type.
  3. Allocate resources:
    • Memory: at least 1 GB (2 GB recommended).
    • Disk space: 8 to 16 GB.
  4. Add two network adapters, one for the WAN (internet) and one for the LAN (internal network).
  5. Mount the pfSense ISO file to the VM’s virtual CD or DVD drive.
  6. Start the VM to launch the installer.

2: Install pfSense OS

  1. When the installer loads, choose Install pfSense.
  2. Select your preferred keyboard layout.
  3. For partitioning, use the recommended Auto ZFS Guided Root-on-ZFS option.
  4. Confirm and begin the installation.
  5. After installation finishes, reboot the VM and remove the ISO.

3: Initial Setup
When pfSense starts, assign the WAN and LAN interfaces using the console. Then, open a browser on a computer connected to the LAN network and log in to the pfSense web interface. From there, complete the setup wizard by configuring the network settings and creating a secure admin password.

Initial Setup and Web GUI Configuration

After installing pfSense and rebooting the virtual machine, assign the WAN and LAN interfaces. The WAN connects to your internet source, while the LAN connects to your internal network. By default, the LAN receives an internal IP so that devices in the same network can connect to the firewall.

Accessing pfSense after Installation
Connect a computer to the LAN side of the firewall and open a web browser. In the address bar, type the LAN IP address of your pfSense system. The login screen will appear, where you can sign in with the default admin credentials.

Running the Setup Wizard
On the first login, pfSense launches a setup wizard to help with the basic configuration. This wizard walks you through setting the hostname, domain, DNS servers, time zone, WAN settings, and LAN IP details. These steps prepare the firewall for secure network use.

Adjusting Admin Credentials, LAN IP, and Firewall Rules
During the setup process, update the default admin password to secure the system. You may also adjust the LAN IP address to match your existing network design. Once complete, review firewall rules. By default, pfSense blocks outside traffic on the WAN and allows LAN devices to reach the internet. You can add new rules for VPN access, port forwarding, or custom security policies as needed.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

For reliable network security, the best approach is to install pfSense Firewall on Ubuntu and CentOS in a virtual machine, giving full control, protection, and easy management through its web interface.

In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.