I have a LAN at home. It is behind a NAT and externally uses dynamic IP addresses. Inside my home LAN, I use 192.168.1.x IP addresses.
Further, I have a VPS, which has a IP 185.x.x.x address. What I would like to do now is to use OpenVPN to set up a tunnel between my home LAN and the VPS, such that the VPS can access shared files in my home LAN.
I already have set up OpenVPN and all certificates etc. using OpenSSL. When I run
openvpn --config server.conf
on the VPS and
openvpn --config client.conf
on a PC in my LAN, a VPN connection is established and both the VPS and the PC get a TUN device having a 10.8.x.x IP address. So far OK, it seems that these two computers are connected, and I don't see any error messages.
However, I don't know how I shall proceed.
This is my
server 10.8.0.0 255.255.255.0 verb 3 key /etc/openvpn/server/server.key ca /etc/openvpn/server/ca.crt cert /etc/openvpn/server/server.crt dh /etc/openvpn/server/dh.pem keepalive 10 120 persist-key persist-tun comp-lzo route 192.168.1.0 255.255.255.0 dhcp-option DNS 192.168.1.1 user nobody group nobody proto udp port 1194 dev tun1194 status openvpn-status.log
and this is my
client nobind dev tun redirect-gateway def1 bypass-dhcp remote 185.x.x.x 1194 udp comp-lzo yes redirect-gateway def1 key /etc/openvpn/client.key cert /etc/openvpn/client.crt ca /etc/openvpn/ca.crt
How should I configure the client and the server, such that I can send traffic on the VPS into my LAN? (e.g. mount a SMB/CIFS share like 192.168.1.2 on the VPS)
Ideally, the VPN connection would use the router at my home as DHCP server, if that's possible. I tried that using the
dhcp-option, but it didn't have an effect. It also seems like it does not route traffic from the VPS to my LAN, e.g. I cannot do a
ping 192.168.1.2 on my VPS (which I would expect should be possible).
Further, is it possible to connect a further PC from the interner to the VPN server running on the VPS, and the third PC can also access my home LAN? Like so:
Some PC on the internet <---> VPS <---> VPN tunnel <---> Home LAN