0

I am trying to set up an IP camera in our home to be accessible remotely over internet. I have blocked all access directly to the camera over internet to start with. And I have created a home OpenVPN server on an Ubuntu laptop. So I can connect to the home OpenVPN server perfectly.

However, I am not sure how to connect to the camera after joining as a OpenVPN client from my phone or personal laptop when I am outside by home network.

The OpenVPN subnet is under 10.8.0.0 mask 255.255.255.0. And the router subnet is 10.0.1.0 mask 255.255.255.0. The camera has the IP address 10.0.1.15.

So I want to be able to connect from a 10.8.0.x IP to the 10.0.1.15.

I tried adding a route on the Ubuntu machine running OpenVPN server (10.0.1.2), though I don't think I am doing it right with this route add -net 10.8.0.0/24 gw 10.0.1.2 or this route add -net 10.0.1.0/24 gw 10.0.1.2

Can someone please advise on how to correctly get the route working from 10.8.0.x to 10.0.1.15?

1 Answer 1

0

You're adding the routes to the wrong spot. The OpenVPN server already has routes for both of those destinations networks. It's the endpoints that need them:

  • The VPN clients need to send packets to 10.0.1.15;
  • The camera needs to send packets to 10.8.0.x/24.

The VPN clients need a route for destination 10.0.1.15 or 10.0.1.0/24, and the route gateway is the VPN server 10.8.0.1 (the gateway must be the address facing the clients, not the LAN address). Since it's a tun interface, you'll also get the same result if you use dev tun0 instead of a gateway.

This route can be deployed through OpenVPN using push "route 10.8.0.0 255.255.255.0".

The camera probably doesn't support custom routes, it just sends everything to its "default gateway" – which means the LAN gateway needs to learn the route towards your VPN instead. (Hopefully your router allows adding routes?) But the parameters don't change; the destination is still 10.8.0.0/24 and the route gateway is still 10.0.1.2 (the VPN server).

2
  • Thank you, grawity. I did all the steps as you said, including adding a static route to the camera in the router, but I'm still unable to access the camera through the VPN network from outside. Thinking further, it could be the ports not being open that may be the issue now. Do you have any ideas for setting this up on the OpenVPN server?
    – Ever Tried
    Sep 23, 2019 at 7:18
  • Run tcpdump on it, and figure out where the traffic goes and where it doesn't go. Sep 23, 2019 at 8:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .