📄 bridge
字号:
#!/bin/shEXITCODE=1case "$1" in start) echo "Starting BRIDGING services:" # fixme: move eth0 stuff to wired ifconfig eth0 up WLANS=`ifconfig -a | cut -d ' ' -f 1 | grep wlan` ETHS=`ifconfig -a | cut -d ' ' -f 1 | grep eth` brctl addbr br0 brctl sethello br0 2 # must keep this below fd # maxage - length of time between configuration messages # (hellos) before a bridge decides that a port is no longer # reachable. we'll set it to the time it takes an ap to # reboot. the longer it is, the less we are affected by # unnecessary spanning tree recalculations brctl setmaxage br0 60 brctl setfd br0 4 brctl setbridgeprio br0 100 # wlans must be first so the bridge takes the # MAC address of the wlan for i in $WLANS $ETHS ; do brctl addif br0 $i done ifconfig br0 up # see if any packets received on eth0 interface #ETH_PKTS=`grep eth0 /proc/net/dev| cut -d " " -f 5` #if [ "$ETH_PKTS" -ne "0" ] ; then # # if eth0 is active lower bridge priority # # (we want the wired bridges to be root) # echo "lowering bridge priority" # brctl setbridgeprio br0 0 #fi EXITCODE=0 ;; stop) echo "Shutting down BRIDGING services:" WLANS=`brctl show | sed -n 's/.*\(wlan.*\).*/\1/p'` ETHS=`brctl show | sed -n 's/.*\(eth.*\).*/\1/p'` # teardown the bridge ifconfig br0 down for i in $WLANS $ETHS ; do brctl delif br0 $i done brctl delbr br0 EXITCODE=0 ;; status) echo "Checking BRIDGING service status:" EXITCODE=0 ;; restart|reload) echo "Restarting BRIDGING services:" $0 stop sleep 1 $0 start EXITCODE=$? ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1; ;;esac
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -