PFsense - Deathraymind/HomeLab GitHub Wiki
Building a pfSense Router/Firewall on ESXi
Introduction
In this documentation, we will create a separate network for PXE booting using pfSense on an ESXi hypervisor. This modular setup allows us to control when the network is active and prevents unintended desktop PXE booting. This is the main router in our network, and we need to do a lot of configuration.
Step 2: Download pfSense
- Download the pfSense image from https://www.pfsense.org/download/.
- Click the prominent "Download" button, which will redirect you to the download page.
- Look for the "amd.iso.gz" file, click on it, and extract the ISO file from the .gz archive.
Step 3: Upload pfSense ISO to ESXi
- Open a web browser and access your ESXi hypervisor.
- Navigate to Datastore > Datastore Browser > Upload.
- Locate the pfSense ISO you extracted and double-click it to upload. Wait for the upload to complete.
Step 4: Create pfSense Virtual Machine (VM)
- In the ESXi web interface, go to Create / Register VM.
- Click Next and name the VM "pfSense."
- For the guest OS family, select Other, and for the guest OS version, choose FreeBSD (64-bit). Click Next.
- Leave storage settings as default and click Next.
- Customize the VM settings as follows:
- CPU Cores: 4
- RAM: 8GB
- Hard Disk Storage: 45GB
- Scroll down to the network adapter section. Ensure the first adapter is set to "port0."
- Click Add Network Adapter at the top, and you should see two network adapters. The top one should be set to "port0," and the second adapter should be set to "port1."
- Scroll down to CD/DVD Drive 1, select the dropdown, choose Datastore ISO file, and select your newly uploaded pfSense ISO.
- Click Next and power on the VM.
Step 5: Configure pfSense
- Start the pfSense VM and select "Multi-user mode" to let pfSense boot (this may take some time).
- Accept the terms and conditions.
- Choose "Install pfSense."
- Continue with the default keymap.
- Select "Auto ZFS" for installation.
- Choose "Install."
- For storage configuration (assuming you want to use the entire disk):
- Tab to the VMware virtual disk.
- Press the spacebar to select it.
- Confirm with "OK."
- Select "Yes" to destroy the disk and proceed with installation.
- After it's done loading, select yes to the shell.
- Type exit and reboot.
Step 7: Post-Installation Configuration
- After the pfSense installation, the machine will reboot. When prompted, you may be asked if VLANs should be set up. Type "n" and press "Enter" for no.
- Next, you'll be asked to select the WAN port. Choose "vmx0," which corresponds to Port 0 on your ESXi server. This port connects to the internet from outside your network.
- Then, select the LAN interface, which will be "vmx1." This is the port connected to the PXE switch in your topology.
- You'll be prompted to proceed; type "yes" and press "Enter."
Step 8: Configuring IP Addresses
- The default LAN IP and DHCP range is 192.168.1.1, which may conflict with your main router. To change this, type "2" to set the LAN interface's IP address.
- The WAN interface should already be configured with an IP address obtained via DHCP from your main network's router.
- When asked for the LAN IPv4 address, enter "192.168.4.1" (or any unused address in your network). This address will also be used to access pfSense's web interface.
- Choose "24" as the subnet mask, which is common and easy to work with.
- When asked to set the upstream gateway address, press "Enter" for none.
- Don't enter an IPv6 address.
Step 9: Enabling DHCP Server on LAN
- You'll reach a crucial step where it asks, "Do you want to enable the DHCP server on LAN?" Select "yes" since a PXE server requires DHCP.
- For the start address range of the DHCP server, enter "192.168.4.4."
- For the end address range, enter "192.168.4.254."
- Choose to keep HTTPS by selecting "no."
By following these steps, you have configured pfSense for your PXE server on a separate subnet. Remember that you can only access the pfSense web interface when connected to the PXE switch, as it operates on a different subnet.
Customizing pfSense with a GitHub Theme
Finding and Applying a New Theme
Step 1: Find a Theme for pfSense on GitHub
- Description: Locate a pfSense theme that you prefer on GitHub.
- Example: "Blunify Dark" theme available at Blunify Dark Theme.
Step 2: Download the Theme File
- Action: Download the
.css
file for the theme onto your local computer. - File Name:
pfSense-theme-blunify-dark.css
.
Step 3: Use SCP to Transfer the File
- Purpose: SCP (Secure Copy Protocol) is used for secure file transfer between a local host and a remote host.
- Command:
scp pfSense-theme-blunify-dark.css [email protected]:/usr/local/www/css/
Command Breakdown
scp
: Command to initiate the secure copy.pfSense-theme-blunify-dark.css
: Local path to the downloaded theme file.[email protected]
: Replaceadmin
with your pfSense username and172.16.0.1
with the IP address of your pfSense router./usr/local/www/css/
: Destination directory on the pfSense router for the theme file.
Step 4: Enable SSH on pfSense
- Requirement: Enable SSH if it's not already active on your pfSense router.
- Method: Access your pfSense console and select option 14 to enable SSH.
Step 5: Apply the Theme
- Next Steps: After transferring the file, configure pfSense to use the new theme, which may involve editing configuration files or settings within the pfSense web interface.