#!/bin/bash
# next two lines were good for xen-3.2.1 not for xen-4.0x anymore
#/etc/xen/scripts/network-bridge netdev=eth0 bridge=xenbr0 start
#/etc/xen/scripts/network-bridge netdev=eth1 bridge=xenbr1 start
# this works for xen-4.0x
# xen-utils-common in squeeze don't produce this script (yet) which is needed
# if you want to bind a NIC in domU to another interface in dom0 (bridging mode) than:
# 1.) list all dom0 interfaces you want to be able to use (except your eth0!) in "more_bridges" below
# 2.) in the domU config use: vif = [ 'mac=00:16:3e:xx:xx:xx, bridge=ethX' ] with ethX being the original device of dom0 that this domU should use
# 3.) using bridging, all interfaces in dom0 that you want to use have to be valid configured BEFORE you run this script, i.e. before starting xend the first time.
# (use ping -I ethX <target your gateway> to CHECK THAT BEFORE, and don't blame me if u plugged the cable into the wrong nic port ;-)
# 4.) remember, in the background xen does move the link to another name, creates a new interface etc etc... we don't care about this here, it just works fine for now
# here I want to prepare to other nics that I can choose from in the domU configs
more_bridges="eth1 eth2"
for i in $more_bridges; do
ip addr show dev $i | egrep inet > /dev/null 2>&1
if [ $? == 0 ];then
ip link set $i down
/etc/xen/scripts/network-bridge netdev=$i start
ip link set $i up
else
echo -e "/nFailed to set up a bridge!/nYour device $i in dom0 seems not to be configured, so I won't try to use it as part of a bridge for any domU/n"
fi
done
版权声明:本文为博主原创文章,未经博主允许不得转载。