This guide describes connecting the 2N IP intercom, 2N® Access Unit, 2N® Access Unit 2.0 or 2N® LTE Verso (2N device), that is already connected to the Internet, to the user’s remote LAN.
This connection creates network bridge and thus enables connection to 2N device in the same way as it would be in the local network (2N device obtains IP address from local network DHCP where OpenVPN server is, uses network protocols like ARP, can perform broadcast and so on).
Connected 2N device can then be used as usual (for calls, video surveillance of its IP camera, 2N® Access Commander connection , etc..) as it was in same local network.
Device which is in same local network as 2N OpenVPN server does not need to connect to VPN, since all devices connected over VPN will have local network IP addresses from local DHCP. Solution is designed for OpenVPN to be installed on Linux.
VPN connection is pushed through stunnel for additional level of security.
Requirements:
Network topology
In case you cannot put OpenVPN server machine to DMZ and you need to use standard LAN and private address, you need to setup port forwarding so incoming connections from internet to OpenVPN server reach target machine. You will also need to allow such communication on router's firewall
1) Configure the local network on its router – set DHCP IP reservation for OpenVPN server virtual machine (based on MAC address of virtual machine's ethernet port). DHCP server will always assign this machine same IP address.
2) Configure port forwarding if needed - forward public port to port 443 TCP on IP address assigned by DHCP for OpenVPN server.
Choose public port number above 1024 TCP to avoid using privileged ports.
See picture below:
2N OpenVPN server installation:
All examples shown in this article require to be run with elevated rights, either login as root or use proper command to gain required rights.
1) .On Linux machine, deploy following applications: stunnel4, openvpn, bridge-utils, lshw.
2) Create certificates for OpenVPN. You need server certificate, server key, ca and intercom certificate with intercom key. Then you need to put those certificates to correct folders for stunnel,openvpn and intercoms.
To make script run , you need to save it in EOL conversion to UNIX and encoding UTF-8 format, then upload it and apply chmod a+x to make script executable.
3) Now you need to setup stunnel configuration.
4) Next step is to configure OpenVPN service
5) OpenVPN service requires also to configure up.sh and down.sh scripts and give then proper file rights.
6) Then it is needed to bridge network traffic properly (do not run commands in this step over SSH as they include bringing ETH interface down which will result in connection loss)
7) Restart OpenVPN and asociated services
8) Check if stunnel and openvpn service are running with command run from command line, otherwise repeat step 7
lsof -i 4
9) If firewall is installed, enable ports 1149 and 443 to be accepted(example configuration uses TCP protocol for OpenVPN)
2N IP Intercoms, 2N® LTE Verso, 2N® Access Unit
In order to connect 2N IP device to 2N OpenVPN server, you need to upload certificates downloaded from OpenVPN server to 2N IP device and configure OpenVPN connection in 2N device. After successful connection, 2N device will receive DHCP address from local network where 2N OpenVPN server is and will appear to local network as local device.
1) Login to 2N device you want to connect to 2N OpenVPN server over internet
2) Go to System – Certificates
3) Upload ca.crt file to Trusted certificates:
4) Upload intercom.crt and intercom.key files to User Certificates:
So finally it looks like that:
5) Go to System – Network – OpenVPN and set following:
- Enabled: Yes
- Default Interface: No
- Server Address: Public IP (which belongs to router where 2N OpenVPN server is)
- Server Port: Public Port (port used for forwarding on router where 2N OpenVPN server is - for example 1443)
- Trusted Certificate: 1
- Client Certificate: 1
6) Save your settings
7) Press START button to connect to 2N OpenVPN server
2N Device now should be able to initiate connection to 2N OpenVPN server and will receive new IP address from DHCP in local network where 2N OpenVPN server is.