Homelab · Part 14

Homelab Build — Part 14 — Remote Access: Adding a VPN via pfSense (WireGuard & OpenVPN)

Secure external access into your homelab by deploying a high-performance WireGuard split-tunnel gateway alongside an OpenVPN SSL fallback on your pfSense virtual router, complete with dynamic DNS and strict firewall zone controls.

By K Shankar R Karanth Homelab Hands-On Series Part 14
Quick idea: Never expose administrative consoles like Proxmox VE, RDP, or SSH directly to the internet via port forwards; terminating an authenticated, encrypted VPN tunnel at your pfSense edge router ensures outside traffic is cryptographically verified before touching a single internal IP.
WireGuard Daily Driver

Kernel-level cryptographic routing, instant roaming handshakes, and negligible battery drain for mobile laptops and phones.

OpenVPN SSL Fallback

TCP port 443 capability to punch through restrictive airport, hotel, and cellular carrier firewalls that drop UDP packets.

Split-Tunnel Precision

Routes only your internal 10.10.0.0/16 lab traffic across the tunnel, leaving consumer streaming and everyday web traffic local.

Why Remote Access Must Terminate at the Firewall

In Part 12 of our Homelab Build series, we documented the full topology of our lab, spanning pfSense routing, Windows Server 2025 domain controllers, enterprise certificate authorities, and monitoring agents. Up to this point, however, managing this infrastructure has required sitting physically in front of a member workstation on the internal LAN or connecting to local Wi-Fi.

The temptation for many engineers when they first need remote management is to create simple port-forwarding NAT rules on their router: mapping public port 8006 to Proxmox VE, port 3389 to a jump box, or port 22 to an administrative Linux VM. In modern infrastructure operations, this is unacceptable. Automated internet scanners like Shodan and Censys index newly opened management ports within minutes. Exposing web GUIs or remote desktop protocols to the public internet invites constant brute-force credential stuffing, unpatched zero-day exploits, and denial-of-service attempts.

Think of remote access into your homelab like visiting a high-security research facility. Port-forwarding is the equivalent of cutting private exterior doorways directly into the server room, the records vault, and the executive office, leaving each locked with a standard domestic key. If an intruder picks or kicks in any one door, they are instantly inside your most sensitive workspace. Terminating a VPN at pfSense is building a single, reinforced security gatehouse at the outer fence. Visitors must present unforgeable cryptographic credentials at the gatehouse before they are granted access, and even then, internal security checkpoints determine exactly which corridors they are permitted to walk.

By terminating your remote access tunnels directly on pfSense, you ensure that unauthenticated internet packets are dropped silently at the firewall boundary without ever reaching internal hypervisors or domain controllers.

Security rule: A homelab edge router should have zero open inbound TCP ports for administrative services. The only ports permitted on your WAN interface should be the single UDP listening port for WireGuard and the fallback port for OpenVPN.

WireGuard vs OpenVPN: A Practical Comparison

When implementing remote access on pfSense, engineers frequently debate whether to choose WireGuard or OpenVPN. Rather than treating them as mutually exclusive competitors, enterprise homelabs benefit from deploying both in a tiered hybrid architecture:

Feature WireGuard OpenVPN
Architecture In-kernel module, minimal codebase (~4,000 lines) User-space daemon (tun/tap), complex codebase (~100,000+ lines)
Cryptography Fixed modern primitives: ChaCha20-Poly1305, Curve25519, BLAKE2s Modular SSL/TLS (OpenSSL), negotiable ciphers (AES-GCM, SHA)
Throughput & Latency Near line-rate gigabit throughput; minimal CPU overhead Higher CPU consumption; context switches between user and kernel space
Connection State Stateless, silent when idle, instant roaming across Wi-Fi/cellular Stateful TLS handshake, explicit ping keepalives, reconnect timeouts
Port Flexibility UDP only (typically port 51820) UDP or TCP on any port (can run over TCP 443 to mimic HTTPS)
Homelab Role Primary Daily Driver for laptops, tablets, and phones Emergency Fallback for restrictive captive networks

WireGuard is our primary daily driver. Its lean cryptographic handshake connects within milliseconds, handles roaming seamlessly when your phone shifts from 5G to public Wi-Fi, and does not drain mobile battery because it transmits zero packets when idle. Furthermore, WireGuard is completely silent: if an unauthorized IP sends UDP packets to your WireGuard port, pfSense returns zero response, making the port appear completely closed to port scanners.

OpenVPN serves as our indispensable fallback. Because WireGuard operates strictly over UDP, restrictive network environments—such as hotel Wi-Fi, conference halls, corporate guest networks, and international airports—frequently block all non-standard outbound UDP traffic. OpenVPN can be configured to listen on TCP port 443, effectively disguising VPN traffic as standard HTTPS web browsing and punching through the most aggressive egress firewalls.

Subnet Design and Split-Tunnel Routing

In Part 3 of our series, we established an organized IP addressing scheme across dedicated VLANs. To integrate remote access cleanly, we allocate two dedicated, non-overlapping /24 subnets for our VPN clients:

Subnet CIDR Zone / Interface Gateway / Server IP Purpose
10.10.1.0/24 LAN (VLAN 1) 10.10.1.1 Hypervisor & Out-of-Band Management (pve01, switches, PDUs)
10.10.10.0/24 Servers (VLAN 10) 10.10.10.1 Core Infrastructure VMs (DC01: 10.10.10.10, DC02: 10.10.10.11, CA01)
10.10.20.0/24 Clients (VLAN 20) 10.10.20.1 Internal lab workstations and test virtual machines
10.10.99.0/24 DMZ (VLAN 99) 10.10.99.1 Isolated edge services, web proxies, and guest appliances
10.10.50.0/24 WireGuard Tunnel 10.10.50.1 Dedicated tunnel pool for mobile WireGuard peers
10.10.51.0/24 OpenVPN Tunnel 10.10.51.1 Dedicated dynamic address pool for OpenVPN road warriors

For administrative remote access, we implement split-tunneling rather than full-tunneling. In a full-tunnel setup (AllowedIPs = 0.0.0.0/0), all client traffic—including 4K video streaming, app updates, and personal browsing—is forced across the VPN, consuming your homelab’s residential uplink bandwidth.

In a split-tunnel configuration, only traffic destined for our internal enterprise aggregate (10.10.0.0/16) is routed across the encrypted tunnel. Everything else exits directly through the client’s local physical gateway. This delivers maximum browsing performance on the client device while preserving homelab internet bandwidth.

Routing note: Because our entire internal homelab lives neatly inside the 10.10.0.0/16 supernet, a single summary route in the client configuration covers Management, Servers, Clients, DMZ, and both VPN subnets without requiring individual per-VLAN route entries.

Step-by-Step: Configuring WireGuard on pfSense

WireGuard is available as an officially supported package on pfSense Community Edition (CE) and pfSense Plus. Follow these steps to configure the server tunnel:

1. Install the WireGuard Package.
Navigate to System > Package Manager > Available Packages. Search for WireGuard, click Install, and confirm. Once installed, a new menu item appears at VPN > WireGuard.

2. Enable the WireGuard Subsystem.
Navigate to VPN > WireGuard > Settings. Check the box to Enable WireGuard and click Save.

3. Create the Server Tunnel.
Go to VPN > WireGuard > Tunnels and click Add Tunnel:

Setting Configuration Value Technical Rationale
Description Remote_Admin_WG0 Clear identifier for the primary remote management tunnel.
Listen Port 51820 Standard IANA assigned UDP port for WireGuard services.
Interface Keys Click Generate Creates the server’s private and public Curve25519 keypair.
Interface Address 10.10.50.1 / 24 Assigns pfSense as the gateway address on the WireGuard subnet.

Click Save Tunnel, then copy the generated Public Key to a secure notepad—you will need this public key when configuring client devices.

4. Add a Client Peer.
Switch to the Peers tab and click Add Peer:

Setting Value Technical Meaning
Tunnel tun_wg0 (Remote_Admin_WG0) Binds this peer definition to our server tunnel.
Description Admin_Laptop Identifies the authorized client hardware.
Public Key <Client Public Key> The public key generated on the administrative laptop.
Allowed IPs 10.10.50.2 / 32 Cryptokey routing rule: only traffic matching this specific IP is accepted from this key.
Important: In WireGuard peer definitions on the server, the Allowed IPs field must use a host mask (/32 for IPv4). This enforces cryptokey routing: the pfSense kernel ensures that only packets bearing the IP 10.10.50.2 and encrypted with that specific peer’s private key are permitted into the network.

Client Configuration and DNS Routing

On your client device (Windows, macOS, Linux, iOS, or Android), install the official WireGuard client application. Generate a keypair, provide the public key to pfSense as shown above, and build the following client configuration file:

# Administrative Laptop - WireGuard Split-Tunnel Client Configuration
[Interface]
# Client private key generated on this device
PrivateKey = aAAA...YOUR_CLIENT_PRIVATE_KEY...AAAA=

# Client static IP on the homelab WireGuard subnet
Address = 10.10.50.2/24

# Active Directory DNS server from Part 5 (DC01)
DNS = 10.10.10.10

[Peer]
# Server public key copied from pfSense tun_wg0
PublicKey = sSSS...PFSENSE_SERVER_PUBLIC_KEY...SSSS=

# External public endpoint: Dynamic DNS FQDN and pfSense listen port
Endpoint = vpn.yourdomain.com:51820

# Split-tunnel routing: route only internal homelab subnets across the VPN
AllowedIPs = 10.10.0.0/16

# Keepalive interval to maintain stateful NAT translation across mobile carriers
PersistentKeepalive = 25

Notice two critical configuration choices in this client profile:

First, AllowedIPs = 10.10.0.0/16 directs your operating system’s routing table to send only packets destined for our homelab through the WireGuard virtual adapter. All other destinations route normally out your local network connection.

Second, DNS = 10.10.10.10 points client name resolution directly to our Active Directory Domain Controller deployed in Part 4 and Part 5. This allows you to open your browser and access internal hosts like https://pve01.lab.karanth.ovh:8006 or connect via RDP to dc01.lab.karanth.ovh without needing to memorize raw IP addresses.

Configuring OpenVPN as an SSL/TLS Fallback

To guarantee connectivity when connecting from corporate networks or public hotspots that block outbound UDP traffic, we configure OpenVPN using pfSense’s built-in wizard:

1. Launch the OpenVPN Remote Access Wizard.
Navigate to VPN > OpenVPN > Wizards. Select Local User Access for user authentication and click Next.

2. Select the Certificate Authority.
Select the internal Certificate Authority established in Part 7 (or create a dedicated pfSense OpenVPN CA). Generate a new server certificate named OpenVPN_Server_Cert with standard RSA 2048-bit or ECDSA P-256 keys.

3. Configure Server Parameters.
Set the operational parameters as follows:

Parameter Value Purpose
Interface WAN Binds OpenVPN to the external WAN IP.
Protocol UDP on IPv4 (or TCP on IPv4) Use UDP on port 1194 for performance, or TCP on port 443 for strict egress circumvention.
Tunnel Network 10.10.51.0/24 Dedicated virtual subnet for OpenVPN client leases.
Local Network 10.10.0.0/16 Pushes the split-tunnel route to the client upon successful authentication.
DNS Default Domain lab.karanth.ovh Sets the search domain suffix for short hostname resolution.
DNS Server 1 10.10.10.10 Points client DNS requests to DC01.

4. Install the Client Export Package.
Navigate to System > Package Manager > Available Packages and install openvpn-client-export. Once installed, navigate to VPN > OpenVPN > Client Export. This tool automatically bundles the CA root certificate, user certificate, private key, and connection directives into a single ready-to-import .ovpn configuration file for Windows, macOS, or mobile OpenVPN Connect apps.

Dynamic DNS and Inbound Firewall Rules

Most residential internet service providers assign dynamic public IPv4 addresses that change periodically. To ensure your VPN clients can always locate your firewall, configure Dynamic DNS (DDNS) directly within pfSense:

Navigate to Services > Dynamic DNS > Dynamic DNS Clients and click Add. Select your DNS provider (such as Cloudflare, DuckDNS, or Namecheap), enter your API token, and set your desired hostname (e.g., vpn.yourdomain.com). pfSense monitors its WAN interface and updates your public DNS record automatically whenever your ISP leases a new address.

Next, create the WAN firewall rules to permit inbound VPN handshakes:

Navigate to Firewall > Rules > WAN and create the following two rules:

Action Protocol Source Port Destination Port Description
Pass IPv4 UDP * * WAN address 51820 Allow Inbound WireGuard Handshakes
Pass IPv4 UDP * * WAN address 1194 Allow Inbound OpenVPN Handshakes
Production note: If your pfSense WAN is behind an ISP modem/router in a “double NAT” topology, you must configure port-forwarding on the ISP router to forward UDP port 51820 and UDP port 1194 to pfSense’s WAN IP, or place pfSense into the ISP modem’s DMZ mode.

Firewall Rules for Administrative Access

By default, traffic emerging from an authenticated WireGuard or OpenVPN tunnel is evaluated on the Firewall > Rules > WireGuard and OpenVPN tabs. If no rules exist, pfSense blocks all traffic.

Rather than creating a lazy “Allow All to Any” rule, implement a least-privilege administrative ruleset that enforces proper zone isolation:

Sequence Action Protocol Source Destination Ports Rule Purpose
1 Pass UDP/TCP WireGuard net 10.10.10.10 53 (DNS) Permit name resolution against internal Active Directory DNS.
2 Pass TCP WireGuard net 10.10.1.0/24 22, 443, 8006 Permit management: SSH, pfSense webConfigurator, and Proxmox UI.
3 Pass TCP WireGuard net 10.10.10.0/24 3389, 5985, 5986 Permit server administration: Remote Desktop and PowerShell WinRM.
4 Pass ICMP WireGuard net 10.10.0.0/16 Echo Request Allow diagnostic ping testing across internal subnets.
5 Block Any WireGuard net 10.10.99.0/24 Any Prevent VPN administrative peers from touching untrusted DMZ services.

Troubleshooting VPN Connections

When a remote access tunnel fails to pass traffic, diagnose the breakdown systematically using the pfSense diagnostic console:

# Check active WireGuard interfaces, public keys, and latest handshakes
wg show

# Inspect listening sockets on pfSense to verify WireGuard and OpenVPN are running
sockstat -4 -l | grep -E '51820|1194'

# Monitor the WAN interface (vtnet0) in real time for incoming WireGuard handshake packets
tcpdump -ni vtnet0 -s 0 'udp port 51820'
Symptom Likely Cause Fix
No handshake shown in wg show (“latest handshake: never”) UDP packets blocked by ISP router, wrong public key on server, or missing WAN firewall rule. Verify WAN rule allows UDP 51820; run tcpdump -ni vtnet0 udp port 51820 while connecting to confirm packets arrive.
Handshake completes, but cannot ping internal IPs (10.10.10.10) Missing firewall rule on pfSense WireGuard tab, or Windows Firewall blocking off-subnet traffic. Add Pass rules on Firewall > Rules > WireGuard; verify target host firewall allows ICMP/management from 10.10.50.0/24.
Cannot resolve internal hostnames (e.g. dc01.lab.karanth.ovh) DNS server in client config is wrong, or DNS service on DC is not accepting queries from VPN subnet. Ensure DNS = 10.10.10.10 is set in client [Interface] block; verify UDP port 53 rule exists on WireGuard tab.
Large file transfers stall or SSH hangs over mobile hotspot MTU mismatch leading to packet fragmentation over cellular/PPPoE backhaul. Clamp client MTU by adding MTU = 1360 or 1420 inside the client configuration [Interface] block.

Final Thoughts

Building an enterprise homelab is an exercise in realism. In production corporate environments, infrastructure engineers rarely sit in the same room as the physical servers they manage; day-to-day operations take place over secure, encrypted tunnels from corporate laptops and remote jump hosts.

By terminating remote access cleanly at your pfSense virtual router, pairing high-speed WireGuard tunnels with OpenVPN SSL fallback, and enforcing strict zone-based firewall rules, you give your homelab production-grade accessibility without sacrificing perimeter security.

Key takeaway: Never expose management ports directly to the internet; terminate a WireGuard split-tunnel on pfSense for daily administration, keep OpenVPN on TCP port 443 as a fallback for restrictive networks, and push internal Active Directory DNS so all lab hostnames resolve seamlessly from anywhere in the world.
Next in this series

Next, in Part 15 of the Homelab Build series, we will address Exposing Services Securely: deploying a dedicated Reverse Proxy (HAProxy or Nginx Proxy Manager) in our DMZ segment to publish selected lab web services with automated Let’s Encrypt certificates and Web Application Firewall (WAF) inspection.