VPS and surveillance camera behind NAT

New to Debian (Or Linux in general)? Ask your questions here!

VPS and surveillance camera behind NAT

Postby gylab » 2018-12-18 07:33

Hi All,
I have used linux for a long time but I'm not an expert. Now, I have a problem. Shortly:
I have a VPS (Debian) at a provider. I have a surveillance system home with a local network and a local Debian server. I installed Zoneminder on VPS. I would like to record my cameras on this but my local network is behind NAT. I could install OpenVpn on VPS and my local server as well. I works correctly. Now:
- VPS has a public IP
- VPS has tun0 if, IP is 10.8.0.1
- My local server has tun0 if, IP is 10.8.0.5
- My local server has eth0 with 192.168.1.5 IP
- My cameras on local network with 192.168.1.200/210
The goal: Zoneminder on VPS should access my cameras on local network. How could do it?
I think, at first, at VPS I would route 192.168.x.x addresses on VPS to 10.8.0.5 via tun0. How?
Then on my local server I would forward request from tun0 if to local network. How?
Note: I don't want to access internet from home via VPN. I don't want to see my home network from the internet. It is enough to access my local network from my VPS. The best solution would be if my VPS could access 192.168.xx.xx.
I can read manuals so it is enough to give some keywords, what is the usable technique for the solution. If you can write it in some sentences, it can be very helpful for me. Thanks.
gylab
 
Posts: 2
Joined: 2018-12-18 07:01

Re: VPS and surveillance camera behind NAT

Postby reinob » 2018-12-18 10:45

If I understand you correctly (I know nothing about zoneminder..) you want your VPS to have access to your local subnet (at home).

If you run the openvpn server at home and the openvpn client at the VPS, you could simply add -- at the server (home) side -- the following to your config:

Code: Select all
push "route 192.168.1.0 255.255.255.0"


This will tell the client (VPS) to route 192.168.1.x via the tun interface.

As long as you have your routing and port forwarding (like iptables -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE, maybe also -A FORWARD -s 10.8.0.0/24 -o eth0 -j ACCEPT, I always forget..) set up OK at the server, then it should work. Otherwise kindly post the error messages you get and relevant logs.
reinob
 
Posts: 699
Joined: 2014-06-30 11:42

Re: VPS and surveillance camera behind NAT

Postby gylab » 2018-12-19 07:20

Hi reinob,
"If I understand you correctly (I know nothing about zoneminder..) you want your VPS to have access to your local subnet (at home)."
Yes, exactly.

"If you run the openvpn server at home and the openvpn client at the VPS..."
Unfortunately, not. Because my client is behind NAT, my local server has no public IP. So the VPN server is the VPS and my local server is a client.
gylab
 
Posts: 2
Joined: 2018-12-18 07:01


Return to Beginners Questions

Who is online

Users browsing this forum: Head_on_a_Stick and 11 guests

fashionable