Oh, it drives me crazy. I am truing to replicate my configuration from scratch, but for some reason it doesnât work anymore.
Can you explain to me what does it exactly do? What does this uci set network.lan.ip4table="10" line do? Does network.lan correspond to my lan interface? And I assume that lan interface is the interface connected to vpn server.
I tried and tried but, I can get it woking using uci set network.wg.ip4table="10" uci set network.wg.ip6table="10" uci set network.lan.ip4table="10" uci set network.lan.ip6table="10" uci commit network service network restart
probably I was connected to wifi, and I got confused.
Could you please tell me how to run following commands at startup? ip route add default via 10.10.1.1 table 10, ip rule add from 192.168.1.187 table 10
uci set network.route1="route"
uci set network.route1.target="0.0.0.0/0"
uci set network.route1.gateway="10.10.1.1"
uci set network.route1.table="100"
uci set network.rule1="rule"
uci set network.rule1.src="192.168.1.187"
uci set network.rule1.lookup="100"
uci commit network
/etc/init.d/network restart
I think, vgaetera's answer it too complicated. I answer much simpler.
You should add 'route' and 'rule' in /etc/config/network Add sections and see, what happens with routing table. vgaetera gave you uci-commands, I think, it is too complicated. In any case result of uci-commands is modifying of /etc/config/network I recommend you modify it by hands.
Note, that /etc/rc.local doesn't interact with network service properly, so any sort of race condition as well as network interface or service restart will break the configuration.
The only way to exclude it is to override the current configuration with another route or rule.
Try to use 'filter' by 'network', not by 'ip': https://openwrt.org/docs/guide-user/network/ip_rules
config rule
option in 'lan'
option lookup '10'
Also it could be done via command, but I don't know, how to specify interface in OpenWRT-implementation (iif maybe, but it is device, not name of interface).