For using the configuration 1, set up the virtual network according to the following procedures.
The virtual network is set for the interface where the default gateway is specified when the operating system is installed (default).
When you want to create more than one virtual bridge, or when you create a virtual bridge for an interface where the default gateway is not specified, set up the virtual network according to the following procedures.
When you create a virtual bridge only for a virtual interface in Virtual NIC mode where the default gateway is specified, this setting is not required.
Create a shell script for creating the virtual bridge.
Information
When using only Virtual NIC mode, you do not need to execute "hanetxen start/stop" because virtual interfaces in Virtual NIC mode are created under the virtual network of the virtual machine function.
The following is a setting example in which the name of the shell script to be created is network-bridge-gls.
In the example below, one virtual network is configured for the virtual interface (sha0).
/etc/xen/scripts/network-bridge-gls
#!/bin/sh # # Sample of Create/Delete virtual bridge # # $1 start : Create virtual bridge # stop : Delete virtual bridge # status: Display virtual bridge information # Exit if anything goes wrong #set -e command=$1 xenscript=/etc/xen/scripts/network-bridge # op_start:subscript for start operation # op_start () { $xenscript $command vifnum=0 netdev=sha0 } # op_stop:subscript for stop operation # op_stop () { # same operation as start op_start } case "$command" in start) # Create your virtual bridge op_start ;; stop) # Delete virtual bridge op_stop ;; status) # display virtual bridge information $xenscript status ;; *) echo "Unknown command: $command" >&2 echo 'Valid commands are: start, stop, status' >&2 exit 1 esac |
Save the created script in "/etc/xen/scripts".
# cp network-bridge-gls /etc/xen/scripts # cd /etc/xen/scripts # chmod +x network-bridge-gls |
Register with the xend service.
Edit the "network-script" parameter in the configuration file (/etc/xen/xend-config.sxp) of the xend service. "network-bridge" is set for the "network-script" parameter. Rename it to the name of the script you created.
# Your default ethernet device is used as the outgoing interface, by default.
# To use a different one (e.g. eth1) use
#
# (network-script 'network-bridge netdev=eth1')
#
# The bridge is named xenbr0, by default. To rename the bridge, use
#
# (network-script 'network-bridge bridge=<name>')
#
# It is possible to use the network-bridge script in more complicated
# scenarios, such as having two outgoing interfaces, with two bridges, and
# two fake interfaces per guest domain. To do things like this, write
# yourself a wrapper script, and call network-bridge from it, as appropriate.
#
(network-script network-bridge-gls) |
Note
If you create five virtual bridges or more, add the following setting in /etc/modprobe.conf. For details, see the RHEL manuals. The following is an example for creating six virtual bridges.
options netloop nloopbacks=6 |