Virtual Network Definition File 3.0

This page describes how to define a new Virtual Network template. A Virtual Network template follows the same syntax as the VM template.

If you want to learn more about the Virtual Network management, you can do so here.

inlinetoc

Common Attributes

There are two types of Virtual Networks, ranged and fixed. Their only difference is how the leases are defined in the template.

These are the common attributes for both types of VNets:

Attribute Value Description Mandatory
NAME String Name of the Virtual Network YES
BRIDGE String Name of the physical bridge in the physical host where the VM should connect its network interface YES
PUBLIC YES/NO Public scope of the image. If set to YES, the Virtual Network can be used by any user in the VNet's group. If omitted, the default value is NO NO
TYPE RANGED/FIXED Type of this VNet YES

Please note that any arbitrary value can be set in the Virtual Network template, and then used in the contextulization section of the VM. For instance, NETWORK_GATEWAY=“x.x.x.x” might be used to define the Virtual Network, and then used in the context section of the VM to configure its network to connect through the GATEWAY.

Leases

A lease is a definition of an IP-MAC pair. From an IP address, OpenNebula generates an associated MAC using the following rule: MAC = MAC_PREFFIX:IP. All Virtual Networks share a default value for the MAC_PREFIX, set in the oned.conf file.

So, for example, from IP 10.0.0.1 and MAC_PREFFIX 02:00, we get 02:00:0a:00:00:01.

The available leases for new VNets are defined differently for each type.

Fixed Virtual Networks

Fixed VNets need a series of LEASES vector attributes, defined with the following sub-attributes:

Sub-Attribute Value Description Mandatory
IP IP address IP for this lease YES
MAC MAC address MAC associated to this IP NO

:!: The optional MAC attribute will overwrite the default MAC_PREFIX:IP rule. Be aware that this will break the default contextualization mechanism.

Ranged Virtual Networks

Attribute Value Description Mandatory
NETWORK_ADDRESS IP address Base network address to generate IP addresses. YES
NETWORK_SIZE B, C, or Number Number of VMs that can be connected using this network. It can be defined either using a number or a network class (B or C). The default value for the network size can be found in oned.conf. NO

Examples

Sample fixed VNet:

NAME    = "Blue LAN"
TYPE    = FIXED
 
# We have to bind this network to ''virbr1'' for Internet Access
BRIDGE  = vbr1
 
LEASES  = [IP=130.10.0.1]
LEASES  = [IP=130.10.0.2, MAC=50:20:20:20:20:21]
LEASES  = [IP=130.10.0.3]
LEASES  = [IP=130.10.0.4]
 
# Custom Attributes to be used in Context
GATEWAY = 130.10.0.1
DNS     = 130.10.0.1
 
LOAD_BALANCER = 130.10.0.4

Sample ranged VNet:

NAME    = "Red LAN"
TYPE    = RANGED
 
# This vnet can be only used by the owner user
PUBLIC  = NO
 
# Now we'll use the host private network (physical)
BRIDGE  = vbr0
 
NETWORK_SIZE    = C
NETWORK_ADDRESS = 192.168.0.0
 
# Custom Attributes to be used in Context
GATEWAY = 192.168.0.1
DNS     = 192.168.0.1
 
LOAD_BALANCER = 192.168.0.3