Coert,<br>   To set up the networking, I basically used the following document:<br><a href="http://et.redhat.com/~jmh/docs/Xen_networking.pdf">http://et.redhat.com/~jmh/docs/Xen_networking.pdf</a><br><br>In this document, there is a reference to a different script for xen to use to configure the networks.   This script works, but I made two modifications:<br>
1) tweaked script so you could have an IP address on bond0 (untagged traffic) and make that network accessible to the guests<br>2) added code so the networks could be configured with a configuration file rather than editing the script<br>
<br>This is what the /etc/xen/net_bond.cfg file looks like:<br># This file shows the mapping between the server interface, xen bridge and virtual interface.   The current code requires all three to be specified.<br># bonded interface      xen bridge name         vif name<br>
bond0.3                 xenbr0                  vif0.0<br>bond0.2                 xenbr1                  vif1.0<br>bond0.4                 xenbr2                  vif2.0<br>bond0.7                 xenbr3                  vif3.0<br>
bond0.5                 xenbr4                  vif4.0<br>bond0.6                 xenbr5                  vif5.0<br>bond0                   xenbr6                  vif6.0<br><br><br>This is what that script looks like now:<br>
#!/bin/sh<br><br># Usage: transfer_addrs src dst<br># Copy all IP addresses (including aliases) from device $src to device $dst.<br>transfer_addrs () {<br>    local src=$1<br>    local dst=$2<br>    # Don&#39;t bother if $dst already has IP addresses.<br>
    if ip addr show dev ${dst} | egrep -q &#39;^ *inet &#39; ; then<br>        return<br>    fi<br>    # Address lines start with &#39;inet&#39; and have the device in them.<br>    # Replace &#39;inet&#39; with &#39;ip addr add&#39; and change the device name $src<br>
    # to &#39;dev $src&#39;.<br>    ip addr show dev ${src} | egrep &#39;^ *inet &#39; | sed -e &quot;<br>s/inet/ip addr add/<br>s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@<br>s/${src}/dev ${dst}/<br>&quot; | sh -e<br>
    # Remove automatic routes on destination device<br>    ip route list | sed -ne &quot;<br>/dev ${dst}\( \|$\)/ {<br>  s/^/ip route del /<br>  p<br>}&quot; | sh -e<br>}<br><br># Usage: transfer_routes src dst<br># Get all IP routes to device $src, delete them, and<br>
# add the same routes to device $dst.<br># The original routes have to be deleted, otherwise adding them<br># for $dst fails (duplicate routes).<br>transfer_routes () {<br>    local src=$1<br>    local dst=$2<br>    # List all routes and grep the ones with $src in.<br>
    # Stick &#39;ip route del&#39; on the front to delete.<br>    # Change $src to $dst and use &#39;ip route add&#39; to add.<br>    ip route list | sed -ne &quot;<br>/dev ${src}\( \|$\)/ {<br>  h<br>  s/^/ip route del /<br>
  P<br>  g<br>  s/${src}/${dst}/<br>  s/^/ip route add /<br>  P<br>  d<br>}&quot; | sh -e<br>}<br><br><br><br># Usage: create_bridge bridge<br>create_bridge () {<br>    local bridge=$1<br><br>    # Don&#39;t create the bridge if it already exists.<br>
    if ! brctl show | grep -q ${bridge} ; then<br>        brctl addbr ${bridge}<br>        brctl stp ${bridge} off<br>        brctl setfd ${bridge} 0<br>    fi<br>    ip link set ${bridge} up<br>}<br><br># Usage: add_to_bridge bridge dev<br>
add_to_bridge () {<br>    local bridge=$1<br>    local dev=$2<br>    # Don&#39;t add $dev to $bridge if it&#39;s already on a bridge.<br>    if ! brctl show | grep -q ${dev}$ ; then<br>        brctl addif ${bridge} ${dev}<br>
    fi<br>}<br><br># Usage: show_status dev bridge<br># Print ifconfig and routes.<br>show_status () {<br>    local dev=$1<br>    local bridge=$2<br><br>    echo &#39;============================================================&#39;<br>
    ip addr show ${dev}<br>    ip addr show ${bridge}<br>    echo &#39; &#39;<br>    brctl show ${bridge}<br>    echo &#39; &#39;<br>    ip route list<br>    echo &#39; &#39;<br>    route -n<br>    echo &#39;============================================================&#39;<br>
}<br><br>op_start () {<br>    if [ -f /etc/xen/net_bond.cfg ] ; then<br>        grep ^bond /etc/xen/net_bond.cfg | while read bond bridge vif<br>            do<br>                create_bridge $bridge<br>                add_to_bridge $bridge $vif<br>
                add_to_bridge2 $bridge $bond<br><br>                transfer_addrs $bond $bridge<br>                transfer_routes $bond $bridge<br>            done<br>    fi<br><br>}<br><br>op_stop () {<br>    if [ -f /etc/xen/net_bond.cfg ] ; then<br>
        grep ^bond /etc/xen/net_bond.cfg | while read bond bridge vif<br>            do<br>                transfer_routes $bridge $bond<br>                ip link set $bridge down<br>                brctl delbr $bridge<br>
            done<br>    fi<br>}<br><br># adds $dev to $bridge but waits for $dev to be in running state first<br>add_to_bridge2() {<br>    local bridge=$1<br>    local dev=$2<br>    local maxtries=10<br><br>    echo -n &quot;Waiting for ${dev} to negotiate link.&quot;<br>
    for i in `seq ${maxtries}` ; do<br>        if ifconfig ${dev} | grep -q RUNNING ; then<br>            break<br>        else<br>            echo -n &#39;.&#39;<br>            sleep 1<br>        fi<br>    done<br><br>    if [ ${i} -eq ${maxtries} ] ; then echo &#39;(link isnt in running state)&#39; ; fi<br>
<br>    add_to_bridge ${bridge} ${dev}<br>}<br><br>case &quot;${1}&quot; in<br>    start)<br>        op_start<br>        ;;<br><br>    stop)<br>        op_stop<br>        ;;<br><br>    status)<br>        show_status ${netdev} ${bridge}<br>
        ;;<br><br>    *)<br>        echo &quot;Unknown command: ${1}&quot; &gt;&amp;2<br>        echo &#39;Valid commands are: start, stop, status&#39; &gt;&amp;2<br>        exit 1<br>esac<br><br>David<br><br><br><div class="gmail_quote">
On Mon, Aug 3, 2009 at 3:17 AM, Coert Waagmeester <span dir="ltr">&lt;<a href="mailto:lgroups@waagmeester.co.za">lgroups@waagmeester.co.za</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br>
On Fri, 2009-07-31 at 11:08 -0400, David Knierim wrote:<br>
&gt; I am running CentOS 5.3 x86_64 as my dom0 and CentOS 5.3 on my domU&#39;s.<br>
&gt; On the dom0, I have two interfaces that are bonded and have tagged<br>
&gt; VLANs.   I can get the networks to the domU&#39;s by creating a bridge for<br>
&gt; each of the VLANS (bond0.3, bond0.4, etc).   On the domU, the<br>
&gt; interfaces show up as eth0, eth1, etc.<br>
&gt;<br>
&gt; Is there a way to set up the network on the dom0 so my domU&#39;s see a<br>
&gt; single interface with tagged VLAN support??<br>
&gt;<br>
&gt; Thanks!<br>
&gt;    David<br>
</div></div>&gt; _______________________________________________<br>
&gt; CentOS-virt mailing list<br>
&gt; <a href="mailto:CentOS-virt@centos.org">CentOS-virt@centos.org</a><br>
&gt; <a href="http://lists.centos.org/mailman/listinfo/centos-virt" target="_blank">http://lists.centos.org/mailman/listinfo/centos-virt</a><br>
<br>
Hello David,<br>
<br>
Sorry this is not an answer to your question, but how did you set up the<br>
bonds with xen?<br>
<br>
I tried doing the same, and did not win....<br>
<br>
<br>
Regards,<br>
<br>
Coert<br>
<br>
_______________________________________________<br>
CentOS-virt mailing list<br>
<a href="mailto:CentOS-virt@centos.org">CentOS-virt@centos.org</a><br>
<a href="http://lists.centos.org/mailman/listinfo/centos-virt" target="_blank">http://lists.centos.org/mailman/listinfo/centos-virt</a><br>
</blockquote></div><br>