Hello, I just setup a Xen server and wanted to use bond0 for my network connection. I ended up downloading and addeding the attatched file and making the following change in /etc/xen/xend-config.sxp. I added this line: (network-script 'network-bond netdev=bond0') Would this line be a good one to add to the commented lines and include the network-bond file in the scripts? Just thought this might save someone else some trouble. Perhaps its already fixed in lenny or sid. Thanks for a great product. -- respectfully, ------------------------------------- | Joseph | IT | ------------------------------------- -------------- next part -------------- #!/bin/bash # # # # Usage: transfer_addrs src dst # Copy all IP addresses (including aliases) from device $src to device $dst. transfer_addrs () { local src=$1 local dst=$2 # Don't bother if $dst already has IP addresses. if ip addr show dev ${dst} | egrep -q '^ *inet ' ; then return fi # Address lines start with 'inet' and have the device in them. # Replace 'inet' with 'ip addr add' and change the device name $src # to 'dev $src'. ip addr show dev ${src} | egrep '^ *inet ' | sed -e " s/inet/ip addr add/ s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@ s/${src}/dev ${dst}/ " | sh -e # Remove automatic routes on destination device ip route list | sed -ne " /dev ${dst}\( \|$\)/ { s/^/ip route del / p }" | bash } transfer_mac () { local src=$1 local dst=$2 src_mac=`ip addr show dev $src | egrep '^ *link/ether ' | awk '{print $2}'` ip link set $src address fe:ff:ff:ff:ff:ff ip link set $dst address $src_mac } # Usage: transfer_routes src dst # Get all IP routes to device $src, delete them, and # add the same routes to device $dst. # The original routes have to be deleted, otherwise adding them # for $dst fails (duplicate routes). transfer_routes () { local src=$1 local dst=$2 # List all routes and grep the ones with $src in. # Stick 'ip route del' on the front to delete. # Change $src to $dst and use 'ip route add' to add. ip route list | sed -ne " /dev ${src}\( \|$\)/ { h s/^/ip route del / P g s/${src}/${dst}/ s/^/ip route add / P d }" | bash } # Usage: create_bridge bridge create_bridge () { local bridge=$1 # Don't create the bridge if it already exists. if ! brctl show | grep -q ${bridge} ; then brctl addbr ${bridge} brctl stp ${bridge} off brctl setfd ${bridge} 0 fi ip link set ${bridge} arp off ip link set ${bridge} multicast off ip link set ${bridge} up } # Usage: add_to_bridge bridge dev add_to_bridge () { local bridge=$1 local dev=$2 # Don't add $dev to $bridge if it's already on a bridge. if ! brctl show | grep -q ${dev} ; then brctl addif ${bridge} ${dev} fi } # adds $dev to $bridge but waits for $dev to be in running state first add_to_bridge2() { local bridge=$1 local dev=$2 local maxtries=10 echo -n "Waiting for ${dev} to negotiate link." for i in `seq ${maxtries}` ; do if ifconfig ${dev} | grep -q RUNNING ; then break else echo -n '.' sleep 1 fi done if [ ${i} -eq ${maxtries} ] ; then echo '(link isnt in running state)' ; fi add_to_bridge ${bridge} ${dev} } # Usage: show_status dev bridge # Print ifconfig and routes. show_status () { local dev=$1 local bridge=$2 echo '============================================================' ip addr show ${dev} ip addr show ${bridge} echo ' ' brctl show ${bridge} echo ' ' ip route list echo ' ' route -n echo '============================================================' } op_start () { create_bridge xenbr0 add_to_bridge xenbr0 vif0.0 add_to_bridge xenbr0 bond0 transfer_mac bond0 veth0 ip link set veth0 up ip link set vif0.0 up transfer_addrs bond0 veth0 sleep 3 transfer_routes bond0 veth0 } op_stop () { transfer_routes veth0 bond0 transfer_addrs veth0 bond0 ip link set veth0 down ip link set bond0 down transfer_mac veth0 bond0 ip link set vif0.0 down ip link set xenbr0 down brctl delbr xenbr0 ip link set bond0 up } case "${1}" in start) op_start ;; stop) op_stop ;; status) show_status ${netdev} ${bridge} ;; *) echo "Unknown command: ${1}" >&2 echo 'Valid commands are: start, stop, status' >&2 exit 1 esac -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.alioth.debian.org/pipermail/pkg-xen-devel/attachments/20080414/662cc245/attachment.pgp