WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Network-bridge with VLAN

To: <xen-users@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-users] Network-bridge with VLAN
From: Gael <gael@xxxxxxxxxx>
Date: Thu, 13 Nov 2008 12:28:42 +0000
Delivery-date: Thu, 13 Nov 2008 04:29:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <94e2f00b0811120449s5749c54eu61b84f691b6ff024@xxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AclFi10Cm8k0ILF+Ed2VjAAewguANg==
Thread-topic: [Xen-users] Network-bridge with VLAN
User-agent: Microsoft-Entourage/11.4.0.080122

Thanks a lot for you help, I will try this for our new batch of servers as we did not manage to have VLAN on network bridges we finally decided to manage the VLAN on the switch directly without using trunk ports...
But for our next bunch of servers we will most probably implement bonding + VLAN on the xen hosts.

After reading your script, it seems to me that I did the same but it did not work. I basically create the VLAN at startup then the xen network scripts add the VLAN interface to the bridge...

Well thanks anyway!

Gael


On 12/11/08 12:49, "Alain Barthe" <ab266061@xxxxxxxxx> wrote:

2008/11/6 Gael Reignier <gael@xxxxxxxxxx>

Any help will be much appreciate as this issue starts to drive me crazy
and I do not know where to start looking... so if you spot any problem
or that I should do something else, just let me know :-)

Before you get crazy, try this script, I spent several weeks to get it working.
The first part dynamically create the VLAN IF (eth0.x) and the associated bridge (xenbrx). The second one creates config files to make it up at the next reboot.

This is the script (sorry for french comments):

--->8---
#!/bin/bash
# A. Barthe -- jeu nov 22 14:14:18 CET 2007
# Script de fabrication dynamique d'un VLAN pour un dom0 xen
# Parametres: <vlan tag> [device] (device par defaut: eth0)
#

#DEBUG=echo

script=$(basename $0)
USAGE="Usage: $script <vlan tag> [device] (device par defaut: eth0)"

if [ $# -ne 1 -a $# -ne 2 ]; then
    echo $USAGE >&2
    exit 1
fi

#--------------------------------------------------------------------
# FABRICATION DYNAMIQUE DU VLAN ET DU BRIDGE ASSOCIE

vtag=$1
dev=${2:-eth0}

ifconfig | grep -q p$dev || {
    echo "p$dev: interface non trouvee" >&2
    exit 1
}

# Creation du VLAN sur pethx
$DEBUG modprobe 8021q
$DEBUG vconfig add p$dev $vtag || {
    echo "Echec a la creation du VLAN" >&2
    exit 1
}

# Renommage de pethx.y en ethx.y
$DEBUG ip link set p$dev.$vtag name $dev.$vtag

# Recuperation de la MAC de $dev
mac=$(ifconfig $dev | head -1 | awk '{print $NF}')

# Affectation de la MAC a l'interface just created
ip link set $dev.$vtag address $mac

# Configuration du VLAN
$DEBUG ip link set $dev.$vtag promisc on
$DEBUG ip link set $dev.$vtag multicast on
$DEBUG ip link set $dev.$vtag arp on

# Creation du bridge et ajout du VLAN dessus
$DEBUG brctl addbr xenbr$vtag
$DEBUG brctl addif xenbr$vtag $dev.$vtag

# Demarrage du VLAN et du bridge
$DEBUG ifconfig $dev.$vtag up
$DEBUG ifconfig xenbr$vtag up

#--------------------------------------------------------------------
# FABRICATION DES FICHIERS DE DEMARRAGE POUR QUE CA MARCHE AU REBOOT

root="/etc/sysconfig/network-scripts"
#root="toto"
baseif="ifcfg-"

iffile="$root/$baseif$dev"
test -f $iffile || {
    echo "$iffile: fichier non trouve" >&2
    exit 1
}

# Rajout du flag VLAN dans le fichier de demarrage de l'interface
grep -q "VLAN=yes" $iffile || echo "VLAN=yes" >> $iffile

# Fabrication du fichier de demarrage du vlan
vlanfile="$iffile.$vtag"
cat > $vlanfile <<EOF
DEVICE=$dev.$vtag
BOOTPROTO=none
> TYPE=Ethernet
VLAN=yes
BRIDGE=xenbr$vtag
EOF

# Fabrication du fichier de demarrage du bridge associe
brfile="$root/${baseif}xenbr$vtag"
cat > $brfile <<EOF
DEVICE=xenbr$vtag
BOOTPROTO=none
> TYPE=Bridge
EOF

# Et voila...
echo "Le VLAN $dev.$vtag et le bridge xenbr$vtag ont bien ete crees."
--->8---

Hope this helps.

Alain.
 


So thanks a million in advance for any of your help!

Cheers
Gael







_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users



_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
<Prev in Thread] Current Thread [Next in Thread>