bridge
来自「linux下用PCMCIA无线网卡虚拟无线AP的程序源码」· 代码 · 共 81 行
TXT
81 行
#!/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 + =
减小字号Ctrl + -
显示快捷键?