I have a Device on a remote site that I need a network connection from a VPS OpenVPN Server), so I set up a Raspberry Pi running Stretch as a 3G/4G Router. The Pi connects to 3G OK, and can connect to the Internet. As a means of giving the Pi a fixed IP address, I installed OpenVPN on the VPS, and the OpenVPN client on the Pi, and the VPN tunnel establishes. OpenVPN is set up to always assign the same 10.8.0.5 address to the Pi. All good so far. The Pi can ping and ssh to the VPS on 10.8.0.1, and the VPS can ping and ssh to the VPS on 10.8.0.5.
The ETH0 on the Pi has a static address of 192.168.201.1, and the Device has an address of 192.168.201.2 . The Pi can ping 192.168.201.2 OK.
The VPS can ping the Pi on 192.168.201.1, but can't ping the Device on 192.168.201.2. This is the routing issue I have.
The VPS is out on the internet somewhere. The full 'route' would be from VPS, through OpenVPN tunnel to the Raspberry Pi (10.8.0.5) then through the Pi and out on eth0 (static IP address 192.168.201.1) to a Device (IP address 192.168.201.2).
ip route on the VPS returns:
default via 22.214.171.124 dev eth0 10.8.0.0/24 via 10.8.0.2 dev tun0 10.8.0.2 dev tun0 proto kernel scope link src 10.8.0.1 78.143.xxx.yyy/25 dev eth0 proto kernel scope link src 78.143.xxx.yyy 192.168.200.0/24 dev eth0 proto kernel scope link src 192.168.200.1 192.168.201.0/24 via 10.8.0.2 dev tun0
ip route on the Pi returns:
0.0.0.0/1 via 10.8.0.6 dev tun0 default via 192.168.0.1 dev usb0 src 192.168.0.143 metric 600 10.8.0.0/24 via 10.8.0.6 dev tun0 10.8.0.6 dev tun0 proto kernel scope link src 10.8.0.5 78.143.xxx.yyy via 192.168.0.1 dev usb0 126.96.36.199/1 via 10.8.0.6 dev tun0 192.168.0.0/24 dev usb0 proto kernel scope link src 192.168.0.143 metric 600 192.168.200.0 via 10.8.0.6 dev tun0 192.168.201.0 via 10.8.0.6 dev tun0 192.168.201.0/24 dev eth0 proto kernel scope link src 192.168.201.1 metric 202
What I'm trying to achieve is an app on the VPS connecting to the Device on 192.168.201.2. I suspect the issue is something to do with routing clashes on the last two lines on the above routing table, but that's a guess.
Picture of the setup:
Hope that makes some sort of sense. Regards, Tony...