Dear ON forums,
I’m a CS student who is very new to OpenNebula and I ran into a problem that seems difficult to me. I downloaded a virtual image of CentOS with OpenNebula 5.2 installed (it’s the sandbox from the official website, this one specifically) and my host is VirtualBox on a Windows 10 machine.
What I’d like to do is create a VM (in ON) that can act as a simple HTTP server and is accessible from the Windows machine. I have successfully setup a Virtual Machine template (using Damn Small Linux, to spare resources) and it works pretty well, however I don’t know how to let VMs connect to the internet. I have tried adding 188.8.131.52 to resolv.conf on the Host machine, but this only allows the host to resolve outside addresses.
Research tells me that I’m somehow supposed to connect the the VMs to my computer through some sort of virtual network set up in OpenNebula, but the possibilities I’ve found were a bit convoluted to me.
How would someone go about configuring such a thing? Can I do this through Sunstone, or do I have to configure interface files?
Thank you in advance
the OpenNebula sandbox appliance is mainly for testing purposes, to see how the Sunstone looks like and how to deploy and interact with very simple VM. Also, the VMs started inside the VirtualBox aren’t hardware accelerated (like the sandbox appliance itself), because the VirtualBox doesn’t support nested virtualization. That means the VMs inside are only hardware emulated and very slooooow. For anything serious, you need your own Linux virtualization host.
The networking inside the sandbox doesn’t allow routing outside, but this can be easily fixed by masquerade (NAT):
- you should add the gateway/DNS information into the virtual network metadata
- click on “Network - Virtual Networks”
- click on cloud network with ID 0
- add new attribute at the bottom, name GATEWAY with value 172.16.100.1
- add new attribute, name DNS with value 184.108.40.206
- login the sandbox console and run following to enable NAT
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
If network interface inside the VM is configured with IP assigned by the OpenNebula and default route via
172.16.100.1, the external services should be working. You can try by
It’s more tricky to access the VMs from outside the sandbox.
One, simple and not very flexible approach, can be
- enable port forwarding between host (W10)/guest(sandbox) in the appliance settings, e.g. for port 8080
- inside the sandbox, route the port 8080 on the IP address and selected port of the VM running inside
The another, more flexible approach, would be
- in the VirtualBox appliance settings, add another network interface configured as “Host-only Adapter”
- in the sandbox console, configure this new interface and create another bridge
- in the OpenNebula, create new virtual network on this bridge
- add this new network also the VM template
Then, VMs should have 2 network cards. First for general public traffic, second for your direct communication with the VMs.
Hope it helps a little.