Wi-FIのネットワーク方式には、大きく分けてAP型、Adhoc型、メッシュ型と3つのタイプがあります。AP型とAdhoc型は広く知られているので、とくに説明はいりませんが、メッシュ型はそれぞれの無線ノードにルーティング機能をもたせる変わったネットワークの方式です。そのメッシュネットワークもAdhocモードを使ったものと802.11sを使ったものに分けられます。
meshモード使ったメッシュネットワークの構築
OpenWrtサイトの解説をベースに設定していきます。
802.11s based wireless mesh network
解説にあるとおり Chaos Calmerではauthsaeに難がありセキュリティが使えません。使えるようになれば暗号化が出来ないadhocより有利になるでしょう。
802.11sはwifiモジュールにかなりバラつきがありiw listで調べて使えるかどうか確認します。インテル製は使えないと見てよいでしょう。broadcomはセットアップはできるがメッシュ接続が出来ませんでした。Ralinkの5,6年前に買ったusbドングル(rt3050)は使えました。
例えば、バッファロールーターのath9kの無線モジュールでは、
valid interface combinations:
* #{ managed } <= 2048, #{ AP, mesh point } <= 8, #{ P2P-client, P2P-GO } <= 1, #{ IBSS } <= 1,
total <= 2048, #channels <= 1, STA/AP BI must match
* #{ WDS } <= 2048,
total <= 2048, #channels <= 1, STA/AP BI must match
* #{ IBSS, AP, mesh point } <= 1,
total <= 1, #channels <= 1, STA/AP BI must match, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz }
とありメッシュモードが使えます。よくみてみるにAPモードとmeshモードで同時に使えるようなことがわかります。試しに設定してみたところ、802.11bgnではできたのですが802.11aの方はできませんでした。あくまでも目安と考えたほうがよさそうです。
Buffalo WZR-HP-G300NH2の設定例として、
config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11g'
option path 'pci0000:00/0000:00:00.0'
option txpower '18'
option country 'JP'
option channel '1'
option htmode 'HT20'
config wifi-iface
option device 'radio0'
option mode 'ap'
option ssid 'MyAP'
option encryption 'psk2+ccmp'
option key 'xxxxxxxxxxxx'
option network 'lan'
config wifi-iface
option device 'radio0'
option mode 'mesh'
option mesh_id 'mymesh'
option encryption 'none'
option network '80211s'
このように編集してwifiコマンド実行すると反映されます。さらにnetworkにアドレス等を書き込み/etc/init.d/network restartでネットワークをリセットします。
コマンドを実行してメッシュネットワークが動いているか確認してみます。
# iw dev wlan0 station dump
Station xx:xx:xx:xx:xx:ab (on wlan0)
inactive time: 80 ms
rx bytes: 6019966
rx packets: 152051
tx bytes: 910
tx packets: 10
tx retries: 0
tx failed: 0
signal: -27 [-32, -28] dBm
signal avg: -28 [-35, -29] dBm
Toffset: 2512033 us
tx bitrate: 1.0 MBit/s
rx bitrate: 1.0 MBit/s
expected throughput: 0.704Mbps
mesh llid: 1474
mesh plid: 1828
mesh plink: ESTAB
mesh local PS mode: ACTIVE
mesh peer PS mode: ACTIVE
mesh non-peer PS mode: ACTIVE
authorized: yes
authenticated: yes
preamble: long
WMM/WME: yes
MFP: no
TDLS peer: no
Station xx:xx:xx:xx:xx:04 (on wlan0)
inactive time: 2490 ms
rx bytes: 5359167
rx packets: 135311
tx bytes: 1251
tx packets: 15
tx retries: 2
tx failed: 1
signal: -46 [-54, -46] dBm
signal avg: -46 [-54, -46] dBm
Toffset: -1289612762 us
tx bitrate: 12.0 MBit/s
rx bitrate: 5.5 MBit/s
expected throughput: 6.261Mbps
mesh llid: 1792
mesh plid: 1213
mesh plink: ESTAB
mesh local PS mode: ACTIVE
mesh peer PS mode: ACTIVE
mesh non-peer PS mode: ACTIVE
authorized: yes
authenticated: yes
preamble: long
WMM/WME: yes
MFP: no
TDLS peer: no
# iw dev wlan0 mpath dump
DEST ADDR NEXT HOP IFACE SN METRIC QLEN EXPTIME DTIM DRET FLAGS
xx:xx:xx:xx:xx:04 xx:xx:xx:xx:xx:04 wlan0 0 683 0 20 0 0 0x11
xx:xx:xx:xx:xx:ab xx:xx:xx:xx:xx:04 wlan0 5 2173 0 20 100 0 0x5
セキュリティに問題があるのでipsec(strongSwan)を使っで接続してみました。とくに問題なさそうです。