Xen下配置多个虚拟网桥以使用多块网卡

Xen下配置多个虚拟网桥以使用多块网卡

来源地址: http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Virtual...

Process to setup multiple Red Hat Virtualization bridges:

  1. Configure another network interface using either the system-config-network application. Alternatively, create a new configuration file named ifcfg-ethX in the /etc/sysconfig/network-scripts/ directory where X is any number not already in use. Below is an example configuration file for a second network interface called eth1
          $ cat /etc/sysconfig/network-scripts/ifcfg-eth1
          DEVICE=eth1
          BOOTPROTO=static
          ONBOOT=yes
          USERCTL=no
          IPV6INIT=no
          PEERDNS=yes
          TYPE=Ethernet
          NETMASK=255.255.255.0
          IPADDR=10.1.1.1
          GATEWAY=10.1.1.254
          ARP=yes
  2. Copy the file, /etc/xen/scripts/network-bridge, to /etc/xen/scripts/network-bridge.xen.
  3. Comment out any existing network scripts in /etc/xen/xend-config.sxp and add the line network-xen-multi-bridge.
  4. Create a custom script to create multiple Red Hat Virtualization network bridges. A sample scripts is below, this example script will create two Red Hat Virtualization bridges (xenbr0 and xenbr1) one will be attached to eth1 and the other one to eth0. If you want to create additional bridges just follow the example in the script and copy/paste the lines accordingly:
          #!/bin/sh
          # network-xen-multi-bridge
          # Exit if anything goes wrong.
          set -e
          # First arg is the operation.
          OP=$1
          shift
          script=/etc/xen/scripts/network-bridge.xen
          case ${OP} in
          start)
          $script start vifnum=1 bridge=xenbr1 netdev=eth1
          $script start vifnum=0 bridge=xenbr0 netdev=eth0
          ;;
          stop)
          $script stop vifnum=1 bridge=xenbr1 netdev=eth1
          $script stop vifnum=0 bridge=xenbr0 netdev=eth0
          ;;
          status)
          $script status vifnum=1 bridge=xenbr1 netdev=eth1
          $script status vifnum=0 bridge=xenbr0 netdev=eth0
          ;;
          *)
          echo 'Unknown command: ' ${OP}
          echo 'Valid commands are: start, stop, status'
          exit 1
          esac

我理解其中第3步就是将xend-config.sxp配置文件中的(network-script network-bridge)替换为(network-script network-xen-multi-bridge),假定将第4步创建的脚本命名为network-xen-multi-bridge。
我在修改配置时,没有写前面的network-script,在重新启动后一个虚拟网桥都没有找到,因为服务器正在使用中,不能频繁重新启动,所以尝试手工执行/etc/xen/scripts/network-xen-multi-bridge start,然后二个虚拟网桥都可以正常工作了。

你可能感兴趣的:(xen)