無線LAN on Debian
使用機材
LANケーブル
接続環境
光プレミアム: [ONU]---[CTU]---[WZR2-G300N] - wireless - [WLI-UC-G300N]--(PC:USBポート)
引っ越したのを機に「無線LAN BBルータ」を使って宅内配線をすっきりさせることにした。
11n に興味があったので、Buffalo WZR2-G300N/U*1を購入した。
とりあえず Windows XP 上で動作確認し、300 Mbps というのは、今のところ夢だということを知った。
# もちろん動作モードは 300 Mbps とか 270Mbps と表示されるのだが...
この時「AOSS」という仕組みでセキュリティ認証をしており、その結果「WPA2-PSK」「WPA-PSK」など複数の
認証方式が同時に動作していることを確認した。
"Debian GNU/Linux 4.0 (etch)" 上で無線を使うための設定方法を調べ( WEPは使わないと思うので )とりあえず考えることは以下のようになった。
- ドライバ: ndiswrapper を使って Windows 版のドライバを動かす。
- 認証方式: WPA-PSK
- 設定項目: SSID, PSK用のキー, DHCPか固定IPにするか
*1:"/U" は、USBアダプタが付属しているということ。
ドライバの作成で、まずはまる。
このルータに付属している USB用無線子機は WLI-UC-G300N という型番で新しめの機種みたい。
2008-05-03時点で http://kmuto.jp/open.cgi?%cc%b5%c0%feLAN%c6%b0%ba%ee%be%f5%b6%b7 には記載がなかった。
Debian の apt で落とせるバージョンは、"ndiswrapper-utils-1.1" と "ndiswrapper-utils-1.9" で、両方試して NG。
http://sourceforge.net/project/showfiles.php?group_id=93482 :ndiswrapper から stable版の 1.52 をダウンロードしてインストール。
# mkdir ucg300n # cp /media/cdrom0/Win/driver/UCG300N/WinXP/* ucg300n/ # ls ucg300n netucg3n.inf ucg300n.cat ucg300n.sys # ndiswrapper -i netufg3n.inf # ndiswrapper -l netucg3n : driver installed # ndiswrapper -m
ここまででモジュールのインストールが終わり。一応確認しておく。
# modinfo ndiswrapper filename: /lib/modules/2.6.18-6-686/misc/ndiswrapper.ko author: ndiswrapper team <ndiswrapper-general@lists.sourceforge.net> description: NDIS wrapper driver version: 1.52 license: GPL vermagic: 2.6.18-6-686 SMP mod_unload 686 REGPARM gcc-4.1 depends: usbcore srcversion: 83ECE3945C1CA76F554771B parm: utils_version:Compatible version of utils (read only: 1.9) (charp) parm: hangcheck_interval:The interval, in seconds, for checking if driver is hung. (default: 0) (int) parm: debug:debug level (int) parm: proc_gid:The gid of the files created in /proc (default: 0). (int) parm: proc_uid:The uid of the files created in /proc (default: 0). (int) parm: if_name:Network interface name or template (default: wlan%d) (charp)
大丈夫そうなので、デバイスを接続する。
自動でデバイス用のモジュールをすると思うが、手動でモジュールをロードする場合は modprobe を使う。
(insmod では依存モジュールのロードとかをしない)
# modprobe ndiswrapper
デバイスの認識はこれで OK になった。
以下は、dmesg の抜粋( MACは伏せることにした )
ndiswrapper: driver netucg3n (BUFFALO INC.,08/08/2007, 1.20.00.0001) loaded
wlan0: ethernet device 00:1d:73:**:**:** using NDIS driver: netucg3n, version: 0x0, NDIS version: 0x500, vendor: 'IEEE 802.11n Wireless Card.', 0411:00E8.F.conf
wlan0: encryption modes supported: WEP; TKIP with WPA, WPA2, WPA2PSK; AES/CCMP with WPA, WPA2, WPA2PSK
usbcore: registered new driver ndiswrapper
まだ認証設定がされていないので、無線デバイスが点滅しっぱなしになる。
急いで WPA-PSK のことを調べる。
調べるとデバイスの設定に iwconfig が必要だということが分かった。
また、WPA-PSK で認証するツールは wpa_supplicant が良さそう。
両方とも apt でインストールする。
# apt-get install wireless-tools wpasupplicant
いろいろと試行錯誤した結果、手書きするのは次の二つだった。
(1) /etc/network/interfaces
# wireless connection
allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid xxxxxxxxxxxxxxxx
wpa-driver wext
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
auto wlan0
(2) /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
network={
proto=WPA WPA2
key_mgmt=WPA-PSK
pairwise=TKIP CCMP
group=TKIP CCMP
ssid="xxxxxxxxxxxxxxxx"
psk="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
設定は、以上で終わり。
悩んだのは「psk に何を設定するのか」というところ。
$wpa_passphrase usage: wpa_passphrase <ssid> [passphrase] If passphrase is left out, it will be read from stdin
というコマンドを使って、
[無線設定] - [WPS] ページの「WPS用無線セキュリティ設定」にある
11g 用の SSID と 暗号鍵 をそれぞれ取得(コピー&ペーストのこと)し、
$ wpa_passphrase xxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
network={
ssid="xxxxxxxxxxxxxxxx"
#psk="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
psk=8344322004d26bea205b51bf4f53d0f48d4af8ae9ee4af452e07a041db032b83
}
とやると psk が変換されているように見える。wpa_supplicant が使うのは、この変換後の psk キーらしい。
もうひとつはまったのは、wpa_supplicant の認証で使うデバイス名。
普通 ndiswrapper を使うならデバイス名は ndiswrapper を指定すれば良いと思うけど、
# wpa_supplicant -D ndiswrapper \ -i wlan0 \ -c /etc/wpa_supplicant/wpa_supplicant.conf
では駄目で、
# wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
とやれば認証ができることに気づくまで、かなり時間がかかった。
手動でインストール(make)したパッケージ
ndiswrapper-1.52.tar.gz http://sourceforge.net/project/showfiles.php?group_id=93482&package_id=99148
$ tar xzvf ndiswrapper-1.52.tar.gz $ cd ndiswrapper-1.52 $ make $ sudo make install
インストールしたけど使わなかったので消したパッケージ
[INSTALL, DEPENDENCIES] ndiswrapper-utils-1.1
[INSTALL, DEPENDENCIES] ndiswrapper-common
[INSTALL] ndiswrapper-utils
[INSTALL, DEPENDENCIES] module-assistant
[INSTALL] ndiswrapper-source
参考にしたページ
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/767ndiswrapper.html
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/785ndiswrapper2.html
http://www.atmarkit.co.jp/flinux/rensai/linuxtips/982wpasupplicant.html
http://kurolab.cntl.kyutech.ac.jp/wiki/farm/HowTo/?(Linux)+Buffalo+WLI-CBG54
http://umb.at.webry.info/200411/article_6.html
http://www.h5.dion.ne.jp/~okita/diary/UsingNdiswrapper.html
http://lists.debian.or.jp/debian-users/200702/msg00140.html
http://testzen.ty.land.to/item/304
http://kmuto.jp/open.cgi?%cc%b5%c0%feLAN%c6%b0%ba%ee%be%f5%b6%b7
http://ndiswrapper.sourceforge.net/joomla/