#! /bin/bash
PATH=$PATH:/usr/local/sbin:/sbin
BR=br0
IP="172.16.3.223"
MASK="255.255.252.0"
BROADCAST="
172.16.3.255"
return=$rc_done
case "$1" in
start)
echo "Starting service bridge $BR"
tincd -n vpn
brctl addbr $BR
brctl setbridgeprio $BR 0 || return=$rc_failed
brctl addif $BR eth0 || return=$rc_failed
brctl addif $BR eth1 || return=$rc_failed
brctl addif $BR vpn || return=$rc_failed
ifconfig eth0 0.0.0.0 || return=$rc_failed
ifconfig eth1
0.0.0.0 || return=$rc_failed
ifconfig vpn 0.0.0.0 || return=$rc_failed
brctl sethello $BR 1 || return=$rc_failed
brctl setmaxage $BR 4 || return=$rc_failed
brctl setpathcost $BR eth1 100 || return=$rc_failed
brctl setpathcost $BR vpn 100 || return=$rc_failed
brctl setportprio $BR eth1 20 || return=$rc_failed
brctl setportprio $BR vpn 20 || return=$rc_failed
# brctl setageing $BR 20 || return=$rc_failed
brctl setfd $BR 4 || return=$rc_failed
brctl stp $BR on
/sbin/ifconfig $BR inet $IP netmask $MASK broadcast $BROADCAST up
echo -e "$return"
;;
stop)
tincd -k -n vpn
/sbin/ifconfig $BR down
echo "Shutting down service bridge $BR"
brctl delif $BR vpn || return=$rc_failed
brctl delif $BR eth0 || return=$rc_failed
brctl delif $BR eth1 || return=$rc_failed
brctl delbr $BR || return=$rc_failed
rmmod bridge || return=$rc_failed
echo -e "$return"
;;
status)
ifconfig $BR
brctl showstp $BR
brctl show
;;
restart)
$0 stop && $0 start || return=$rc_failed
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
test "$return" = "$rc_done" || exit 1
exit 0
_______________________________________________ Bridge mailing list [email protected] https://lists.osdl.org/mailman/listinfo/bridge
