bridging (was Re: Fedora Core 2 wishlists)
Steven Pritchard
steve at silug.org
Tue Dec 9 21:30:32 UTC 2003
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 at kspei.com http://www.kspei.com/
Phone: (618)398-7360 Mobile: (618)567-7320
-------------- next part --------------
#!/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
-------------- next part --------------
#!/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
More information about the fedora-devel-list
mailing list