How To Setup Pfsense To Act As OpenVPN Server For Ewon Devices
How To Setup Pfsense To Act As OpenVPN Server For Ewon Devices
1 INTRODUCTION
The following document lists the different steps to configure pfSense to work as OpenVPN server in
Bridged mode and how to connect Ewon devices to the pfSense.
The easiest way to connect an Ewon to pfSense is to configure the VPN server identical to an eFive
VPN server. Like this, on the Ewon, to configure the VPN connection you can directly use the VPN
wizard used also for eFive VPN connections.
Note: Using other settings for the OpenVPN server as those explained inside this document is also
possible. This however will require to configure the Ewon by FTP and using additional VPN config
files not covered inside this document.
Table of Contents
1 Introduction .................................................................................................................................... 1
2 Configuring pfSense to act as OpenVPN server in bridge mode..................................................... 2
2.1 pfSense Interface configuration.............................................................................................. 2
2.2 OpenVPN server configuration ............................................................................................... 3
2.2.1 Create a CA (Certificate Autorithy) ................................................................................ 3
2.2.2 Create a Server Certificate .............................................................................................. 3
2.2.3 Configure the VPN server................................................................................................ 4
2.3 Check if the configuration is accepted and the server is running ........................................... 6
2.4 Firewall Rules .......................................................................................................................... 6
2.5 Bridge the OpenVPN connection ............................................................................................ 7
2.5.1 Assign the Interface ........................................................................................................ 7
2.5.2 Configure the assigned Interface .................................................................................... 7
2.5.3 Declare the Bridge between VPN and LAN ..................................................................... 7
2.6 Specify a VPN user for each Ewon .......................................................................................... 8
2.6.1 Create a VPN user for each Ewon ................................................................................... 8
2.6.2 Specify fixed VPN-IP address for each Ewon .................................................................. 8
3 Configuring Ewon to connect to the OpenVPn server .................................................................... 9
4 Displaying connected devices on the OpenVPN server ................................................................ 10
By JPCO Rev: 20
2 CONFIGURING PFSENSE TO ACT AS OPENVPN SERVER IN BRIDGE MODE.
Following steps explain how to configure the pfSense to act identical as an Efive OpenVPN server.
We will use a typical Scada architecture as the one shown here under on an architecture used with
an eFive.
Figure 1
To perform this, we will need to configure the pfSense to act as VPN server in Bridge mode.
OpenVPN offers the option of using tap interfaces and bridging clients directly onto the LAN or other
internal network. This can make the remote clients appear to be on the local LAN.
If you want to change IP ranges afterwards, you can do it using the menu:
Interfaces / LAN
Interfaces / WAN
2
IPv4 Address: 10.0.120.153 / 24
Create / Edit CA
Country Code, City, Organization: Optional info, but useful to identify the certificate
Internal Certificate
Certificate authority: VPNServer-CA (select here the CA you just created before)
3
Lifetime (days): 3650
Common Name: VPNServer-Cert (or if you have a domain name for the public IP
address used by your VPN server, enter it here)
Country Code, City, Organization: Optional info, but useful to identify the certificate
Certificate Attributes
General Information
Cryptographic Settings
Encryption Algorithm: select “BF-CBC (128 bit key by default, 64 bit block)
Tunnel Settings
4
Concurrent connections: 200
If you want that VPN clients (Ewons and users) can communicate with each other, check the
“Allow communication between clients connected to this server”
If you want also to connect PCs to the OpenVPN server (so not an Ewon), you can use for
those VPN client connections dynamically attributed VPN IP addresses. In this case you can
define the range of IP-addresses used for those VPN users here
Client Settings
Dynamic IP: enable “Allow connected clients to retain their connections if their IP address changes.”
Advanced Configuration
Custom options:
route-gateway "192.168.1.254";
username-as-common-name;
Explication:
add identical route for all Ewons if you want that the Scada can reach the devices
connected to the Ewon LAN
5
2.3 CHECK IF THE CONFIGURATION IS ACCEPTED AND THE SERVER IS RUNNING
Status / Services
Verify here if the VPN server you just created is up and running. A green check indicates that all
is ok. If not you can open the related log entries link.
Firewall / Rules
Action: Pass
Interface: WAN
Protocol: UDP
Source
Source: any
Destination
Destination Port Range: OpenVPN (1194) (same port as configured inside VPN server)
Save and:
6
2.5 BRIDGE THE OPENVPN CONNECTION
To finish the OpenVPN configuration in bridge mode, we need to link the VPN and LAN interface. For
this we first need to assign an Interface to the VPN Network we just created.
Select the VPN server you just created inside the available network ports and click on +Add
Member Interfaces: select here the LAN and the MyOpenVpn interface just assigned before.
To select both interfaces, keep the control button pressed when selecting the interface with a
mouse click.
7
2.6 SPECIFY A VPN USER FOR EACH EWON
To allow the Scada system to reach the right Ewon or the network behind the Ewon, we need to use
a fixed VPN-IP address for each Ewon.
Important: As for this VPN server configuration we use User Authentication, it is very
important for security reasons to use here very strong passwords.
Perform identically for all other Ewons. For example ewon002, ewon003, etc.
General Information
Common Name: ewon001 (identical to the username created for the Ewon in section 2.6.1)
Client Settings
Advanced:
Explication: define here the IP address that Ewon will receive for the VPN connection.
Make sure the VPN address makes part of the LAN network of your pfSense, and that the IP
address is not yet used on the network (by another LAN device or by another VPN client)
Perform identically for all other Ewons. For example, ewon002, ewon003, etc.
8
3 CONFIGURING EWON TO CONNECT TO THE OPENVPN SERVER
To configure each Ewon you’ll need first to retrieve from the pfSense following info:
- the CA certificate (created in section 2.2.1, use the “Export CA” action to retrieve the CA )
- the username and password for the Ewon (created inside section 2.6.1)
To configure the Ewon flexy to connect to the pfSense Server, perform following steps:
You can use the eBuddy software for easy LAN address configuration
Allows to change the username and password and to specify the date and time settings of the Ewon.
Important: for security reason change the Ewon default password and use a strong password
Select the interface you want to use for the Internet connection.
If you use the cabled Internet Wan connection, make sure to connect the WAN cable before
launching the wizard.
Note: Your Flexy may dispose of an additional communication card (Wifi, 4G, etc.) .
Server Address: the URL (or public IP address ) on which the pfSense server can be reached
VPN Username & Password: the credentials for the Ewon created on the pfSense
Protocol: UDP
Port: 1194
The VPN cloud icon on the right bottom of the window should be displayed in green color.
If not, best check inside the event log and realtime log of the Ewon, why the VPN connection failed.
Diagnostics / Logs / Event Logs
Diagnostics / Logs / Realtime Logs (to display the VPN connection logs)
9
4 DISPLAYING CONNECTED DEVICES ON THE OPENVPN SERVER
You can customize the pfSense dashboard (default page) to display the connected VPN users.
Status / Dashboard
Some other useful links to check the status of the OpenVPN server:
10
• Routes added on pfSense to reach Ewon LAN networks: Diagnostic / routes
11