最近在做點對點産品的項目,競品是ubnt的M5,由于時間很緊,也沒有把一些經驗進行總結。
ubnt的無線網橋M5支援ap、station、repeater模式。ap與station模式很容易了解,ap模式就是相當于無線發射點,終端(手機、電腦等)通過wifi連上該裝置,而station模式下的裝置也就相當于用戶端了,用于去連ap。repeater模式是通過wds實作的,即無線分發系統。多個裝置通過wds連在一起,就像布成一個網絡,各個裝置都是對等的,用戶端可以連上任意一個裝置。
配置頁面

repeater模式可以配置成auto模式和手動模式,在auto模式下會根據ssid查詢mac周邊裝置,自動橋接。而如果手動輸入mac位址,則會将mac加入到wds清單,最多支援6個mac橋接。
在配置repeater模式後,通過ssh登入到m5背景,檢視無線接口資訊,發現是通過nawds實作repeater的。
XW.v5.6.3# cat /etc/sysinit/wireless.conf
plugin_start() {
if [ -f /proc/sys/dev/rssi-leds/thresholds ]; then
echo 94 87 80 72 65 65 65 65 > /proc/sys/dev/rssi-leds/thresholds
echo 300 > /proc/sys/dev/rssi-leds/timer
echo 1 > /proc/sys/dev/rssi-leds/enable
fi
if [ -f /tmp/.wifi_ath0 ]; then
80211debug -i ath0 0x0
iwconfig "ath0" essid "ubnt2"
iwpriv "ath0" authmode 1
iwpriv "ath0" htweptkip 1
iwpriv "ath0" wmm 1
iwpriv "ath0" hostroaming 1
iwpriv "ath0" addmtikie 1
iwpriv "ath0" wds 1
iwpriv "ath0" autowds 0
/sbin/wlanconfig "ath0" nawds mode 1 > /dev/null 2>&1
/sbin/wlanconfig "ath0" nawds add-repeater 12:01:f0:c0:af:01 9 > /dev/null 2>&1
/sbin/wlanconfig "ath0" nawds add-repeater 12:01:f0:c0:af:03 9 > /dev/null 2>&1
/sbin/wlanconfig "ath0" nawds add-repeater 12:01:f0:c0:af:02 9 > /dev/null 2>&1
iwpriv "ath0" mcastenhance 2
iwconfig "ath0" sens 0
iwpriv "ath0" ignore11d 1
iwpriv "ath0" disablecoext 1
iwpriv "ath0" bgscan 0
athchans -i ath0 0
iwpriv "ath0" hide_ssid "0"
iwpriv "ath0" ap_bridge "1"
iwpriv "ath0" maccmd 3
iwpriv "ath0" maccmd 0
iwpriv "ath0" protmode 1
iwpriv "ath0" htprot 0
iwconfig "ath0" key off open
fi
true
}
于是通過指令在我們的兩台裝置上進行操作,實作了兩台裝置的橋接。過程中應該注意的問題是,信道、頻寬、ssid、加密方式必須設定為一樣,加密方式ubnt的隻支援wep加密。
執行以下操作:
裝置1
iwconfig ath1 channel 36
iwconfig "ath1" essid "wds-test"
iwpriv "ath1" authmode 1
iwpriv "ath1" wds 1
wlanconfig "ath1" nawds mode 1
wlanconfig "ath1" nawds add-repeater 00:00:00:00:00:25 9
裝置2
iwconfig ath1 channel 36
iwconfig "ath1" essid "wds-test"
iwpriv "ath1" authmode 1
iwpriv "ath1" wds 1
wlanconfig "ath1" nawds mode 1
wlanconfig "ath1" nawds add-repeater 00:00:00:00:00:30 9
檢視是否橋接成功
首先通過指令
wlanconfig ath1 nawds list
檢視是否有對端的mac位址
然後通過 wlanconfig ath1 list sta檢視是否有對端裝置資訊,如果橋接成功,在兩邊都會看到對端資訊的。
更多wifi相關文章,微信請關注:wifi開發者,定期釋出開發相關總結。