Please, describe the problem here and provide additional information below (if applicable) …
I’ve tried to add a static routing to the Context of VM template or directly pre-defined in the context of virtual networks. But neither of them has worked.
After the VM has been created, the IP addresses and Default gateway have all become effective, but not the predefined static routing.
In the context of VM template or context of Virtual Networks, I’ve tried different ways to define the static routing.
EXTRA_ROUTING 10.0.100.0/24 via 10.0.1.1
EXTRA_ROUTING 10.0.100.0/24, 10.0.1.1
ETH1_ROUTES 10.0.100.0/24 via 10.0.1.1
ETH1_ROUTES 10.0.100.0/24, 10.0.1.1
But none of the above worked.
Could someone let me know how I should add a static routing into the VM template or vnet so that it will be effective automatically after the VM is created?
Thanks very much!
Versions of the related components and OS (frontend, hypervisors, VMs):
OpenNebula 6.10
Specifically the “ETHx_ROUTES” parameter on the template, that should be similar to this: <dst_network2> via <gateway1>, <dst_network2> via <gateway2>
And the values on ETH1_ROUTES=“10.0.100.0/24 via 10.0.1.1”
If you still have issues specificying the static routes, feel free to comment here.
Hi Daniel,
Thanks very much for your tips! In both context.sh and vm template CONTEXT, I don’t see this ETH1_ROUTES.
After checking it again, I’ve found the issue.
Previously, I’ve only added the attributes ETH1_ROUTES while defining the CUSTOM Attributes in Virtual Networks as shown below.
VIRTUAL NETWORK TEMPLATE
BRIDGE=“onebr.2928”
BRIDGE_TYPE=“linux”
CLUSTER=“100”
ETH1_ROUTES=“10.0.100.0/24 via 10.0.1.1”
METHOD=“static”
When I added the NICs into the VM template, I thought that the ETH1_ROUTES defined in the virtual networks will also be taken by the VM template while creating vms. But actually it’s not.
Now, I’ve added the ETH1_ROUTES in the CONTEXT of VM template. And it is now effective!
So I think the correct way to define static routing for VMs is to add ETHX_ROUTES in the CONTEXT of VM template, instead of the CUSTOM Attributes of Virtual Networks.
Do I understand it correctly?
If yes, may I ask why the ETHX_ROUTES defined in the Virtual Networks doesn’t take effective? It would also be logical to define the static routing while defining a certain virtual network, isn’t it?
If yes, may I ask why the ETHX_ROUTES defined in the Virtual Networks doesn’t take effective? It would also be logical to define the static routing while defining a certain virtual network, isn’t it?
The static routes were added as a context feature. The ability to generate VM context configuration based on the virtual network configuration is part of the OpenNebula core functionality. If you’d like to see this included in said generation, please open a request.