However, while the rule is applied, the routing table remains empty:
root@awr /e/config# ip rule show
0: from all lookup local
1: from all lookup through_vpn
32766: from all lookup main
32767: from all lookup defaul
root@awr /e/config# ip route show table through_vpn
root@awr /e/config#
If it's a numerically-named table, you don't need to define it
Yeah, but I prefer the non-numerical names :-).
I don't see where you add routes to this table.
This is what I thought the "config route" entry in /etc/config/network to do. Am I mistaken?
Try a different table name...i.e. without an underscore
Did not help :-(.
Should be CIDR, so 192.168.1.243/32
Did not help either :-(.
Current configuration is:
root@awr /e/config# tail /etc/config/network
config rule 'throughvpn'
option src '192.168.1.243/32'
option lookup 'custom1'
config route
option interface 'rath'
option gateway '192.168.12.1'
option table 'custom1'
option target '10.2.3.4/24'
root@awr /e/config# tail /etc/iproute2/rt_tables
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
5 custom1
root@awr /e/config# ip rule show
0: from all lookup local
1: from 192.168.1.243 lookup custom1
32766: from all lookup main
32767: from all lookup default
root@awr /e/config# ip route show table custom1
root@awr /e/config# ip -4 ro list table all
default via 100.64.0.1 dev eth0.2 src 100.92.0.228
34.120.255.244 dev eth0.2 scope link src 100.92.0.228
100.64.0.0/10 dev eth0.2 scope link src 100.92.0.228
192.168.1.0/24 dev br-lan scope link src 192.168.1.1
192.168.100.1 dev eth0.2 scope link src 100.92.0.228
broadcast 100.64.0.0 dev eth0.2 table local scope link src 100.92.0.228
local 100.92.0.228 dev eth0.2 table local scope host src 100.92.0.228
broadcast 100.127.255.255 dev eth0.2 table local scope link src 100.92.0.228
broadcast 127.0.0.0 dev lo table local scope link src 127.0.0.1
local 127.0.0.0/8 dev lo table local scope host src 127.0.0.1
local 127.0.0.1 dev lo table local scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local scope link src 127.0.0.1
broadcast 192.168.1.0 dev br-lan table local scope link src 192.168.1.1
local 192.168.1.1 dev br-lan table local scope host src 192.168.1.1
broadcast 192.168.1.255 dev br-lan table local scope link src 192.168.1.1
What I would have expected:
root@awr /e/config# ip route show table custom1
10.2.3.4/24 via 192.168.12.1 dev <something> ....
root@magiatiko:[~]#tail /etc/iproute2/rt_tables
#
# local
#
#1 inr.ruhep
204 elvetias
203 roadwarrior
201 wan
202 proton
203 wwan
220 test
root@magiatiko:[~]#uci show network.test
network.test=interface
network.test.device='eth0'
network.test.proto='static'
network.test.netmask='255.255.255.0'
network.test.ipaddr='192.168.100.1'
uci add network route
uci set network.@route[-1].table='220'
uci set network.@route[-1].netmask='255.255.255.252'
uci set network.@route[-1].target='100.64.64.0'
uci set network.@route[-1].gateway='192.168.100.2'
uci set network.@route[-1].interface='test'
uci add network rule
uci set network.@rule[-1].in='guest'
uci set network.@rule[-1].src='192.168.1.234/32'
uci set network.@rule[-1].lookup='220'
uci commit network
/etc/init.d/network restart
root@magiatiko:[~]#ip -4 ru
0: from all lookup local
1: from 192.168.1.234 iif eth0.2 lookup test
29998: from all fwmark 0x30000/0xff0000 lookup wwan
29999: from all fwmark 0x20000/0xff0000 lookup proton
30000: from all fwmark 0x10000/0xff0000 lookup wan
32766: from all lookup main
32767: from all lookup default
root@magiatiko:[~]#ip -4 ro list table test
100.64.64.0/30 via 192.168.100.2 dev eth0 proto static