Are you in the same LAN as your first RPI? If so, you should not have lost contact with it at all. VPNs work by adding routes, not by suppressing existing ones. So, if you had a route like
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.74 metric 1
before starting up the VPN, then the same route must continue to exist after the VPN modifies your routing table. This leaves your RPI accessible from your LAN. It is possible you have to contact it by IP address rather than by name (unless of course you use a local DNS); it is also possible that from the RPI you cannot access other pcs in your LAN via name, because DNS has been rerouted thru the VPN (not necessarily so, but most frequent).
If the RPI is not inyour LAN, then it is a different matter,; pls specify whether this is the case.
EDIT:
You have three possibilities, two easy ones and a slightly more complex one.
If you always connect from, say, 1.2.3.4, just add a suitable route to the first RPI's routing table:
ip route add 1.2.3.4./32 via 192.168.0.1 dev eth0
This will route packets for 1.2.3.4 thru the regular LAN gateway (I assumed it is 192.168.0.1, if not modify accordingly), bypassing the VPN altogether;
Since you are using a commercial VPN this trick is unlikely to work. If you had a VPN server on your own VPS (which, BTW, is what I always do, cheap VPSes are 3 dollars/euros a month, and some have unmetered connections), then you simply connect to the VPN server via the VPN, then contact your RPI by means of ssh
, using as its IP address that of its tunnel end! So, if your VPN tunnel has addresses 10.0.0.1 for the server and, say 10.0.0.6 for the RPI client, this
ssh me@10.0.0.6
would connect you to the RPI. Since you are using a commercial provider of VPN, even if you can connect to their server via VPN with the pc which is not the RPI, I doubt they would allow you to contact another client: it would be a lttle like letting the fox into the hen pen, wouldn't it?
- The more complex solution is explained here for the first RPI: the basic idea is to setup a second routing table, something that can be done only on Linux, not even on Unix; this second routing table does not use the VPN, just your normal LAN gateway. To identify the packets to be routed via this second routing table, you will have to mark all packets with a certain characteristic, for instance those entering the RPI on port 22 (ssh's port) with the CONNTRACK module, not the MARK module: this marks the whole connection, not just the individual packet, including the ESTABLISHED, RELATED packets. Now you can setup an
ip rule
that selects the marked packets telling the kernel to use the second routing table, i.e. the one without VPN.
1Pls see the edit to my post, for an explanation of what I meant succintly in my comment. – MariusMatutiae – 2015-10-04T09:18:47.783
A-w-e-s-o-m-e. I'm going to study all that – user20224 – 2015-10-04T15:30:32.740