#!/bin/sh # Starts Layer 2 bridge # # chkconfig: 2345 05 95 # description: Layer 2 Bridge # LOCKFILE=/var/lock/subsys/bridge [ -f /etc/sysconfig/bridge ] && . /etc/sysconfig/bridge PATH=$PATH:/sbin:/usr/sbin do_stop() { [ -z "$INTERFACES" ] && exit 0 echo "Stopping Bridge" for i in $INTERFACES $BRIDGE_INTERFACE ; do ip link set $i down done brctl delbr $BRIDGE_INTERFACE } do_start() { [ -z "$INTERFACES" ] && exit 0 echo "Starting Bridge" for i in $INTERFACES ; do ip link set $i up done brctl addbr br0 for i in $INTERFACES ; do ip link set $i up brctl addif br0 $i done ifup $BRIDGE_INTERFACE } case "$1" in start) do_start touch "$LOCKFILE" ;; stop) do_stop rm -f "$LOCKFILE" ;; restart) do_stop sleep 1 do_start ;; condrestart|condreload) if [ -f "$LOCKFILE" ]; then do_stop sleep 1 do_start fi ;; condstop) if [ -f "$LOCKFILE" ]; then do_stop rm -f "$LOCKFILE" fi ;; *) echo "Usage: $0 {start|stop|restart|condrestart|condreload|condstop}" exit 1 esac exit 0