Adding a specific route to the routing table at Host OS

Hello All,

I hope someone can help me on this one.
My setup uses a BalenaFin and the ethernet is provided through a Moxa device (modbus I/O).
Wifi is also there.

However, for the situation in which internet is not available (for any reason), I would like communication to the specific IP of the Moxa device be driven over a specific interface. Normally you would do this by adding in the route table the IP address and Iface.

By doing this manually on the terminal Host OS, it works great and the device works in all situations.
route add -host dev eth0

However, I simply have not found a way to set up this route at runtime or boot automatically.
Anyone with a point here?

Thanks to all!

Hi. Yes you can do that at runtime by using the NetworkManager API or (much easier) edit your network profile that you can find in the boot partition under system-connections/* and add the desired routes there.

You’re interested in the ipv4 block of the profile. Here is an example block that will always route 1.2.3.4 though the connection defined:

[ipv4]
method=auto
route1=1.2.3.4/32

Hey thanks!

That was easier than expected. I was looking at other over complicated alternatives.