SUSE Conversations


SLES 10 SP2 Xen Network Script



By: gldavis

July 3, 2008 2:19 pm

Reads:155

Comments:4

Rating:0

License:
Free

Download my-network-script3

In SLES 10 SP2, the network configuration has changed a bit. For example, the default bridge now just uses “eth0” rather than “xenbr0”. Also some enhancements have been made to virt-manager to allow the user to add network cards more easily.

First before you can have your guests access multiple network cards you must have multiple bridges setup on your Xen host server. By default it will only setup “eth0”. The script in this cool solution will automatically setup all network cards on the host for use with your xen guests.

Pre-requisite:

Setup the networking on each card as you would in a normal setup. Do this while booted to the regular kernel (non-Xen). You can setup public and private networks as you would in any other normal non-Xen setup.

Now implement the “my-network-script3” script to enable each NIC as a xen bridge. You can do this in Xen or regular, but if doing it while in Xen you will need to restart xend aftwards.

Steps:

  1. Copy my-network-script3 to /etc/xen/scripts
  2. Chmod my-network-script3 IE. chmod 755 /etc/xen/scripts/my-network-script3
  3. Edit the /etc/xen/xend-config.sxp
    Comment out (network-script network-bridge)
    Replace with (network-script my-network-script3)
  4. Restart xend (if booted to Xen) IE. rcxend restart

You are finished. You should now be able to create new vms and add multiple network bridges to them. For example NIC1 add “eth0” and NIC2 add “eth1”

Contents of “my-network-script3”

#!/bin/sh  
# This is for SLES10 SP2 host , it won't work on previous versions
# Xen Network script wrapper - detects all bound nics and binds them to xen bridges
# Based on widely used my-network-script. 
# Set default values of amount of cards to check, for example check eth0 to eth16
nicstart=0
nicend=16

dir=$(dirname "$0")

while ! [ $nicstart -gt $nicend ];

do
# if card is bound to an ipaddress, add a bridge
cardexist=`ifconfig | grep -m 1 eth$nicstart | awk '{ print $1 }' `

	if test $cardexist
	then
	"$dir/network-bridge" "$@" netdev=eth$nicstart
	fi
       
     
nicstart=$(($nicstart+1))
done

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)


Categories: Free Tools, Technical Solutions

4 Comments

  1. By:Anonymous

    you may need to run dos2unix {filename} to get it to run.

    Ayo Adaramola

  2. By:gldavis

    This is the first response I have seen of it not working. Did you do a fresh install of sles10sp2 or did you do an upgrade? Are the network cards bound to Ip addresses as shown in yast2 network? Double check you have run the instructions exactly and try rebooting the box.

  3. By:tutech

    I tried this script today and Adaramola seems to be right. The script worked not before doing “dos2unix my-network-script3″. After that it works as expected.

    greetings Thomas

  4. By:Nickskall

    I also tried to use this Script but after i used the script and change the VM to a second nic the vm wasn’t reachable it seemed to be a capsuled vm.

    Greetings Nick

Comment

RSS