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.

Attribute Description Value Mandatory Drivers
NAME Name of the Virtual Network. String YES All
VN_MAD The network driver to implement the network. 802.1Q
fw
ovswitch
vxlan
dummy
YES All
BRIDGE Device to attach the Virtual Machines to,
depending on the network driver it may refer to
different technologies or require Host setups.
String YES for dummy, ovswitch and fw dummy
802.1Q
vxlan
ovswitch
fw
VLAN_ID Identifier for the VLAN. Integer YES unless
AUTOMATIC_VLAN_ID for 802.1Q
802.1Q
vxlan
ovswitch
AUTOMATIC_VLAN_ID If 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.
String YES unless VLAN_ID
for 802.1Q
802.1Q
vxlan
ovswitch
PHYDEV Name of the physical network device that will be
attached to the bridge.
String YES

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).

Attribute Description Drivers
INBOUND_AVG_BW Average bitrate for the interface in kilobytes/second for inbound traffic. All
INBOUND_PEAK_BW Maximum bitrate for the interface in kilobytes/second for inbound traffic. All
INBOUND_PEAK_KB Data that can be transmitted at peak speed in kilobytes. All
OUTBOUND_AVG_BW Average bitrate for the interface in kilobytes/second for outbound traffic. All except ovswitch
OUTBOUND_PEAK_BW Maximum bitrate for the interface in kilobytes/second for outbound traffic. All except ovswitch
OUTBOUND_PEAK_KB Data that can be transmitted at peak speed in kilobytes. All except ovswitch

The Address Range

IPv4 Address Range

Attribute Description Mandatory
TYPE IP4 YES
IP First IP in the range in dot notation. YES
MAC First MAC, if not provided it will be
generated using the IP and the MAC_PREFIX
in oned.conf.
NO
SIZE Number of addresses in this range. YES

IPv6 Address Range

Attribute Description Mandatory
TYPE IP6 YES
MAC First MAC, if not provided it will be generated. NO
GLOBAL_PREFIX A /64 globally routable prefix. NO
ULA_PREFIX A /64 unique local address (ULA)
prefix corresponding to the fd00::/8 block.
NO
SIZE Number of addresses in this range. YES

IPv6 Address Range (no-SLAAC)

Attribute Description Mandatory
TYPE IP6_STATIC YES
MAC First MAC, if not provided it will be generated. NO
IP6 First IP6 (full 128 bits) in the range . YES
PREFIX_LENGTH Length of the prefix to configure VM interfaces. YES
SIZE Number 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:

Attribute Description Mandatory
TYPE IP4_6 YES
IP First IPv4 in the range in dot notation. YES
MAC First MAC, if not provided it will be
generated using the IP and the MAC_PREFIX
in oned.conf.
NO
GLOBAL_PREFIX A /64 globally routable prefix. NO
ULA_PREFIX A /64 unique local address (ULA)
prefix corresponding to the fd00::/8 block
NO
SIZE Number of addresses in this range. YES

The no-SLAAC IPv6 version supports the following attributes:

Attribute Description Mandatory
TYPE IP4_6_STATIC YES
IP First IPv4 in the range in dot notation. YES
MAC First MAC, if not provided it will be
generated using the IP and the MAC_PREFIX
in oned.conf.
NO
IP6 First IP6 (full 128 bits) in the range. YES
PREFIX_LENGTH Length of the prefix to configure VM interfaces. YES
SIZE Number of addresses in this range. If not provided
it will be computed from PREFIX_LENGTH
NO

Ethernet Address Range

Attribute Description Mandatory
TYPE ETHER YES
MAC First MAC, if not provided it will be
generated randomly.
NO
SIZE Number of addresses in this range. YES

Contextualization Attributes

Attribute Description
NETWORK_ADDRESS Base network address.
NETWORK_MASK Network mask. Needs to follow dot notation (“255.255.255.0”).
GATEWAY Default gateway for the network.
GATEWAY6 IPv6 router for this network.
DNS DNS servers, a space separated list of servers.
GUEST_MTU Sets the MTU for the NICs in this network.
METRIC Route metric for default IPv4 gateway.
IP6_METRIC Route metric for default IPv6 gateway.
METHOD Sets IPv4 guest conf. method for NIC in this network.
IP6_METHOD Sets IPv6 guest conf. method for NIC in this network.
SEARCH_DOMAIN Default search domains for DNS resolution.
ROUTES List of custom (static) routes for this network/AR

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.

Attribute Description
CONF Driver configuration options.
BRIDGE_CONF Parameters for Linux bridge creation.
OVS_BRIDGE_CONF Parameters for Open vSwitch bridge creation.
IP_LINK_CONF Parameters 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",  ROUTES = "130.56.24.0/24 via 130.56.23.1, 192.168.1.0/24 via 130.56.23.2"]