How to choose, use and configure a VPN in FreeBSD (Tutorial)

Choosing the Right VPN for FreeBSD

FreeBSD aficionados tend to be discerning: they value stability, security and a bit of Unix elegance. The base system offers the pkg package manager, a sprawling Ports Collection, and default support for pf (the packet filter), rc.d scripts and traditional rc.conf tuning. Many of us pair FreeBSD with KDE Plasma, XFCE, MATE or even window managers like Fluxbox. This audience expects clear documentation and integration with rc.conf, no surprises.

Not every VPN client is a good fit for FreeBSD. You’ll want native Ports or pkg packages, or at least a seamless way to build from source. Performance matters: FreeBSD’s network stack is rock-solid, so look for VPNs that leverage kernel modules (e.g. WireGuard) or well-maintained userland daemons (OpenVPN, StrongSwan). Finally, take pf compatibility into account—for many of us pf is the go-to firewall, and the VPN must play nicely with it.

With that in mind, four stand out:

Feature Comparison

VPN Service Protocols FreeBSD Support Key Features
Mullvad WireGuard, OpenVPN Official configs ports/pkg Privacy-focused, no logs, flat pricing
ProtonVPN OpenVPN, WireGuard OpenVPN via pkg, WireGuard via ports Secure Core, strong privacy policy
NordVPN OpenVPN, NordLynx (WireGuard) OpenVPN via pkg, manual NordLynx Large server network, Double VPN
Surfshark OpenVPN, WireGuard OpenVPN via pkg, WireGuard ports Unlimited devices, CleanWeb ad-blocker

Deep Dive: Top 2 VPNs on FreeBSD

Based on native support, simplicity and community feedback, Mullvad and ProtonVPN emerge as the prime candidates for FreeBSD setups.

1. Mullvad (WireGuard)

WireGuard is now part of the FreeBSD kernel (12.1 ), but you can also use the userland implementation from ports. Mullvad’s servers support WireGuard out of the box.

Installation

# Update pkg database
pkg update

# Install wireguard tools and kernel module
pkg install wireguard-tools
# If you run an older FreeBSD, consider adding:
# pkg install linux-c6-wireguard

Configuration

1. Sign up at Mullvad and generate a WireGuard keypair.

2. Create /usr/local/etc/wireguard/wg0.conf:

[Interface]
PrivateKey = YOUR_PRIVATE_KEY
Address = 10.64.0.2/32
DNS = 10.64.0.1

[Peer]
PublicKey = MULLVAD_SERVER_PUBLIC_KEY
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = se-sto.prod.surfshark.com:51820
PersistentKeepalive = 25

3. Enable at boot via /etc/rc.conf:

wireguard_enable=YES
wireguard_interfaces=wg0

4. Start the interface:

service wireguard start

Ensure pf rules allow tun traffic:

pass out on wg0 from any to any

2. ProtonVPN (OpenVPN)

ProtonVPN publishes OpenVPN configuration files that work flawlessly on FreeBSD.

Installation

# Update pkg and install OpenVPN
pkg update
pkg install openvpn

Configuration

1. Download the .ovpn profiles from your ProtonVPN dashboard. Copy one to /usr/local/etc/openvpn/client.conf. Adjust certificate paths if needed.

client
dev tun
proto udp
remote ch.protonvpn.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /usr/local/etc/openvpn/ca.crt
cert /usr/local/etc/openvpn/client.crt
key /usr/local/etc/openvpn/client.key
remote-cert-tls server
cipher AES-256-GCM
auth SHA512
verb 3

2. Enable at boot via /etc/rc.conf:

openvpn_enable=YES
openvpn_configfile=/usr/local/etc/openvpn/client.conf

3. Start the service:

service openvpn start

Don’t forget pf:

pass out on tun0 from any to any

Conclusion

FreeBSD users benefit from the clarity of rc.conf, pf’s consistency and a clean package ecosystem. Mullvad’s WireGuard approach is blazing fast and integrates seamlessly, while ProtonVPN’s OpenVPN profiles are drop-in ready for those who favour long-standing, battle-tested tunnels. Both weave naturally into FreeBSD’s service management and firewall, giving you privacy without wrestling with unfamiliar tooling.

Download TXT



Leave a Reply

Your email address will not be published. Required fields are marked *