How to add custom routes

I know you can add routes and rules to /etc/config/network, but I need to add a custom rule with sport (ip rule add sport 1194 table 100) and this does not seem to be supported.

For firewall rules this is possible

But I am looking for the best place to add custom routing rules.

Currently I do it with a hotplug script which runs on ifup of lan which is working but I am not sure if this is the best way.
I looked into using a hotplug script in hotplug.d/net but I needed the default gateway and I had trouble getting it from there.

Hence my question what is the best place/way to add custom routes and rules?

If you are not going to make changes in the rules, then /etc/rc.local would be a good place to start.
At some point I vaguely remember some dev mentioning that ports will be added in the uci rules.

Thanks for your suggestion.

Yes ports will be added indeed (it was me asking for it), but until then I am looking for another way :slight_smile:

I tried rc.local and that works until you restart the network (service network restart) so as long as keeping that in mind it is a working solution.

Thanks

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.