Virtual Network Template

This page describes how to define a new Virtual Network. A Virtual Network includes three different aspects:

  • Physical network attributes.
  • Address Range.
  • Configuration attributes for the guests.

When writing a Virtual Network template in a file, it follows the same syntax as the VM template.

Physical Network Attributes

These define the underlying networking infrastructure that will support the Virtual Network, such as the VLAN ID or the hypervisor interface to bind the Virtual Network to.

AttributeDescriptionValueMandatoryDrivers
NAMEName of the Virtual Network.StringYESAll
VN_MADThe network driver to implement the network.802.1Q
fw
ovswitch
vxlan
dummy
YESAll
BRIDGEDevice to attach the Virtual Machines to,
depending on the network driver it may refer to
different technologies or require Host setups.
StringYES for dummy, ovswitch and fwdummy
802.1Q
vxlan
ovswitch
fw
VLAN_IDIdentifier for the VLAN.IntegerYES unless
AUTOMATIC_VLAN_ID for 802.1Q
802.1Q
vxlan
ovswitch
AUTOMATIC_VLAN_IDIf set to YES, OpenNebula will generate a VLAN ID
automatically if VLAN_ID is not defined.
Mandatory YES for 802.1Q if VLAN_ID is not
defined, optional otherwise.
StringYES unless VLAN_ID
for 802.1Q
802.1Q
vxlan
ovswitch
PHYDEVName of the physical network device that will be
attached to the bridge.
StringYES

802.1Q
vxlan

Quality of Service Attributes

This set of attributes limit the bandwidth of each NIC attached to the Virtual Network. Note that the limits are applied to each NIC individually and are not averaged over all the NICs (e.g., a VM with two interfaces in the same network).

AttributeDescriptionDrivers
INBOUND_AVG_BWAverage bitrate for the interface in kilobytes/second for inbound traffic.All
INBOUND_PEAK_BWMaximum bitrate for the interface in kilobytes/second for inbound traffic.All
INBOUND_PEAK_KBData that can be transmitted at peak speed in kilobytes.All
OUTBOUND_AVG_BWAverage bitrate for the interface in kilobytes/second for outbound traffic.All except ovswitch
OUTBOUND_PEAK_BWMaximum bitrate for the interface in kilobytes/second for outbound traffic.All except ovswitch
OUTBOUND_PEAK_KBData that can be transmitted at peak speed in kilobytes.All except ovswitch

The Address Range

IPv4 Address Range

AttributeDescriptionMandatory
TYPEIP4YES
IPFirst IP in the range in dot notation.YES
MACFirst MAC, if not provided it will be
generated using the IP and the MAC_PREFIX
in oned.conf.
NO
SIZENumber of addresses in this range.YES

IPv6 Address Range

AttributeDescriptionMandatory
TYPEIP6YES
MACFirst MAC, if not provided it will be generated.NO
GLOBAL_PREFIXA /64 globally routable prefix.NO
ULA_PREFIXA /64 unique local address (ULA)
prefix corresponding to the fd00::/8 block.
NO
SIZENumber of addresses in this range.YES

IPv6 Address Range (no-SLAAC)

AttributeDescriptionMandatory
TYPEIP6_STATICYES
MACFirst MAC, if not provided it will be generated.NO
IP6First IP6 (full 128 bits) in the range .YES
PREFIX_LENGTHLength of the prefix to configure VM interfaces.YES
SIZENumber of addresses in this range. If not provided
it will be computed from PREFIX_LENGTH
NO

Dual IPv4-IPv6 Address Range

For the IPv6 SLAAC version the following attributes are supported:

AttributeDescriptionMandatory
TYPEIP4_6YES
IPFirst IPv4 in the range in dot notation.YES
MACFirst MAC, if not provided it will be
generated using the IP and the MAC_PREFIX
in oned.conf.
NO
GLOBAL_PREFIXA /64 globally routable prefix.NO
ULA_PREFIXA /64 unique local address (ULA)
prefix corresponding to the fd00::/8 block
NO
SIZENumber of addresses in this range.YES

The no-SLAAC IPv6 version supports the following attributes:

AttributeDescriptionMandatory
TYPEIP4_6_STATICYES
IPFirst IPv4 in the range in dot notation.YES
MACFirst MAC, if not provided it will be
generated using the IP and the MAC_PREFIX
in oned.conf.
NO
IP6First IP6 (full 128 bits) in the range.YES
PREFIX_LENGTHLength of the prefix to configure VM interfaces.YES
SIZENumber of addresses in this range. If not provided
it will be computed from PREFIX_LENGTH
NO

Ethernet Address Range

AttributeDescriptionMandatory
TYPEETHERYES
MACFirst MAC, if not provided it will be
generated randomly.
NO
SIZENumber of addresses in this range.YES

Contextualization Attributes

AttributeDescription
NETWORK_ADDRESSBase network address.
NETWORK_MASKNetwork mask.
GATEWAYDefault gateway for the network.
GATEWAY6IPv6 router for this network.
DNSDNS servers, a space separated list of servers.
GUEST_MTUSets the MTU for the NICs in this network.
METRICRoute metric for default IPv4 gateway.
IP6_METRICRoute metric for default IPv6 gateway.
METHODSets IPv4 guest conf. method for NIC in this network.
IP6_METHODSets IPv6 guest conf. method for NIC in this network.
SEARCH_DOMAINDefault search domains for DNS resolution.

These attributes can be set in the (in order of precedence): VM Template NIC section, Address Range (AR), and Virtual Network Template.

Interface Creation Options

For 802.1Q, VXLAN and Open vSwitch drivers you can specify parameters in the VNET template. Option can be overridden or added per network.

AttributeDescription
CONFDriver configuration options.
BRIDGE_CONFParameters for Linux bridge creation.
OVS_BRIDGE_CONFParameters for Open vSwitch bridge creation.
IP_LINK_CONFParameters for link creation.
CONF="vxlan_mc=239.0.100.0,test=false,validate_vlan_id=true"
BRIDGE_CONF="sethello=6"
OVS_BRIDGE_CONF="stp_enable=true"
IP_LINK_CONF="tos=10,udpcsum=,udp6zerocsumrx=__delete__"

Options can have an empty value when they don’t need a parameter. Also, the special value “_delete_” can be used to delete parameters set here.

You can find more information about these parameters in 802.1Q and VXLAN documentation.

Virtual Network Definition Examples

Sample IPv4 VNet:

# Configuration attributes (dummy driver)
NAME        = "Private Network"
DESCRIPTION = "A private network for VM inter-communication"

BRIDGE = "bond-br0"

# Context attributes
NETWORK_ADDRESS = "10.0.0.0"
NETWORK_MASK    = "255.255.255.0"
DNS             = "10.0.0.1"
GATEWAY         = "10.0.0.1"

#Address Ranges, only these addresses will be assigned to the VMs
AR=[TYPE = "IP4", IP = "10.0.0.10", SIZE = "100" ]

AR=[TYPE = "IP4", IP = "10.0.0.200", SIZE = "10" ]

Sample IPv4 VNet, using AR of just one IP:

# Configuration attributes (OpenvSwitch driver)
NAME        = "Public"
DESCRIPTION = "Network with public IPs"

BRIDGE  = "br1"
VLAN    = "YES"
VLAN_ID = 12

DNS           = "8.8.8.8"
GATEWAY       = "130.56.23.1"
LOAD_BALANCER = 130.56.23.2

AR=[ TYPE = "IP4", IP = "130.56.23.2", SIZE = "1"]
AR=[ TYPE = "IP4", IP = "130.56.23.34", SIZE = "1"]
AR=[ TYPE = "IP4", IP = "130.56.23.24", SIZE = "1"]
AR=[ TYPE = "IP4", IP = "130.56.23.17", MAC= "50:20:20:20:20:21", SIZE = "1"]
AR=[ TYPE = "IP4", IP = "130.56.23.12", SIZE = "1"]