From: Greg Brackley Subject: Re: Network-bridge script with bonding and vlan Date: Sat, 22 Oct 2005 23:49:43 +1300 Message-ID: <01ba01c5d6f6$50079420$0100a8c0@balls> References: <002c01c5d56a$4260d8a0$0100a8c0@balls><20051020114842.GB26910@leeni.uk.xensource.com><04a401c5d5dd$1d1066b0$aa0a0a0a@brackley> <20051021092623.GA9455@leeni.uk.xensource.com> Reply-To: Greg Brackley Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_01B7_01C5D763.46D140A0" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit ----- Original Message ----- From: "Ewan Mellor" > Maybe we'll accept your script into the repository if it's clean and > general > enough, but whether you maintain it or we do, I don't think that it > (necessarily) belongs in network-bridge. Well I have managed to get a trivial example configuration up and running. It uses the Fedora initscripts to initialise the networking (c.f. using network-bridge script). It still uses the vif-bridge script for domU's. It might be of some use to others running FC4. The setup is two GbE ports (eth0 and eth1) bonded together using 802.3ad. Over that I have setup a single 802.1q VLAN (id 10) - with the intention of expanding this to one VLAN per domU. I configured a bridge (br0). I have created a config file to add vif0.0 to the bridge. Lastly I have provided a configuration file for veth0 which provides a MAC address and an IP address for dom0. I notice that the dom0 vif interface uses zero based indexes (i.e vif0.0), however the domU network interface numbers are one based (i.e. vif.1). Is there a reason for this? I'd appreciate any feedback, especially if I'm doing bad things. Greg. -- # ip addr show 1: lo: mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo 2: vif0.0: mtu 1500 qdisc noqueue link/ether fe:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff 3: veth0: mtu 1500 qdisc noqueue link/ether aa:de:ad:be:ef:01 brd ff:ff:ff:ff:ff:ff inet 192.168.0.20/24 brd 192.168.0.255 scope global veth0 4: bond0: mtu 1500 qdisc noqueue link/ether 00:e0:81:2e:13:14 brd ff:ff:ff:ff:ff:ff 5: eth0: mtu 1500 qdisc pfifo_fast master bond0 qlen 1000 link/ether 00:e0:81:2e:13:14 brd ff:ff:ff:ff:ff:ff 6: eth1: mtu 1500 qdisc pfifo_fast master bond0 qlen 1000 link/ether 00:e0:81:2e:13:14 brd ff:ff:ff:ff:ff:ff 7: eth2: mtu 1500 qdisc noop qlen 1000 link/ether 00:e0:81:2e:12:ca brd ff:ff:ff:ff:ff:ff 8: br0: mtu 1500 qdisc noqueue link/ether 00:e0:81:2e:13:14 brd ff:ff:ff:ff:ff:ff 9: bond0.10: mtu 1500 qdisc noqueue link/ether 00:e0:81:2e:13:14 brd ff:ff:ff:ff:ff:ff 11: vif2.1: mtu 1500 qdisc noqueue link/ether fe:ff:ff:ff:ff:ff brd ff:ff:ff:ff:ff:ff # brctl show bridge name bridge id STP enabled interfaces br0 8000.00e0812e1314 no bond0.10 vif0.0 vif2.1 --/etc/modprobe.conf-- alias bond0 bonding options bond0 mode=802.3ad lacp_rate=fast miimon=100 alias eth0 tg3 alias eth1 tg3 alias eth2 e100 ---domU config--- kernel = "/boot/vmlinuz-2.6.12-xenU" memory = 256 name = "purple" nics=1 vif = [ 'mac=aa:de:ad:be:ef:02, bridge=br0' ] disk = [ 'phy:/dev/VolGroup00/root01xenu,sda1,w', 'phy:/dev/VolGroup00/swap01,sdb1,w', 'phy:/dev/md0,sdc1,w' ] root = "/dev/sda1 ro" extra = "3" ---xend-config.sxp--- (xend-port 8000) (xend-event-port 8001) (xend-address 'localhost') (console-port-base 9600) (console-address 'localhost') (network-script network-bridge-nop ) (vif-bridge br0) (vif-netdev veth0) (vif-script vif-bridge) (vif-antispoof no) (block-file block-file) (block-enbd block-enbd) (dom0-min-mem 0) (dom0-cpus 0) ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="route-veth0" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="route-veth0" 192.168.2.0/24 via 192.168.0.2=0A= 192.168.128.0/17 via 192.168.0.2=0A= default via 192.168.0.254 mtu 1500=0A= =0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-bond0" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-bond0" DEVICE=3Dbond0=0A= BOOTPROTO=3Dnone=0A= ONBOOT=3Dyes=0A= TYPE=3DBonding=0A= NOZEROCONF=3Dyes=0A= ARP=3Dno=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-bond0.10" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-bond0.10" DEVICE=3Dbond0.10=0A= TYPE=3DEthernet=0A= BOOTPROTO=3Dnone=0A= ONBOOT=3Dyes=0A= NOZEROCONF=3Dyes=0A= BRIDGE=3Dbr0=0A= MACADDR=3Dfe:ff:ff:ff:ff:ff=0A= ARP=3Dno=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-br0" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-br0" DEVICE=3Dbr0=0A= TYPE=3DBridge=0A= BOOTPROTO=3Dstatic=0A= ONBOOT=3Dyes=0A= DELAY=3D0=0A= STP=3Doff=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-eth0" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-eth0" DEVICE=3Deth0=0A= BOOTPROTO=3Dnone=0A= ONBOOT=3Dyes=0A= TYPE=3DEthernet=0A= MASTER=3Dbond0=0A= SLAVE=3Dyes=0A= NOZEROCONF=3Dyes=0A= ARP=3Dno=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-eth1" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-eth1" DEVICE=3Deth1=0A= BOOTPROTO=3Dnone=0A= ONBOOT=3Dyes=0A= TYPE=3DEthernet=0A= MASTER=3Dbond0=0A= SLAVE=3Dyes=0A= NOZEROCONF=3Dyes=0A= ARP=3Dno=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-eth2" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-eth2" DEVICE=3Deth2=0A= BOOTPROTO=3Ddhcp=0A= ONBOOT=3Dno=0A= TYPE=3DEthernet=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-veth0" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-veth0" DEVICE=3Dveth0=0A= ONBOOT=3Dyes=0A= TYPE=3DEthernet=0A= BOOTPROTO=3Dnone=0A= BROADCAST=3D192.168.0.255=0A= IPADDR=3D192.168.0.20=0A= NETMASK=3D255.255.255.0=0A= NETWORK=3D192.168.0.0=0A= NOZEROCONF=3Dyes=0A= MACADDR=3Daa:de:ad:be:ef:01=0A= ARP=3Dyes=0A= =0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="ifcfg-vif0.0" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ifcfg-vif0.0" DEVICE=3Dvif0.0=0A= BOOTPROTO=3Dnone=0A= ONBOOT=3Dyes=0A= TYPE=3DEthernet=0A= NOZEROCONF=3Dyes=0A= MACADDR=3Dfe:ff:ff:ff:ff:ff=0A= ARP=3Dno=0A= BRIDGE=3Dbr0=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="network" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="network" NETWORKING=3Dyes=0A= HOSTNAME=3Dblue.lucidsolutions.co.nz=0A= VLAN=3Dyes=0A= NETWORKING_IPV6=3Dno=0A= =0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: application/octet-stream; name="network-bridge-nop" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="network-bridge-nop" #!/bin/sh=0A= =0A= =0A= # Exit if anything goes wrong.=0A= set -e =0A= =0A= # First arg is the operation.=0A= OP=3D$1=0A= shift=0A= =0A= # Pull variables in args in to environment.=0A= for arg ; do export "${arg}" ; done=0A= =0A= bridge=3D${bridge:-xen-br0}=0A= netdev=3D${netdev:-eth0}=0A= antispoof=3D${antispoof:-no}=0A= =0A= echo "*network $OP bridge=3D$bridge netdev=3D$netdev = antispoof=3D$antispoof" >&2=0A= =0A= # Usage: show_status dev bridge=0A= # Print ifconfig and routes.=0A= show_status () {=0A= local dev=3D$1=0A= local bridge=3D$2=0A= =0A= echo = '=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D'=0A= ifconfig ${dev}=0A= ifconfig ${bridge}=0A= echo ' '=0A= ip route list=0A= echo ' '=0A= route -n=0A= echo = '=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D'=0A= }=0A= =0A= op_start () {=0A= }=0A= =0A= op_stop () {=0A= }=0A= =0A= case ${OP} in=0A= start)=0A= op_start=0A= ;;=0A= =0A= stop)=0A= op_stop=0A= ;;=0A= =0A= status)=0A= show_status ${netdev} ${bridge}=0A= ;;=0A= =0A= *)=0A= echo 'Unknown command: ' ${OP} >&2=0A= echo 'Valid commands are: start, stop, status' >&2=0A= exit 1=0A= esac=0A= ------=_NextPart_000_01B7_01C5D763.46D140A0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ------=_NextPart_000_01B7_01C5D763.46D140A0--