1

My raspberry is connected to my lan network 192.168.1.0/24 and it has a static ip. From the outside I can reach it by opening some ports on the ISP router. I have installed an openvpn client on it which creates a tun0 network on 10.8.8.0/24. When the raspberry is connected to the vpn of course I cannot reach it anymore from the outside. How can I reroute the traffic on the local network, so that even if the VPN is connected I can still reach it from the outside?

Thanks a lot in advance

mariuccio
  • 13
  • 3

2 Answers2

1

What you need is policy based routing. Basically, you want answers to packets from outside to go directly back and not to the VPN.

ip rule add from 192.168.1.0/24 table 200
ip route add 192.168.1.0/24 dev eth0 table 200
ip route add default via 192.168.1.1 table 200

This assumes that eth0 is the name of your interface and 192.168.1.1 is the address of your router.

RalfFriedl
  • 3,108
  • 4
  • 13
  • 17
0

Even if you're running vpn on the device it shouldn't interfere in the communication with the static ip address because what the vpn does is that it assigns a virtual IP address to the client. have you tried to ping (from inside the router) to the Raspberry when it's connected to the vpn?

Humberto Castellon
  • 879
  • 1
  • 7
  • 17