How to Set Up PIA (Private Internet Access) on OPNsense Using OpenVPN

Step 1: Download PIA OpenVPN Configuration Files

  1. **Download PIA OpenVPN Files**: To start, you need to download the certificate and key files from the official PIA website.

Step 2: Access the OPNsense Dashboard

  1. **Log into OPNsense**: Open a web browser and go to your OPNsense firewall’s IP address (e.g., `https://192.168.1.1`).
  2. **Log in** using your credentials.

Step 3: Import the PIA Certificate

  1. Go to **System > Trust > Authorities** in the OPNsense dashboard.
  2. Click **Add or Import CA** to create a new certificate authority (CA).
  3. In the **Descriptive Name** field, enter a name (e.g., “PIA CA”).
  4. Open the `.ovpn` file you downloaded earlier, find the certificate section (the text between `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`), and paste it into the **Certificate data** box.
  5. Click **Save**.

Step 4: Add a New VPN Client

  1. Navigate to **VPN > OpenVPN > Clients**.
  2. Click **Add Client** to create a new VPN client.
  3. **Configure the OpenVPN Client** as follows:
    • **Server Mode**: Peer to Peer (SSL/TLS)
    • **Protocol**: UDP (you can use TCP, but UDP is typically faster)
    • **Device Mode**: tun
    • **Local Port**: Leave this blank
    • **Server Host or Address**: Enter the PIA server address you want to connect to. This information is available in the `.ovpn` files you downloaded earlier (e.g., `germany.privateinternetaccess.com`).
    • **Server Port**: Enter `1198` (or the port specified in the configuration file).
    • **Authentication Method**: Leave as **None**.
    • **Description**: Enter a name for this VPN connection (e.g., “PIA VPN”).
    • **Username and Password**: Enter your PIA account credentials.
    • **Server Hostname Resolution**: Ensure this box is **checked** (this means it will try to reconnect automatically if the connection drops).
  4. **Disable TLS Authentication** by unchecking “Enable Authentication of TLS Packets”.
  5. **Peer Certificate Authority**: Select the CA you added in Step 3 (e.g., “PIA CA”).
  6. **Client Certificate**: Leave this set to **None**.
  7. **Encryption Algorithm**: Use **AES-128-CBC** (this matches the OpenVPN configuration file from PIA).
  8. **Auth Digest Algorithm**: Select **SHA1**.
  9. **Hardware Crypto**: Leave set to **No Hardware Crypto Acceleration** (unless you have a hardware accelerator).
  10. **Compression**: Set this to **Enabled with Adaptive Compression**.
  11. **Disable IPv6**: Check the box to **Disable IPv6**. This prevents IPv6 leaks.
  12. **Advanced Options**: Paste the following commands into the **Advanced** box (these are options from the OpenVPN config file):

persist-key;

persist-tun;

remote-cert-tls server;

reneg-sec 0;

  1. Click **Save**.

Step 5: Verify OpenVPN Connection

  1. Navigate to **VPN > OpenVPN > Connection Status**.
  2. Check that the VPN connection is active. The status should show **Up**. If not, you can restart the service or wait a few moments for it to resolve.

Step 6: Set Up NAT for VPN Traffic

  1. Go to **Firewall > NAT > Outbound**.
  2. Change the mode to **Hybrid Outbound NAT Rule Generation** and click **Save**.
  3. Click **Apply Changes**.
  4. **Clone the Existing Rules**: For each outbound NAT rule listed, click the **Clone** button, then:
    • Set the **Interface** to the OpenVPN interface (this will typically be called something like `ovpnc1`).
    • Leave the rest as it is.
  5. Click **Save** and repeat for each rule.
  6. Click **Apply Changes** to ensure the new NAT rules are active.

Step 7: Test the VPN Connection

  1. **Check if the VPN is Active**: Use a web service such as [IPLeak.net](https://ipleak.net) or [WhatIsMyIP.com](https://www.whatismyip.com) to check if your IP address matches the VPN server you connected to.
  2. If the IP matches the VPN server, then your VPN setup is successful!

Funny enough, I was just coming back to this to post that I am unable to move any traffic on my vpn tunnel. The vpn tunnel shows as connected and operational but if I set NAT and a FW rule to put traffic through I simply can’t reach the internet. I am doing this tvia the legacy client on openvpn.

I just got back around to this. I am going to try this later tonight. Thank you.