Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 126593 Details for
Bug 111684
Xen network bridge support
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
init.d script to set up bridged virtual network
virtualnet (text/plain), 2.67 KB, created by
Luca Lesinigo
on 2007-08-01 12:03:01 UTC
(
hide
)
Description:
init.d script to set up bridged virtual network
Filename:
MIME Type:
Creator:
Luca Lesinigo
Created:
2007-08-01 12:03:01 UTC
Size:
2.67 KB
patch
obsolete
>#!/sbin/runscript ># Copyright 1999-2007 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 ># $Header: $ > >depend() { > before net >} > >start() { > ebegin "Setting up virtual network" > [ ! -x /sbin/ip ] && (eerror "cannot run /sbin/ip" ; return 1) > [ ! -x /sbin/brctl ] && (eerror "cannot run /sbin/brctl" ; return 1) > [ ! -x /bin/grep ] && (eerror "cannot run /bin/grep" ; return 1) > [ ! -x /bin/sed ] && (eerror "cannot run /bin/sed" ; return 1) > [ ! -x /bin/cut ] && (eerror "cannot run /bin/cut" ; return 1) > eindent > for DEV in $(/sbin/ip -o link | /bin/cut -d: -f2 | /bin/grep '^ eth[0-9]*$' | /bin/cut -c 5-); do > # get mac address of physical interface > MAC=$(/sbin/ip -o link show eth${DEV} | /bin/sed -e s/'.*ether '// -e s/' brd.*'//) > einfo "eth${DEV} [${MAC}]" > eindent > if ( /sbin/ip -o link show eth${DEV} | /bin/grep -q UP ); then > ewarn "interface UP, skipping" > continue > elif ( ! /sbin/ip -o link show veth${DEV} >/dev/null 2>&1 ); then > ewarn "corresponding veth doesn't exist, skipping" > continue > elif ( ! /sbin/ip -o link show vif0.${DEV} >/dev/null 2>&1 ); then > ewarn "corresponding vif0 doesn't exist, skipping" > continue > elif ( /sbin/ip -o link show bridge${DEV} >/dev/null 2>&1 ); then > ewarn "a bridge${DEV} interface already exists, skipping" > continue > fi > # rename interfaces > /sbin/ip link set eth${DEV} name peth${DEV} > /sbin/ip link set veth${DEV} name eth${DEV} > # create bridge (our virtual switch) > /sbin/brctl addbr bridge${DEV} > /sbin/brctl stp bridge${DEV} off > /sbin/brctl setfd bridge${DEV} 0 > /sbin/ip link set bridge${DEV} arp off > /sbin/ip link set bridge${DEV} multicast off > /sbin/ip link set bridge${DEV} up > # remove mac address from physical interface > /sbin/ip link set peth${DEV} down > /sbin/ip link set peth${DEV} arp off > /sbin/ip link set peth${DEV} multicast off > /sbin/ip link set peth${DEV} addr fe:ff:ff:ff:ff:ff > /sbin/ip addr flush peth${DEV} 2>/dev/null > # ...and do the same to the vif0.x > /sbin/ip link set vif0.${DEV} down > /sbin/ip link set vif0.${DEV} arp off > /sbin/ip link set vif0.${DEV} multicast off > /sbin/ip link set vif0.${DEV} addr fe:ff:ff:ff:ff:ff > /sbin/ip addr flush vif0.${DEV} 2>/dev/null > # set up mac address on virtual interface > /sbin/ip link set eth${DEV} addr ${MAC} arp on > # add vif0.x to the bridge > /sbin/brctl addif bridge${DEV} vif0.${DEV} > /sbin/ip link set vif0.${DEV} up > # turn on physical interface > /sbin/ip link set peth${DEV} up > /sbin/brctl addif bridge${DEV} peth${DEV} > # vethX, now named ethX, is our local port to the net, > # the usual network scripts will take care of it > eoutdent > done > eoutdent > eend $? >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 111684
: 126593 |
165963