OpenWRT set Policy-based routing with multiple interfaces

2

I have an OpenWRT router. On it, I had set up a couple VPN interfaces. I have a tinc VPN that links all my remote networks together; an OpenVPN tunnel to an overseas location.

Currently, I already have a static routing table that allows me to access my remote networks. For example, my local network 192.168.1.0/24 can access one of my remote networks, which has a local IP range 192.168.0.0/24, and vice versa. So my hosts on 192.168.1.0/24 can see and access any hosts on 192.168.0.0/24 as though they are on the same switch. There are possibilities that more remote networks may be added to the mesh, but I had set up tinc scripts to handle that case.

Kernel IP routing table on my local network
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         111.222.333.1   0.0.0.0         UG    0      0        0 eth1.2
10.10.0.5       *               255.255.255.255 UH    0      0        0 tun0
111.222.333.0   *               255.255.254.0   U     0      0        0 eth1.2
111.222.333.1   *               255.255.255.255 UH    0      0        0 eth1.2
192.168.0.0     *               255.255.255.0   U     0      0        0 tinc
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan

Now, I have a server on my local network, say 192.168.1.101, which need to be accessible to all the hosts on the tinc mesh (which is what it's currently doing - great!), and vice versa. However, now I would like any other traffic in and out of the server outside of the tinc mesh IP ranges to go over the OpenVPN interface. For example, server backs up to 192.168.0.5 at periodic intervals; this is will go over tinc interface. The server can request and download updates from the Internet but that will go through OpenVPN interface (tun0).

I have been trying to look for answers in regards to this issue. Part of the problem is that I only want this server to behave this way. Other hosts on my network can continue to access the Internet through the normal WAN interface (eth1.2).

I hope I'm succinct in my description. My network knowledge is rather limited. I appreciate any tutorial or advice on how to achieve this, or if it is even possible?

Halcyon

Posted 2018-05-12T14:35:20.093

Reputation: 23

No answers