从 openvpn 服务器访问 openvpn 客户端 LAN

从 openvpn 服务器访问 openvpn 客户端 LAN

我的设置如下:

 --------------------------------      ---------------------------------
|Digital Ocean droplet          |      |TC7200 router                  |
|Running OpenVPN server         | <--> |                               |
|                               |      |LAN: 192.168.0.1               |
|OpenVPN IP: 10.8.0.1           |      |WAN: 78.11.146.13              |
 --------------------------------      ---------------------------------

                                                    ^
                                                    |
                                                    V
                                        -------------------------------
                                        | RaspberryPi+OpenVPN client  | 
                                        | LAN: 192.168.0.28           |
                                        | tun0: 10.8.0.6              |
                                        -------------------------------
                                                    ^
                                                    |
                                                    V
                                        -------------------------------
                                        | Android phone with IP Webcam| 
                                        | LAN: 192.168.0.39           |
                                        -------------------------------

我想要实现的是从openvpn服务器(10.8.0.1)访问IP WebCam(192.168.0.39)。

服务器配置文件

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-config-dir ccd
route 192.168.0.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 67.207.67.2"
push "dhcp-option DNS 67.207.67.3"
client-to-client
keepalive 10 120
cipher AES-256-CBC
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
explicit-exit-notify 1

ccd/客户端

iroute 192.168.0.0 255.255.255.0
push route "192.168.0.0 255.255.255.0"

路线:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         159.89.16.1     0.0.0.0         UG    0      0        0 eth0
10.8.0.0        10.8.0.2        255.255.255.0   UG    0      0        0 tun0
10.8.0.2        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
159.89.16.0     0.0.0.0         255.255.240.0   U     0      0        0 eth0
192.168.0.0     10.8.0.2        255.255.255.0   UG    0      0        0 tun0

通过此配置,我可以使用 ssh 从 openvpn 服务器连接到 raspbery pi。我能够从另一个 vpn 客户端连接(ssh)或 ping 到 raspberry pi。但我不知道如何配置 openvpn 服务器以访问 raspberry pi LAN 设备。也许我应该转发我家用路由器上的一些端口?

相关内容