How to make /etc/sysconfig/network/route-eth0 static

You need to create an action and link it to the static-routes-save event.
Here’s an example (adjust GATEWAY_VM and/or ethX) of what to write in /etc/e-smith/events/actions/ovh-route

#!/bin/sh

GATEWAY_VM=1.2.3.4

cat <<EOF >>/etc/sysconfig/network-scripts/route-eth0
$GATEWAY_VM dev eth0
default via $GATEWAY_VM dev eth0
EOF

Then link the action:
ln -sf ../actions/ovh-route /etc/e-smith/events/static-routes-save/S33ovh-route

If someone has an idea on how to integrate this “strange” setup in the default NethServer configuration, I’ll try to create a patch.

7 Likes