We tried replace mikrotik devices with TRB140, but we have trouble with source routing over openvpn.
So idea is that default gw is over LTE (rmnet0) and all from LAN interface (eth0) is routed over openvpn TUN interface to our central VPN concentrator to internet. On Mikrotik devices we are using source routing, so we have new TABLE and rules say that when traffic is go from LAN it use gw from openvpn.
On TRB140 I tried make same way, and in WEBUI I can add TABLE and RULE without error, but in CLI when I print routes over “ip route list” I can’t see it.
When I tried add it manually over CLI, I had error.
When I tried it with TUN interface in CLI so it works, it seems, that primary trouble is that WEBUI can’t works with TUN interface in routing setting.
So we can use custom script, but I need know how I can add table and rule from CLI.
When you look for IP routes using ip route list, it works a bit differently because routing operates based on “rules” and “tables.” This means that rules are checked for certain types of traffic, and only then is the routing table applied.
To check IP rules, you should type:
ip rule list
As you can see below, I have added one rule myself. Otherwise, there would only be three rules by default.
You can view the created tables in /etc/config/network under the config route section.
config route ‘3’
option table ‘100’
option netmask ‘0.0.0.0’
option gateway ‘172.33.1.1’
option target ‘0.0.0.0’
option interface ‘lan’ —> I think here must be openvpn interface, no LAN
ip rule list
0: from all lookup local
1: from 172.30.171.0/24 iif eth0 lookup 100
32766: from all lookup main
32767: from all lookup default
ip route list
default dev rmnet0 proto static scope link src 100.122.213.110 metric 1
100.122.213.110 dev rmnet0 proto static scope link metric 1
172.30.171.0/24 dev eth0 proto kernel scope link src 172.30.171.1
172.33.1.0/24 dev tun_c_XXX proto kernel scope link src 172.33.1.45
Is any way how change “option interface ‘lan’” to option interface ‘tun_c_XXX’?
Or how I can do it?
This file is editable, so you can make changes directly in it. However, I recommend using Policy-Based Routing, as it is easier to configure and offers better traceability.