I am not linux nor vpn expert, but I had to spent over 50 hours on this setup, because linux and network guys has more ego than knowledge (respect for the exception).
I also spent over 500 EUR for a basic setup which was unsecured. Ending up guys from Egypt and India, who at least knows what to do and fix the incorrect setup relatively cheap. On upwork you can find many experts - just be sure to do project contract and not hourly.
In our case we wanted to reach all devices connected to the teltonika router (incl. PLC, IP cameras etc) which has internet through mobil net / regular SIM cars. If you want to connect only one device could be there is an easier way.
If you want you can use teltonika built in functions (I think it is not free):
Youtube: “How to control your Siemens PLC remotely over Ethernet with RUT240?”
If you want your on openvpn server some hits:
Server side
-
Subscribe to simple VPS server for a month, so you can test, and if you do something wrong, just request a clean install from backend and within few minutes you can start over.
I use for test: Új szolgáltatás megrendelése - RackForest
Cheapest enough less than 4 EUR/month, and you cancel any time. But you can choose almost any of the provider (VPN Special from AlphaVPS did not work me).
-
Install Ubuntu 22.04.5 LTS
-
Login with ssh with root and run commands:
For update
sudo apt update
sudo apt upgrade
for install vpn with GitHub - Nyr/openvpn-install: OpenVPN road warrior installer for Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS and Fedora
wget https://git.io/vpn -O openvpn-install.sh && bash openvpn-install.sh
(choose: 2 (TCP), PORT 443, 2 (google), test)
we use 443 and not the default 1194 because some mobile provider may block ports like 1194
- Then you need add/edit some files, or with ssh or I like sftp better more visual:
copy sample aut.sh to /etc/openvpn/
give permission 755 to the file
copy sample ccd folder to /etc/openvpn/server/
give permission 644 to all files inside the folder
open /etc/openvpn/server/server.conf
delete the file content, and copy data from sample server.conf (do not copy the file itself only content!)
copy /etc/openvpn/server/ca.crt to computer
open with text editor sample client1.ovpn, and copy between the content of the (/etc/openvpn/server/ca.crt)
change to the correct IP!// remote x.x.x.x 443 tcp
run:
systemctl restart openvpn-server@server.service
systemctl status openvpn-server@server.service
Client side setup
5. import the profile file (sample client1.ovpn) to OpenVPN Connect, enter username/password, choose WITHOUT certificate
Teltonika side setup
Change the IP of the router to 10.254.x.1
Setup VPN.
=====
If you need I can provide some sample files for complete setup.
This is setup works, but has some security issue. Eg. if you client connects to the router of the site, he can also reach other sites. So some extra iptables rules needed.