アットウィキロゴ

FrontPage

  • Linuxで無線LAN 自宅ではノートパソコンのために無線LANを使ってるいる。無線LANだとどこでも電波さえ届けばInternetやファイルサーバを見たりとかとても便利。ケーブルがぐちゃぐちゃしないのもいいよね。Windowsであれば無線カードについてきたドライバや設定ツールを使えば、簡単に無線LANの設定ができてたちまちInternetを使用することができる。もちろんLinuxでも無線LANの恩恵を受けたいので、Linuxでも使用できるように設定してみる。 今回は、Thinkpad X30にBUFFALOのPCMCIAカードWLI2-CB-G54Lを使って無線LANできるかどうかを試しました。結論から先に言うとNdiswrapperを使用して使えるようになりました。構成は以下。

環境

機種: Thinkpad X30 (2672-41J)

無線LANカード: Buffalo WLI2-CB-G54L

ディストリビュージョン: Fedora Core 1

Kernel: 2.4.32 (2.4.22からアップグレード)

Ndiswrapper: ndiswrapper-1.1

Windowsドライバ (infファイル): NET2G54L.inf (Ver.6.3) Buffaloのドライバ

Ndiswrapperを導入するにはKernelのバージョンが2.6.6または2.4.26以降でなければならないのとkernelのソースが必要になります。Fedora Core 1ですとKernelのアップグレードが必要になり、今回は2.4.32にアップグレードして使用しています。ここから先はアップグレードが完了しているものとして話しを進めます。(2.4.32へのアップグレード作業については<a href="http://asia.dip.jp/hiro/linux/kernel24.htm">こちら</a>を確認してください)

インストール

NdiswrapperはWindowsのドライバを使用して無線LANカードを認識させ、無線LANを使用できるようにします。 まずはNdiswrapperのソースを http://ndiswrapper.sourceforge.net/ sourceforgeのページにいきDownloadから入手する。今回自分が試したバージョンは1.1。取得できたらまずはInstall

[root@localhost tmp]# tar zxvf ndiswrapper-1.1.tar.gz
[root@localhost tmp]# cd ndiswrapper-1.1
[root@localhost ndiswrapper-1.1]# make
[root@localhost ndiswrapper-1.1]# make install

上記でInstall完了。次にWindowsのドライバをNdiswrapperに読み込ませます。ドライバファイルはBuffaloのホームページからDownloadしておき、lhaにて解凍しておきます。(解凍するコマンドは"lha -x xxxx.exe<自己解凍形式のドライバファイル>")

[root@localhost ndiswrapper-1.1]# ndiswrapper -i net2g54l.inf

上手く読み込まれたかどうかの確認

[root@localhost ndiswrapper-1.1]# ndiswrapper  -l
  -> net2g54l        driver present, hardware present

上記のように表示されていれば、認識されているはず。

モジュールの読み込みとWEPの設定

insmodまたはmodprobeコマンドでndiswrapperのモジュールを読み込む

[root@localhost ndiswrapper-1.1]# insmod ndiswrapper

モジュールの読み込みに成功すれば、dmesgで下記のように表示される

[root@localhost ndiswrapper-1.1]# dmesg
  (途中省略)
ndiswrapper version 1.1 loaded (preempt=no,smp=no)
ndiswrapper: driver net2g54l (BUFFALO INC.,09/08/2004,2.27.09.2004) loaded
PCI: Setting latency timer of device 02:00.0 to 64
ndiswrapper: using irq 11
divert: allocating divert_blk for wlan0
wlan0: ndiswrapper ethernet device 00:0d:0b:63:67:91 using driver net2g54l, configuration file 17FE:2220:1154:0334.5.conf
wlan0: encryption modes supported: WEP, WPA with TKIP, WPA with AES/CCMP

iwconfigコマンドでWireless Interfaceの状況を表示してみる。Loopbackとeth0も表示されるがWireless Interfaceではないためessidなどの情報は表示されない。

[root@localhost ndiswrapper-1.1]# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

Warning: Driver for device wlan0 has been compiled with version 16
of Wireless Extension, while this program is using version 15.
Some things may be broken...

wlan0     IEEE 802.11g  ESSID:off/any
          Mode:Managed  Channel:0  Access Point: 00:00:00:00:00:00
          Bit Rate:1Mb/s   Tx-Power:0 dBm
          RTS thr:2347 B   Fragment thr:2346 B
          Encryption key:off
          Power Management:off
          Link Quality:100/0  Signal level:-200 dBm  Noise level:-256 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

WEP使用しているので、WEPの設定をする。今回設定している環境ではWEP128bit文字列です。

[root@localhost ndiswrapper-1.1]# iwconfig wlan0 essid '''essid''' key restricted s:'''13字の文字列'''

再度iwconfigを実行するとESSIDとEncryption keyが設定されていることが分かる

[root@localhost ndiswrapper-1.1]# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

Warning: Driver for device wlan0 has been compiled with version 16
of Wireless Extension, while this program is using version 15.
Some things may be broken...

wlan0     IEEE 802.11g  ESSID:"<i>essid</i>"
          Mode:Managed  Frequency:2.462GHz  Access Point: 00:0D:0B:53:91:0B
          Bit Rate:54Mb/s   Tx-Power:0 dBm
          RTS thr:2347 B   Fragment thr:2346 B
          Encryption key:6869-726F-6861-7275-6869-746F-65   Security mode:restricted
          Power Management:off
          Link Quality:100/0  Signal level:-54 dBm  Noise level:-256 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

ネットワークの設定

ESSIDとEncryptionの設定が終わったので、IPアドレスとRouteの設定をする。まずはIPアドレス。今回は192.168.2.0/24で手動でIPアドレスを割り当てた。

[root@localhost ndiswrapper-1.1]# ifconfig wlan0 up 192.168.2.101
[root@localhost ndiswrapper-1.1]# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3109 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3109 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:304176 (297.0 Kb)  TX bytes:304176 (297.0 Kb)

wlan0     Link encap:Ethernet  HWaddr 00:0D:0B:63:67:91
          inet addr:192.168.2.101  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:485 errors:0 dropped:0 overruns:0 frame:0
          TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:177412 (173.2 Kb)  TX bytes:8198 (8.0 Kb)
          Memory:10800800-10800fff

Default Gatewayの設定。ブロードバンドルーターを使用しているので、ブロードバンドルーターのLAN側のアドレスをDefault Gatewayに設定する。

[root@localhost ndiswrapper-1.1]# route add default gw 192.168.2.1 wlan0
[root@localhost ndiswrapper-1.1]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 wlan0
169.254.0.0     *               255.255.0.0     U     0      0        0 lo
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         .               0.0.0.0         UG    0      0        0 wlan0

以上で設定は完了。全ての作業が上手くいっていれば、無線LANを使用してWebの閲覧などができる状態になっているはずです。また、これらの作業を毎回手動で実施するのは面倒なので、無線LANを使用する際には下記のようなスクリプトをrootで実行している。

#!/bin/bash
insmod ndiswrapper
sleep 2
ipconfig wlan0 up 192.168.2.101
sleep 2
route add default gw 192.168.2.1 wlan0

Atok X for Linuxで快適な日本語入力環境を

最終更新:2007年07月07日 18:46