Adding static routes in alpine linux

There are several ways to do this documented in the alpine linux wiki.

My preferred way is to configure it in /etc/network/interfaces.

For example:

auto eth0
iface eth0 inet static
       up ip route add via
       up ip route add via

Note that you can actually add these lines in a dhcp stanza.

The benefit of doing this is that those routes are added when that interface is brought up.

Also, they are kicked off by the networking init.d file.