Static route not applied


#1

Hello,
I have got connected OpenWrt device on my turris_vpn.
I need to add static routes towards this VPN host for networks which are behind this tunnel.
Host in the tunnel has static address 192.168.100.18

Which is reachable from the router / also from the local network.
But route towards networks 192.168.6.0/24 ,192.168.5.0/24, 192.168.7.0/24 is going by default to the provider, not towards the tunnel.

This is my static routes config.
/etc/config/network

config route
option target ‘192.168.6.0’
option netmask ‘255.255.255.0’
option gateway ‘192.168.100.18’
option interface ‘vpn_turris’

config route
option target ‘192.168.5.0’
option netmask ‘255.255.255.0’
option gateway ‘192.168.100.18’
option interface ‘vpn_turris’

config route
option target ‘192.168.7.0’
option netmask ‘255.255.255.0’
option gateway ‘192.168.100.18’
option interface ‘vpn_turris’

But it is missing in routing table:

root@Turris:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 10.152.220.1 0.0.0.0 UG 0 0 0 eth1
10.152.220.0 * 255.255.255.0 U 0 0 0 eth1
10.152.220.1 * 255.255.255.255 UH 0 0 0 eth1
192.168.10.0 * 255.255.255.0 U 0 0 0 br-lan
192.168.100.0 192.168.100.2 255.255.255.0 UG 0 0 0 tun_turris
192.168.100.2 * 255.255.255.255 UH 0 0 0 tun_turris

///////////////////////////////////////////////////////////////////////////////////////////////////////
Routing table and ifconfig from remote host

tun_turris Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:192.168.100.18 P-t-P:192.168.100.17 Mask:255.255.255.255
inet6 addr: fe80::9530:ef29:f7c6:92f0/64 Scope:Link
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:3979 errors:0 dropped:0 overruns:0 frame:0
TX packets:4707 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:364420 (355.8 KiB) TX bytes:929326 (907.5 KiB)

Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.6.66 0.0.0.0 UG 0 0 0 br-lan
192.168.6.0 * 255.255.255.0 U 0 0 0 br-lan
192.168.10.0 192.168.100.17 255.255.255.0 UG 0 0 0 tun_turris
192.168.100.1 192.168.100.17 255.255.255.255 UGH 0 0 0 tun_turris
192.168.100.17 * 255.255.255.255 UH 0 0 0 tun_turris

What should be wrong?


#3

According to the upstream documentation the syntax and understanding seems correct.

Yet I faced the same trouble until skipping the subnet mask four 8-bit octets and instead

config route
	option interface 'foobar'
	option target 'ip/24'
	option gateway 'ip'

Not sure whether it is a bug or by design and latter not having made into the documentation. It might be that the ipv4 netmask for the target network receives the same parsing as ipv6, i.e not as four 8-bit octets but its equivalent integer. Though the upstream documentation clearly states otherwise.