New Network Options, Including Limiting Bandwidth and Setting a VLAN ID, for Virtual Network Interfaces Attached to a Guest
VLAN IDs are used to separate each guest domain's network traffic from other guest domains and from dom0. Bandwidth limits define throughput of a communication path.
Both VLAN ID and bandwidth limits can be provided:
- Through virt-install
- Through the XML domU configuration file and virsh attach-interface
- Through the .py domU configuration file and xm network-attach
New conventions for network options are present in virt-install.
virt-install, With new -w/--network Option
The network related options are now grouped into one option, -w or --network. Earlier network options, such as mac=, are now grouped into properties of the -w or --network option. The properties are separated by commas.
For example:
# virt-install ...--network mac=a:b:c:d:e:f,bridge=bge0,vlanid=1,capped-bandwidth=100M \
--network mac=g:h:i:j:k:l,bridge=bge1,vlanid=2,capped-bandwidth=200M...
The four supported properties of the -w or --network option are: 'mac', 'bridge', 'capped-bandwidth' and 'vlanid'. The 'mac' and 'bridge' properties are converted from earlier options. The new 'capped-bandwidth' and 'vlanid' properties were added for specifying the VLAN ID and the bandwidth limit.
The dladm(1M) command and its -v option are leveraged to set the VLAN ID and bandwidth limit for virtual network interfaces of guest domains managed by the hypervisor.
Bandwidth limit is specified as an integer with one of the scale suffixes K, M, or G (for Kbps, Mbps, or Gbps, the same format used in the dladm(1M) command line).
The minimum bandwidth supported is 1.2Mbps.
Providing Bandwidth Limit Information and Setting VLAN ID through virsh
A new option, --capped-bandwidth, has been added to the virsh attach-interface command line syntax. The option is used to provide bandwidth limit information while attaching a new virtual interface to a guest domain:
--capped-bandwidth <bandwidth_string>
where bandwidth_string is an integer with one of the scale suffixes K, M, or G (for Kbps, Mbps, or Gbps, which is the same format used in the dladm command line).
For example:
# virsh attach-interface domu bridge bge0 --capped-bandwidth 100M
Bandwidth can also be specified in XML format configuration file with a new XML elment, 'cappedbandwidth', under 'networkresource' elment, which is also new. Three attributes are set for cappedbandwidth to express the bandwidth limit:
- unit
The supported units are 'gigabit', 'megabit' and 'kilobit'. - period
The supported periods are 'second', 'millisecond' and 'microsecond'. - value
The value is an integer that expresses the amount of data in unit allowed to be transferred in the specified period of time.
The minimum bandwidth supported is 1.2Mbps.
Another new option, --vlanid, has also been added to the virsh attach-interface command line syntax. This option is used to specify the VLAN ID while attaching a new virtual interface to a guest domain:
--vlanid <vid>
For example:
# virsh attach-interface domu bridge bge0 --vlanid 2
VLAN ID can also be specified in an XML format configuration file with a new XML element, vlan, where the attribute is the ID.
The following example shows the usage of the new options:
<interface type='bridge'>
<source bridge='e1000g1'/>
<vlan id='1'/>
<networkresource>
<cappedbandwidth unit='megabit' period='second' value='100'/>
</networkresource>
</interface>