#! /bin/sh
#
#
# /sbin/init.d/bridge
# chkconfig: 345 25 75
# description: bridge configuration script for HLI by Ron Senykoff
# . /etc/rc.config
return=$rc_done
BRIDGENAME="MyBridge1"
GATEWAY="X.X.X.X"
BRIDGE_IP="X.X.X.X"
BRIDGE_NETMASK="X.X.X.X"
STP_ON="yes"
STP_PRIO="1"
case "" in
start)
echo "Starting service bridge"
ifconfig eth0 promisc up
ifconfig eth1 promisc up
brctl addbr $BRIDGENAME || return=$rc_failed
brctl addif $BRIDGENAME eth0 || return=$rc_failed
brctl addif $BRIDGENAME eth1 || return=$rc_failed
ifconfig eth0 0.0.0.0 || return=$rc_failed
ifconfig eth1 0.0.0.0 || return=$rc_failed
brctl sethello $BRIDGENAME 1 || return=$rc_failed
brctl setmaxage $BRIDGENAME 4 || return=$rc_failed
brctl setfd $BRIDGENAME 4 || return=$rc_failed
brctl stp $BRIDGENAME $STP_ON
brctl setbridgeprio $BRIDGENAME $STP_PRIO
ifconfig $BRIDGENAME $BRIDGE_IP.netmask $BRIDGE_NETMASK up
ip route flush cache
ip route add default via $GATEWAY
sh /etc/rc.d/init.d/shape.eth0.sh
sh /etc/rc.d/init.d/shape.eth1.sh
echo -e "$return"
stop)
echo "Shutting down service bridge"
brctl delif $BRIDGENAME eth1 || return=$rc_failed
brctl delif $BRIDGENAME eth0 || return=$rc_failed
ifconfig $BRIDGENAME down || return=$rc_failed
brctl delbr $BRIDGENAME || return=$rc_failed
rmmod bridge || return=$rc_failed
echo -e "$return"
status)
ifconfig $BRIDGENAME
brctl showbr $BRIDGENAME
;;
restart)
stop && start || return=$rc_failed
*)
echo "Usage: "
exit 1
esac
test "$return" = "$rc_done" || exit 1
exit 0