TinCanTech wroteRobMeades wrote My problem is that I can't see anything in the routing table that suggests that what I'm doing should not work
RobMeades wrote0.0.0.0/1 via 10.50.10.5 dev tun11
128.0.0.0/1 via 10.50.10.5 dev tun11
default via 82.24.196.1 dev vlan2
See --
redirect-gateway in
The Manual v23x
I think I now understand what you mean, here it is in "long hand" for others who have the same problem:
An OpenVPN client on Router B establishes a connection to an OpenVPN server on Router A on the external interface of Router A that you specify, let's say for example it is the static public IP address allocated to Router A by the ISP (or some Dynamic DNS version of the same). In general, the way OpenVPN works is that it absorbs packets over a virtual interface (the "tun"), wraps them up in VPNness, and then drops them back into the kernel to be routed to the IP address of the far end of the VPN link. So when a VPN packet is created by OpenVPN on Router A, it will normally be routed out of the ISP interface of Router A to get to the public IP address of Router B on the internet, since that's what the routing table says. This is normally fine.
However, what if Router A has TWO external IP addresses? In my case Router A has the ISP interface and an additional interface, which is my Private Internet Access service, going off via another instance of OpenVPN. When this second interface is created it adds routes to Router A's routing table so that all internet traffic goes out via that interface. Hence the packets that OpenVPN creates, rather than going out through the ISP interface, will go out through the Private Internet Access interface. The problem, I think, is that the OpenVPN client running on Router B then doesn't receive this packet because it is coming from the wrong source IP address; it has set up a route to get things from a specific IP address, in my case the ISP IP address, so packets coming via the Private Internet Access IP address don't get where they should.
The obvious solution would be to get the OpenVPN server running on Router A to put things only down the "ISP" interface, which for me is vlan2. However, OpenVPN sits above a sockets interface in the Linux architecture, through which is it not possible to dictate the device it uses; this must be done instead using Policy Based Routing.
So I think I need to create a new routing table specifically for the source address of the OpenVPN tun on Router A (IP address 10.8.0.1 in my case), copy all the normal rules into that routing table but deleting the new routes created by the Private Internet Access OpenVPN client in the process. Then the stuff coming from that OpenVPN client will get to the right place. I think. :-)