How to set the default gateway for a virtual router

I would like to know how to set the default gateway for a virtual router.
I logged into the router and added a gateway to the /etc/network/interfaces file, but when I reboot it reverts to the original content.


Versions of the related components and OS (frontend, hypervisors, VMs):

OpenNebula 7.0.0

vrouter:~$ cat /etc/os-release
NAME=“Alpine Linux”
ID=alpine
VERSION_ID=3.20.6
PRETTY_NAME=“Alpine Linux v3.20”
HOME_URL=“https://alpinelinux.org/”
BUG_REPORT_URL=“https://gitlab.alpinelinux.org/alpine/aports/-/issues”
vrouter:~$

Steps to reproduce:

Current results:

Expected results:

Manual network configuration in OpenNebula instances will be overriden by the contextualization agent within the VM. You can setup the gateway information in the virtual network configuration backing the Vrouter network interface. You can also set this information directly in the CONTEXT section of the VR VM Template.

I created a virtual router instance and set a GATEWAY in the context and restarted it, but the default gateway did not change.

Do I need to specify it when creating the instance?

I’m currently using SunStone, but when creating an instance I don’t go through the page for setting the context.

I tried setting the context in the template, but it was not reflected in the instance.

You might need to adjust this paramenter if you want to adjust the gateway post VM deployment. By default, after a VM is deployed, the ethx attributes cannot be changed. You need to restart opennebula to have this change active.

Thank you for the information.

I found that when I create a virtual router from the Instances → Virtual Routers menu, I can’t set the context, but when I select a template from Templates → Virtual Routers and instantiate it, I can set the context. Is this a bug on the Instances page?

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