[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

bridging (was Re: Fedora Core 2 wishlists)



I was hoping to come up with a nice patch for initscripts before I
suggested this, but I'd really love to see some support for bridged
interfaces.

I have a trivial /sbin/ifup-pre-local and /sbin/ifdown-local (both
attached, in case anyone is interested) setting everything up for me
now, but I'd love to be able to stop using them.

On a system with these two scripts, this works as
/etc/sysconfig/network-scripts/ifcfg-br0:

DEVICE=br0
BOOTPROTO=static
IPADDR=10.0.0.1
NETMASK=255.255.255.0
ONBOOT=yes
MEMBERS="eth0 wlan0"
BROPTIONS[0]="stp off"
BROPTIONS[1]="setfd 0"
BROPTIONS[2]="sethello 0"

(Both ifcfg-eth0 and ifcfg-wlan0 have ONBOOT set to "no".)

Steve
-- 
Steven Pritchard - K&S Pritchard Enterprises, Inc.
Email: steve kspei com             http://www.kspei.com/
Phone: (618)398-7360               Mobile: (618)567-7320
#!/bin/sh

DEVICE="$1"

if [ -z "$DEVICE" ] ; then
    echo $"Usage: ifup-pre-local DEVICE" >&2
    exit 1
fi

[ -f /etc/sysconfig/network-scripts/ifcfg-"$1" ] && \
    . /etc/sysconfig/network-scripts/ifcfg-"$1"

case "$DEVICE" in
    br[0-9]*:*)
        ;;

    br[0-9]*)
        if [ ! -x /usr/sbin/brctl ] ; then
            echo $"brctl not found.  Unable to configure bridge $DEVICE." >&2
            exit 1
        fi
        echo -n $"Configuring bridge $DEVICE..."
        brctl addbr $DEVICE
        if [ -n "$MEMBERS" ] ; then
            echo -n $"  Adding device"
            for iface in $MEMBERS ; do
                echo -n $" $iface"
                ifup $iface
                brctl addif $DEVICE $iface
            done
            echo -n "."
        fi
        n=0
        while [ $n -lt ${#BROPTIONS[ ]} ] ; do
            echo ${BROPTIONS[$n]} | \
                while read opt args ; do brctl $opt $DEVICE $args ; done
            (( n++ ))
        done
        echo $"  Done."
        ;;
esac
#!/bin/sh

DEVICE="$1"

if [ -z "$DEVICE" ] ; then
    echo $"Usage: ifdown-local DEVICE" >&2
    exit 1
fi

[ -f /etc/sysconfig/network-scripts/ifcfg-"$1" ] && \
    . /etc/sysconfig/network-scripts/ifcfg-"$1"

case "$DEVICE" in
    br[0-9]*)
	if [ ! -x /usr/sbin/brctl ] ; then
	    echo $"brctl not found.  Unable to remove bridge $DEVICE." >&2
	    exit 1
	fi
        echo -n $"Deleting bridge $DEVICE..."
	if [ -n "$MEMBERS" ] ; then
	    echo -n $"  Removing device"
	    for iface in $MEMBERS ; do
	        echo -n $" $iface"
                ifdown $iface
		brctl delif $DEVICE $iface
	    done
	    echo -n "."
	fi
        brctl delbr $DEVICE
        echo $"  Done."
        ;;
esac

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]