Installation of OPNsense OpenVPN instances site-to-site

From Thomas-Krenn-Wiki
Jump to navigation Jump to search


The Open Source firewall OPNsense supports several technologies for the installation of VPN (Virtual Private Network) connections. In this example, we show you how to install a site-to-site VPN connection with two OPNsense firewalls with the VPN technology OpenVPN. These instructions show the configuration with the instances menu newly introduced with OPNsense 23.7 that was created under the version OPNsense 25.1.7_4-amd64.

To our OPNSense Firewalls in the online shop of Thomas-Krenn

Explanation of topology

This paragraph shows a compact summary of the configured topology and the most important settings of the OpenVPN tunnels.

HA cluster and OpenVPN

If you use OPNsense high availability cluster as OpenVPN server, the virtual WAN IP address must be set as the server address. [1]

Site A

  • OPNsense OpenVPN server
  • local network: 192.168.1.0/24
  • WAN-IP: 100.64.2.1

Site B

  • OPNsense OpenVPN "client"
  • local network: 192.168.2.0/24
  • WAN-IP: 100.64.2.2

OpenVPN settings

  • port: 1194
  • protocol: UDP
  • topology: subnet
  • transfer network: 100.64.100.0/24
  • TLS static key with mode crypt

Installation of OpenVPN site-to-site

For the installation of OpenVPN Instances connections, the following steps are necessary:

Configuration of OpenVPN instance site A (server)

  1. create Certificate Authority
  2. create server certificate for site A (server)
  3. create client certificate for site B (client)
  4. create firewall rules for WAN and OpenVPN
  5. create OpenVPN server
  6. create client specific overrides
  7. export Certificate Authority
  8. export client certificate

Configuration of OpenVPN instance site B (client)

  1. import Certificate Authority
  2. import client certificate
  3. create firewall rules for WAN and OpenVPN
  4. configure OpenVPN instances client

Configuration steps OpenVPN instance site A (server)

The following screenshots show the steps that are necessary on the OpenVPN instance server page.

Menu 'Trust'

In the beginning, the Certificate Authority is created. Both certificates for server and client are created with the help of this CA.


Firewall rules

In order for the OpenVPN service to accept connection requests from outside, the port, which is set in the OpenVPN server configuration, must be opened in the firewall.

OpenVPN instances site A (server)

The OpenVPN instance site A (server) can be created with the Instances configuration method after preparatory activities.

OpenVPN interface firewall rule

There is only one new interface, which is the OpenVPN interface. Here, you can control the data traffic in the OpenVPN tunnel. In this example, any traffic is allowed. You can also set this even more granularly and restrictively.

Client specific overrides

An OpenVPN server with a site-to-site connection is created here. The client specific override is responsible for ensuring that the server knows to which endpoint it should send the data. Multiple remote locations can be connected to a central OpenVPN server.

Configuration steps OpenVPN instance client(s)

Here the steps that are necessary for OpenVPN instance site B (client), are shown. Several clients can be connected to an OpenVPN server using the star principle. The communication is controlled via individual client specific overrides.

Menu 'Trust'

For this client, the CA and the client certificate, that was created on the OpenVPN server before, must be imported in the menu trust.

Firewall rules

The firewall rules for the WAN interface must be set analogously for the OpenVPN server configuration.

Configuration of OpenVPN instances site B (client)

The OpenVPN client with the instances configuration method can now be created after preparatory activites.

OpenVPN interface firewall rules

There is also a new interface for the client, which is the OpenVPN interface. This interface must be configured analogously to the server side. Now, the configuration is completed and a connection setup should be possible.

Testing the connection

Please verify, if the client connects to the server. This can be found at client and server in the webinterface in the menu VPN → OpenVPN → connection status.

Troubleshooting

This section shows different troubleshooting opportunities to discover mistakes in the configuration.

  • Ping
    • Send a ping command to an IP address in the target network.
    • Packet capture on the firewall interfaces.
  • Tcpdump
    • server page: tcpdump -n -i ovpns1
    • client page: tcpdump -n -i ovpnc1

References

  1. high availability (docs.opnsense.org)


Author: Thomas Niedermeier

Thomas Niedermeier working in the product management team at Thomas-Krenn, completed his bachelor's degree in business informatics at the Deggendorf University of Applied Sciences. Since 2013 Thomas is employed at Thomas-Krenn and takes care of OPNsense firewalls, the Thomas-Krenn-Wiki and firmware security updates.


Related articles

OPNsense LTE connection
OPNsense OpenVPN performance tests and results
Usage of Intel E610 network cards under OPNsense 25.7 with Free BSD 14.3