OpenVZ Forum


Home » Mailing lists » Users » Multiple bridge support
Multiple bridge support [message #31508] Wed, 02 July 2008 07:36 Go to next message
dietmar is currently offline  dietmar
Messages: 54
Registered: March 2007
Member
From: openvz.org
Hi all,

In Proxmox VE we want to support multiple bridges. I currently use a
patch
which adds an bridge parameter to the netif options: 

NETIF="ifname=XXX,bridge=XXX,mac=XXX,host_ifname=XXX,host_mac=XXX"

--netif_add ifname[,mac,host_ifname,host_mac,bridge]

I also modified --netif_add to accept empty parameters, for example:

--netif_add eth3,,,,vmbr3

I wonder if we can include that into the vzctl release - I will post 
the patch if soembody is interested.

- Dietmar
Re: Multiple bridge support [message #31516 is a reply to message #31508] Wed, 02 July 2008 17:48 Go to previous messageGo to next message
Mishin Dmitry is currently offline  Mishin Dmitry
Messages: 112
Registered: February 2006
Senior Member
From: openvz.org
On Wednesday 02 July 2008 11:36:42 Dietmar Maurer wrote:
> Hi all,
>
> In Proxmox VE we want to support multiple bridges. I currently use a
> patch
> which adds an bridge parameter to the netif options:
>
> NETIF="ifname=XXX,bridge=XXX,mac=XXX,host_ifname=XXX,host_mac=XXX"
>
> --netif_add ifname[,mac,host_ifname,host_mac,bridge]
>
> I also modified --netif_add to accept empty parameters, for example:
>
> --netif_add eth3,,,,vmbr3
>
> I wonder if we can include that into the vzctl release - I will post
> the patch if soembody is interested.

Dietmar,

it will be useful indeed, please, provide patch to devel@ mailing list. 

>
> - Dietmar
>
>
-- 
Thanks,
Dmitry.
AW: [Users] Multiple bridge support [message #31524 is a reply to message #31516] Thu, 03 July 2008 05:20 Go to previous messageGo to next message
dietmar is currently offline  dietmar
Messages: 54
Registered: March 2007
Member
From: openvz.org
Attached is the patch.

- Dietmar
 
> > In Proxmox VE we want to support multiple bridges. I 
> currently use a 
> > patch which adds an bridge parameter to the netif options:
> >
> > NETIF="ifname=XXX,bridge=XXX,mac=XXX,host_ifname=XXX,host_mac=XXX"
> >
> > --netif_add ifname[,mac,host_ifname,host_mac,bridge]
> >
> > I also modified --netif_add to accept empty parameters, for example:
> >
> > --netif_add eth3,,,,vmbr3
> >
> > I wonder if we can include that into the vzctl release - I 
> will post 
> > the patch if soembody is interested.
> 
> Dietmar,
> 
> it will be useful indeed, please, provide patch to devel@ 
> mailing list. 
>
Re: Multiple bridge support [message #31527 is a reply to message #31516] Thu, 03 July 2008 06:50 Go to previous messageGo to next message
Arjan Schrijver is currently offline  Arjan Schrijver
Messages: 6
Registered: November 2007
Junior Member
From: openvz.org
Dmitry Mishin wrote:
> On Wednesday 02 July 2008 11:36:42 Dietmar Maurer wrote:
>   
>> Hi all,
>>
>> In Proxmox VE we want to support multiple bridges. I currently use a
>> patch
>> which adds an bridge parameter to the netif options:
>>
>> NETIF="ifname=XXX,bridge=XXX,mac=XXX,host_ifname=XXX,host_mac=XXX"
>>
>> --netif_add ifname[,mac,host_ifname,host_mac,bridge]
>>
>> I also modified --netif_add to accept empty parameters, for example:
>>
>> --netif_add eth3,,,,vmbr3
>>
>> I wonder if we can include that into the vzctl release - I will post
>> the patch if soembody is interested.
>>     
>
> Dietmar,
>
> it will be useful indeed, please, provide patch to devel@ mailing list. 
>
>   
Please do so. I've written my own solution for this, but yours looks 
much better.

Arjan
AW: Multiple bridge support [message #31530 is a reply to message #31527] Thu, 03 July 2008 07:19 Go to previous messageGo to next message
dietmar is currently offline  dietmar
Messages: 54
Registered: March 2007
Member
From: openvz.org
And here is the vznetaddbr we use (attached).

> >> I wonder if we can include that into the vzctl release - I 
> will post 
> >> the patch if soembody is interested.
> >>     
> >
> > Dietmar,
> >
> > it will be useful indeed, please, provide patch to devel@ 
> mailing list. 
> >
> >   
> Please do so. I've written my own solution for this, but 
> yours looks much better.
  • Attachment: vznetaddbr
    (Size: 1.46KB, Downloaded 439 times)
Re: AW: Multiple bridge support [message #31541 is a reply to message #31530] Thu, 03 July 2008 11:28 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

From: openvz.org
Dietmar,

I have committed both the patch and the script to git, see [1] and [2]. 
I have modified the script a bit, hope I haven't break anything.

It would be just great if you can provide a patch to vzctl man page 
describing the new parameter, and the according wiki 
modifications/additions.

[1] 
http://git.openvz.org/?p=vzctl;a=commit;h=a16e0ecf72d4f2c7bd08aadbaa8272cbdc9e25a5
[2] 
http://git.openvz.org/?p=vzctl;a=commit;h=41fb6973bc205c00e25ba73431110ac8e821d6c9

Dietmar Maurer wrote:
> And here is the vznetaddbr we use (attached).
>
>   
>>>> I wonder if we can include that into the vzctl release - I 
>>>>         
>> will post 
>>     
>>>> the patch if soembody is interested.
>>>>     
>>>>         
>>> Dietmar,
>>>
>>> it will be useful indeed, please, provide patch to devel@ 
>>>       
>> mailing list. 
>>     
>>>   
>>>       
>> Please do so. I've written my own solution for this, but 
>> yours looks much better.
>>     
>
>   
> ------------------------------------------------------------------------
>
Re: AW: Multiple bridge support [message #31542 is a reply to message #31530] Thu, 03 July 2008 11:34 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

From: openvz.org
How do you invoke it? Using EXTERNAL_SCRIPT?

Would be good to have a patch adding (conditional?) invocation of 
vznetaddbr to vznetcfg.

Dietmar Maurer wrote:
> And here is the vznetaddbr we use (attached).
>
>   
>>>> I wonder if we can include that into the vzctl release - I 
>>>>         
>> will post 
>>     
>>>> the patch if soembody is interested.
>>>>     
>>>>         
>>> Dietmar,
>>>
>>> it will be useful indeed, please, provide patch to devel@ 
>>>       
>> mailing list. 
>>     
>>>   
>>>       
>> Please do so. I've written my own solution for this, but 
>> yours looks much better.
>>     
>
>   
> ------------------------------------------------------------------------
>
AW: AW: Multiple bridge support [message #31544 is a reply to message #31542] Thu, 03 July 2008 12:30 Go to previous messageGo to next message
dietmar is currently offline  dietmar
Messages: 54
Registered: March 2007
Member
From: openvz.org
Hi Kir,

> Von: Kir Kolyshkin [mailto:kir@openvz.org] 
> Gesendet: Donnerstag, 03. Juli 2008 13:35
> An: users@openvz.org; Dietmar Maurer
> Betreff: Re: AW: [Users] Multiple bridge support
> 
> How do you invoke it? Using EXTERNAL_SCRIPT?
> 
> Would be good to have a patch adding (conditional?) 
> invocation of vznetaddbr to vznetcfg.

One idea was to add a new global option in vz.conf:

DEF_BRIDGE=XXXX

If set, we automatically setup the bridge (we need to pass an additional
parameter to vznetcfg, but i guess thats no problem at all). That also
avoid a hardcoded default bridge name (vmbr0).

Here is the totally untested code. If you like the idea I will test it
;-)

---------------------------------------
#!/bin/sh
CONFIGFILE='@PKGCONFDIR@/vz.conf'

[ -f "$CONFIGFILE" ] &&. $CONFIGFILE

VZNETCFG='@PKGCONFDIR@/vznet.conf'

[ -f "$VZNETCFG" ] && . "$VZNETCFG"

usage()
{
        echo >&2 "vznetcfg init veth <dev> [<bridge>]"
}

init_veth()
{
        local dev="$1"
        local bridge="$2"

        if [ -n "$DEV_BRIDGE" ]; then
            if [ ! -n "$bridge" ]; then
                bridge=$DEV_BRIDGE
            fi
            echo "Adding interface $dev to bridge $bridge on CT0 for
CT$VEID"
            /sbin/ifconfig $dev 0
            echo 1 > /proc/sys/net/ipv4/conf/$dev/proxy_arp
            echo 1 > /proc/sys/net/ipv4/conf/$dev/forwarding
            /usr/sbin/brctl addif $bridge $dev
        else
            ip link set "$dev" up
        fi
}

# Call the external script if defined
if [ -n "$EXTERNAL_SCRIPT" -a -x "$EXTERNAL_SCRIPT" ]; then
        export VEID
        exec "$EXTERNAL_SCRIPT" $@
fi

if test $# -le 2; then
    usage
    exit 0
fi

CMD="$1"
case "$CMD$2" in
        initveth)
                if test $# -le 3; then
                        usage
                        exit 1
                fi

                init_veth "$3" "$4"
                ;;
        *)
                echo "invalid action"
                exit 1
                ;;
esac
exit 0
AW: AW: Multiple bridge support [message #31690 is a reply to message #31541] Mon, 07 July 2008 04:34 Go to previous messageGo to next message
dietmar is currently offline  dietmar
Messages: 54
Registered: March 2007
Member
From: openvz.org
> It would be just great if you can provide a patch to vzctl 
> man page describing the new parameter, and the according wiki 
> modifications/additions.

Here is the patch for the man page.

I am not sure how to edit the wiki. Howto indicate
that the feature is only available in newest version
from git. Can I use 'version > 3.0.22' ?

- Dietmar
  • Attachment: vzctl.8.diff
    (Size: 1.54KB, Downloaded 389 times)
Re: AW: AW: Multiple bridge support [message #31827 is a reply to message #31544] Thu, 10 July 2008 17:42 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

From: openvz.org
I don't quite get it. Is it supposed to be a replacement for vznetaddbr, 
an addition to it, or is it orthogonal to it? Who and when calls vznetaddbr?

Dietmar Maurer wrote:
> Hi Kir,
>
>   
>> Von: Kir Kolyshkin [mailto:kir@openvz.org] 
>> Gesendet: Donnerstag, 03. Juli 2008 13:35
>> An: users@openvz.org; Dietmar Maurer
>> Betreff: Re: AW: [Users] Multiple bridge support
>>
>> How do you invoke it? Using EXTERNAL_SCRIPT?
>>
>> Would be good to have a patch adding (conditional?) 
>> invocation of vznetaddbr to vznetcfg.
>>     
>
> One idea was to add a new global option in vz.conf:
>
> DEF_BRIDGE=XXXX
>
> If set, we automatically setup the bridge (we need to pass an additional
> parameter to vznetcfg, but i guess thats no problem at all). That also
> avoid a hardcoded default bridge name (vmbr0).
>
> Here is the totally untested code. If you like the idea I will test it
> ;-)
>
> ---------------------------------------
> #!/bin/sh
> CONFIGFILE='@PKGCONFDIR@/vz.conf'
>
> [ -f "$CONFIGFILE" ] &&. $CONFIGFILE
>
> VZNETCFG='@PKGCONFDIR@/vznet.conf'
>
> [ -f "$VZNETCFG" ] && . "$VZNETCFG"
>
> usage()
> {
>         echo >&2 "vznetcfg init veth <dev> [<bridge>]"
> }
>
> init_veth()
> {
>         local dev="$1"
>         local bridge="$2"
>
>         if [ -n "$DEV_BRIDGE" ]; then
>             if [ ! -n "$bridge" ]; then
>                 bridge=$DEV_BRIDGE
>             fi
>             echo "Adding interface $dev to bridge $bridge on CT0 for
> CT$VEID"
>             /sbin/ifconfig $dev 0
>             echo 1 > /proc/sys/net/ipv4/conf/$dev/proxy_arp
>             echo 1 > /proc/sys/net/ipv4/conf/$dev/forwarding
>             /usr/sbin/brctl addif $bridge $dev
>         else
>             ip link set "$dev" up
>         fi
> }
>
> # Call the external script if defined
> if [ -n "$EXTERNAL_SCRIPT" -a -x "$EXTERNAL_SCRIPT" ]; then
>         export VEID
>         exec "$EXTERNAL_SCRIPT" $@
> fi
>
> if test $# -le 2; then
>     usage
>     exit 0
> fi
>
> CMD="$1"
> case "$CMD$2" in
>         initveth)
>                 if test $# -le 3; then
>                         usage
>                         exit 1
>                 fi
>
>                 init_veth "$3" "$4"
>                 ;;
>         *)
>                 echo "invalid action"
>                 exit 1
>                 ;;
> esac
> exit 0
>
>
>
AW: AW: AW: Multiple bridge support [message #31852 is a reply to message #31827] Fri, 11 July 2008 04:46 Go to previous message
dietmar is currently offline  dietmar
Messages: 54
Registered: March 2007
Member
From: openvz.org
> I don't quite get it. Is it supposed to be a replacement for 
> vznetaddbr, an addition to it, or is it orthogonal to it? Who 
> and when calls vznetaddbr?

It merges vznetaddbr into vznetcfg, making
vznetaddbr obsolete.

- Dietmar
Previous Topic: 2.6.24 general protection fault
Next Topic: Another 2.6.24 problem
Goto Forum:
  


Current Time: Tue Sep 25 22:36:59 GMT 2018