[Solved] [VirtualMachineAllocate] Cannot get IP/MAC lease from virtual network 1

Hi,

My vnet config file is the following:

NAME = "Interconnect Network"
DESCRIPTION = "Interconnect network for internal communication"
VN_MAD = "802.1Q"
TYPE = FIXED
PHYDEV = "eth0"
VLAN = "no"
BRIDGE = "interconnect"
LEASES = [ IP = 192.168.100.3 ]

My host template is the following:
NAME = vdicdb01
CPU = 1
MEMORY = 512
VCPU = 1

DISK = [ IMAGE_ID = 7 ]

NIC = [ NETWORK = “blue”,
NETWORK_ID = 1,
IP = 192.168.100.3,
MODEL = “virtio” ]

GRAPHICS = [
type = spice,
listen = 0.0.0.0,
port = 1 ]

But when I try to create the vm from image:
onevm create vdic-vdicsql01.templ

I get the following error:
[VirtualMachineAllocate] Cannot get IP/MAC lease from virtual network 1.

Have anyone hat the same behaviour?

Thanks a lot in advance

Hi Oscar!
I’d recommend you to have a look at the docs to know more about virtual networks. I think there’s something wrong with your virtual network configuration, that TYPE=FIXED looks suspicious to me!.

Have you created your virtual network by hand using a file and imported it? Can you run the following command as the oneadmin user ?:

onevnet show vnet_id -x (Where vnet_id is the numeric ID of your virtual network in OpenNebula)

What OpenNebula version are you running?

Though not related with your network error, you also have chosen port=1 for the spice graphics section… that will be a problem too when you try to open the VNC/SPICE console as you’re saying that spice will be listening on TCP port number 1, I’d recommend you to leave that port unset, OpenNebula will use a port for each VM starting from 5900 TCP onwards…but first you must fix your virtual network issue :wink:

Cheers!

Hi Miguel,

Yes, I have created my virtual network by hand and I have launched onevnet create “file”

Related to TYPE=FIXED, I have got that idea from:
https://archives.opennebula.org/documentation:archives:rel3.2:vnet_template

Because in the documentation there is no examplanation about how to fix a single IP for that template. In my case I just want to deploy one instance.

Related to your command, you can see the output at http://paste.fedoraproject.org/494327/48053509/

Related to the version, I’m using version 5.2.0

And, related to spice port, I thought that system will add my number to 5900, it is, setting it to 1 System will open 5901 port. But, no problem, I can change it quickly.

Thanks a lot!

Hi oscar!
as you’re using the latest version of OpenNebula I’ll share with you these links that you may find useful when dealing with networks. Google has many old references to previous versions so try to use the search in the latest docs and use the forum for any doubt you encounter or if you find any missing info you may need.

If you want to create your networks by hand, OpenNebula’s docs have a section dedicated to the attributes used in templates for VMs, networsk and datastores and here’s the one for networks.

If you want OpenNebula to provide IP addresses to your Virtual Machines (your VM needs contextualization scripts to configure IP address provided by OpenNebula) then you need to create address ranges. For example if you want a VM to have specifically one fixed IP address you can define a network and assign an Address Range with only one IP address as explained in the tips section.

Hope this helps you to get started with your OpenNebula installation!

Cheers!

Hi Miguel Angel,

Is it possible OpenNebula to not serve the IPs, just bridge it to the physical bridge I’ve had to create or to the physical bond?

I don’t want OpenNebula to manage the IPs. Is it possible?

Thanks alot.

Hi oscar!,
yes you can :slight_smile:. Quoting the docs you can define a virtual network which uses that bridge and you can assign an Ethernet address range

With Ethernet Address Range, just MAC addresses are generated for the VMs. You should use this AR when an external service is providing the IP addresses, such a DHCP server, see more details here

Cheers!

Hi,

Dou you mean I have to define a valid address range even when the ip address is provided by an external dhcp server?

Thanks a lot

Hi oscar!
if you want a DHCP to serve IP addresses, yes AFAIK you still have to create an Ethernet Address Range in your virtual networks specifying how many MAC addresses are available as VM NICs requires at least those MAC addresses. When you assign a network interface in OpenNebula you specify a network and that network requires a valid Address Range.

Cheers!