ÀÎÅÍÆäÀ̽º 2°³
#!/bin/bash
#!/bin/sh
return=$rc_done
case "$1" in
start)
echo "Starting service bridge br0"
brctl addbr br0
brctl addif br0 eth2
brctl addif br0 eth3
ifconfig eth2 0.0.0.0 promisc
ifconfig eth3 0.0.0.0 promisc
ifconfig br0 211.110.xxx.82 netmask 255.255.255.192 up
route add default gw 211.110.xxx.65
echo -e "start"
;;
stop)
echo "Shutting down service bridge br0"
ifconfig br0 down
brctl delif br0 eth2
brctl delif br0 eth3
brctl delbr br0
echo -e "stop!"
;;
status)
ifconfig br0
brctl show
;;
restart)
$0 stop && $0 start || return=$rc_failed
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
ÀÎÅÍÆäÀ̽º 3°³
#!/bin/sh
dev_wan=eth1
dev_lan=eth2
brctl=/usr/sbin/brctl
return=$rc_done
case "$1" in
start)
echo "Starting service bridge br0"
${brctl} addbr br0 || return=$rc_failed
${brctl} addif br0 ${dev_wan} || return=$rc_failed
${brctl} addif br0 ${dev_lan} || return=$rc_failed
ifconfig ${dev_wan} 0.0.0.0 promisc txqueuelen 10000 || return=$rc_failed
ifconfig ${dev_lan} 0.0.0.0 promisc txqueuelen 10000 || return=$rc_failed
${brctl} sethello br0 1 || return=$rc_failed
${brctl} setmaxage br0 4 || return=$rc_failed
${brctl} setfd br0 4 || return=$rc_failed
ifconfig br0 up || return=$rc_failed
echo -e "$return"
;;
stop)
echo "Shutting down service bridge br0"
ifconfig br0 down || return=$rc_failed
${brctl} delif br0 ${dev_wan} || return=$rc_failed
${brctl} delif br0 ${dev_lan} || return=$rc_failed
${brctl} delbr br0 || return=$rc_failed
echo -e "$return"
;;
status)
ifconfig br0
${brctl} show br0
;;
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