OpenNebula / addon-context-linux

Linux VM Contextualization
Apache License 2.0
56 stars 73 forks source link

Option to add static routes to the network contextualization #277

Closed atodorov-storpool closed 1 year ago

atodorov-storpool commented 1 year ago

It is relatively common practice to have additional static routes to internal private networks that differ from the default gateway without defining a virtual router setup.

The static routes could be defined as a comma-separated list in a custom contextualization variable, and the contextualization could append them to route-\<iface>

For example ETH0_STATIC_ROUTES=1.2.3.4/24 via 2.3.4.5 dev eth0,5.6.7.8/22 via 2.3.4.5 dev eth0 could lead to /etc/sysconfig/network-scripts/route-eth0 containing

1.2.3.4/24 via 2.3.4.5 dev eth0
5.6.7.8/22 via 2.3.4.5 dev eth0

edit: escape \< and >

baby-gnu commented 1 year ago

I think the dev eth0 should be automatically added since the device name could be something else.