2011-08-16 Planex の GW-USMicroN を Fedora 15 で動かす
メイン環境を Ubuntu 10.04 から Fedora 15 に変えたので、Planex GW-USMicroN の設定をした記録。
# Ubuntu は、ほぼ自動認識するので、最近無線LANドライバのインストールについて忘れていた
1. lsusb で、ベンダIDとプロダクトIDを確認する
以下のような行が出れば OK
% lsusb | grep PLANEX Bus 001 Device 002: ID 2019:ed14 PLANEX GW-USMicroN
2. カーネルモジュール(rt2870sta)をインストールする
rt2870sta という名前で探すが見つからなかった、rt2870 で探したらあった。
% sudo yum search rt2870 読み込んだプラグイン:langpacks, presto, refresh-packagekit ============================= N/S Matched: rt2870 ==================== akmod-rt2870.x86_64 : Akmod package for rt2870 kernel module(s) kmod-rt2870.x86_64 : Metapackage which tracks in rt2870 kernel module for kernel kmod-rt2870-2.6.38.6-26.rc1.fc15.x86_64.x86_64 : rt2870 kernel module for 2.6.38.6-26.rc1.fc15.x86_64 kmod-rt2870-2.6.38.6-27.fc15.x86_64.x86_64 : rt2870 kernel module(s) for 2.6.38.6-27.fc15.x86_64 kmod-rt2870-2.6.38.7-30.fc15.x86_64.x86_64 : rt2870 kernel module(s) for 2.6.38.7-30.fc15.x86_64 kmod-rt2870-2.6.38.8-32.fc15.x86_64.x86_64 : rt2870 kernel module(s) for 2.6.38.8-32.fc15.x86_64 kmod-rt2870-2.6.38.8-35.fc15.x86_64.x86_64 : rt2870 kernel module(s) for 2.6.38.8-35.fc15.x86_64 kmod-rt2870-2.6.40-4.fc15.x86_64.x86_64 : rt2870 kernel module(s) for 2.6.40-4.fc15.x86_64 rt2870.noarch : Common files for RaLink rt2870 kernel driver
見つかったなかから、メタパッケージというのが良さそう。インストールする
% sudo yum install kmod-rt2870
3. インストールしたモジュールをロードしてみる
% lsmod | grep rt2870 % sudo modprobe rt2870sta % lsmod | grep rt2870 rt2870sta 532878 0
OK。ロードできている。
モジュールをロードしただけではファイルができていない。ネットで検索すると /etc/modules.conf にデバイスファイル名を書くという対応方法があった。でも確かこのファイル古いし、Fedora15 はネットワークデバイスファイルの命名規則が変わったとか情報も雑誌で読んだので、どういうファイル名を使うか分からない。Debian系 の時は wlan0 を使ってたけどな...
デバイスファイル名に ra0 を使っている新しめのサンプルがネット上にあった。よく分からないので、ralink からダウンロードしたソースを読んでみる。
/etc/modules.conf に "alias ra0 rt2870sta" というデバイス名を登録して、/etc/sysconfig/network-scripts/ifcfg-ra0 を作るという流れが書いてある。
さっそくやってみたところ、ra0 というデバイスは追加されるけど、ネットワークマネージャには無線デバイスが追加されない。
それと、なぜだか、「Wired connection1」と「System ra0」という有線デバイスが別の名前で2個表示されており、どちらを選んでも同じ有線LANの設定画面が開く。
まだ、うまくいっていないので ifconfig で ra0 は見えない。
% ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:636 errors:0 dropped:0 overruns:0 frame:0 TX packets:636 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:44032 (43.0 KiB) TX bytes:44032 (43.0 KiB) p34p1 Link encap:Ethernet HWaddr **:**:**:**:**:** inet addr:192.168.***.*** Bcast:192.168.***.*** Mask:***.***.***.*** inet6 addr: ***************/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:157513 errors:0 dropped:0 overruns:0 frame:0 TX packets:125451 errors:0 dropped:0 overruns:0 carrier:1 collisions:0 txqueuelen:1000 RX bytes:150186054 (143.2 MiB) TX bytes:35735768 (34.0 MiB) Interrupt:44
次に udev を設定する方法を見つけた。(OSとかデバイスが違うけど応用はできそう)
USB の ID を手動で登録して udev のイベントで modprobe によるモジュールロードを行うという流れでやるらしい。
設定ファイルは2つあり、どちらも新規作成した。ちなみに udev のマニュアル読まずに名前はサンプルをそのまま使った。
4. udev 用のイベント処理ルール(でいいのかな)を書く
% vi /etc/udev/rules.d/network_drivers.rules # 内容は以下 ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="2019", ATTR{idProduct}=="ed14", RUN+="/sbin/modprobe -qba rt2870sta"
5. udev から呼び出される modprobe 用の設定を書く
# この時点で /etc/modules.conf は古いからいらないことに気づいて消した。
% vi /etc/modprobe.d/network_drivers.conf # 内容は以下 install rt2870sta /sbin/modprobe --ignore-install rt2870sta $CMDLINE_OPTS; /bin/echo "2019 ed14" > /sys/bus/usb/drivers/rt2870/new_id
6. iwconfig で見えた
iwconfig がなければ wireless-tools パッケージに入ってるのでインストール
% iwconfig lo no wireless extensions. p34p1 no wireless extensions. ra0 Ralink STA ESSID:"11n-AP" Nickname:"RT2870STA" Mode:Auto Frequency=2.412 GHz Access Point: Not-Associated Bit Rate:1 Mb/s RTS thr:off Fragment thr:off Link Quality=10/100 Signal level:0 dBm Noise level:0 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
7. 最後にデバイス用のネットワーク接続設定を作る
ネットワーク接続を管理するツールで設定しても良さそう。でも WPA2 only にしたかったのと、IPv6 を切って使いたかったので、自動作成したあと、/etc/sysconfig/network-scripts/ の下を探して一部手動で修正した。
# 修正箇所は PROTO=WPA2 を追加、IPV6INIT を no に変更
ESSID="無線ネットワークの名前" MODE=Managed KEY_MGMT=WPA-PSK PROTO=WPA2 TYPE=Wireless BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME="この設定の名前 ra0 としとくとわかりやすいかも" UUID=<ここは自動でつくられる> ONBOOT=yes
[設定ファイルまとめ]
ツールが生成した無線LANの設定ファイル /etc/sysconfig/network-scripts/ifcfg-ra0 ツールが生成した無線LANのパスフレーズ /etc/sysconfig/network-scripts/keys-ra0 新規作成 /etc/udev/rule.d/network_drivers.rules 新規作成 /etc/modprobe.d/network_drivers.conf
2011-05-28 メモをgpgで保存するのが楽しい
人に見られたくないメモを gpg で暗号化している。パスワードリストもそのひとつだが、新しいパスワードを追加するたびに「複合化して編集、保存して暗号化」をするのが少し面倒。なので、bashスクリプトを書いた。よくある第三者提供のツールは便利だが、責任をとってくれるわけではないので、重要なメモの保存には使いたくないと考えている。
とりあえずパスワードリストを更新するやつをこんな感じで書いた。
#!/bin/bash
if [[ -z $REGISTER ]]; then
echo "REGISTER paramete is not set."
echo "anything bad in your login run script."
exit
fi
if [[ -z $MYEMAILADDRESS ]]; then
echo "ah...Can you set up your Email address?"
exit
fi
decrypt_registerfile() {
cleanup_buffer
gpg -d $REGISTER > $BUFFER
if [[ -s $BUFFER ]]; then
vi $BUFFER
else
echo "Bad passphrase."
cleanup_buffer
exit
fi
}
encrypt_registerfile() {
echo "Now encrypt register file ($BUFFER). for save your privacy."
gpg -e -r $MYEMAILADDRESS $BUFFER
}
write_registerfile() {
if [[ $BUFFER ]]; then
echo basename "$BUFFER"
fi
echo -n "Save $BUFFER as new register file? [y/N]"
read ANS
if [[ -n $ANS && "Y" == $ANS || "y" == $ANS ]] ; then
echo "O.K. Just a moment."
else
echo "CANCELED. do NOT save your register file."
cleanup_buffer
exit
fi
}
cleanup_buffer() {
if [[ -s $REGISTER ]]; then
if [[ -f $BUFFER ]]; then
rm $BUFFER
echo "cleaned up buffer."
fi
else
echo "CANCELED clean up buffer, original($REGISTER) is missing."
fi
}
BUFFER=${REGISTER%.gpg}
decrypt_registerfile
write_registerfile
encrypt_registerfile
echo "Up date register file."
cleanup_buffer
2009-03-28 VirtualBox: VDI を圧縮する
VirtualBox 上の Windows XP のディスク(VDI)が大きくなってきたため、
バックアップに時間がかかっている。圧縮できるみたいのなのでためす。
環境: "Windows XP" on "Ubuntu 8.10"
対象: ~/.VirtualBox/VDI/winxp.vdi
VirtualBox から Windows を起動し、次の手順で空き領域を整理した。
- 0. %windir%\prefetch\* を削除
- 1. (c:)ドライブのインデックス作成を解除
- 2. %windir%\$* (Windows Update のアンインストール情報など)を削除
- 3. ブラウザのキャッシュも全て消す。
- 4. 使っていない不要なアプリケーションをアンインストールする
- 5. システムの復元で、古い復元ポイントを消す
- 6. システムの復元を無効にする
- 7. スワップファイルを無効(サイズ 0 で設定)にする
- 8. 一度再起動する
- 9. デフラグをかける
- 10. dkclear でディスク(c:)の空き領域をゼロクリアする
- 11. Windows をシャットダウンする。
その後、VBoxManage で VDI ファイルを圧縮した。5 GB が 2.5GB くらいになった。
(VDI$) ls -l winxp.vdi -rw------- 1 asesino asesino 5043712512 2009-03-28 16:14 winxp.vdi (VDI$) VBoxManage modifyvdi winxp.vdi compact VirtualBox Command Line Management Interface Version 2.0.4_OSE (C) 2005-2008 Sun Microsystems, Inc. All rights reserved. Shrinking '/home/asesino/.VirtualBox/VDI/winxp.vdi':0%...........10%..........20%..........30%..........40%..........50%..........60%..........70%..........80%..........90%..........100% (VDI$) ls -l winxp.vdi -rw------- 1 asesino asesino 2501964288 2009-03-28 16:24 winxp.vdi
2009-03-06 ndiswrapper を使った無線LANの設定(lenny)
lenny で起動した時にも無線LAN を使うことにしたので、ndiswrapper を入れる。
カーネルモジュール ndiswrapper.ko がパッケージからインストールされなかったので、module-assistant でコンパイルする。
# module-assistant a-i ndiswrapper Updated infos about 1 packages Getting source for kernel version: 2.6.26-1-686 apt-get install linux-headers-2.6.26-1-686 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: binutils cpp-4.1 gcc-4.1 gcc-4.1-base libc6-dev linux-headers-2.6.26-1-common linux-kbuild-2.6.26 linux-libc-dev Suggested packages: binutils-doc gcc-4.1-locales gcc-4.1-multilib gcc-4.1-doc libmudflap0-dev glibc-doc manpages-dev Recommended packages: gcc c-compiler The following NEW packages will be installed: binutils cpp-4.1 gcc-4.1 gcc-4.1-base libc6-dev linux-headers-2.6.26-1-686 linux-headers-2.6.26-1-common linux-kbuild-2.6.26 linux-libc-dev 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 14.1MB of archives. After this operation, 66.3MB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 http://ftp.riken.jp lenny/main binutils 2.18.1~cvs20080103-7 [2686kB] Get:2 http://ftp.riken.jp lenny/main gcc-4.1-base 4.1.2-25 [207kB] Get:3 http://ftp.riken.jp lenny/main cpp-4.1 4.1.2-25 [2317kB] Get:4 http://ftp.riken.jp lenny/main gcc-4.1 4.1.2-25 [417kB] Get:5 http://ftp.riken.jp lenny/main linux-libc-dev 2.6.26-13 [756kB] Get:6 http://ftp.riken.jp lenny/main libc6-dev 2.7-18 [3377kB] Get:7 http://ftp.riken.jp lenny/main linux-headers-2.6.26-1-common 2.6.26-13 [3791kB] Get:8 http://ftp.riken.jp lenny/main linux-kbuild-2.6.26 2.6.26-3 [194kB] Get:9 http://ftp.riken.jp lenny/main linux-headers-2.6.26-1-686 2.6.26-13 [397kB] Fetched 14.1MB in 11s (1254kB/s) Selecting previously deselected package binutils. (Reading database ... 102972 files and directories currently installed.) Unpacking binutils (from .../binutils_2.18.1~cvs20080103-7_i386.deb) ... Selecting previously deselected package gcc-4.1-base. Unpacking gcc-4.1-base (from .../gcc-4.1-base_4.1.2-25_i386.deb) ... Selecting previously deselected package cpp-4.1. Unpacking cpp-4.1 (from .../cpp-4.1_4.1.2-25_i386.deb) ... Selecting previously deselected package gcc-4.1. Unpacking gcc-4.1 (from .../gcc-4.1_4.1.2-25_i386.deb) ... Selecting previously deselected package linux-libc-dev. Unpacking linux-libc-dev (from .../linux-libc-dev_2.6.26-13_i386.deb) ... Selecting previously deselected package libc6-dev. Unpacking libc6-dev (from .../libc6-dev_2.7-18_i386.deb) ... Selecting previously deselected package linux-headers-2.6.26-1-common. Unpacking linux-headers-2.6.26-1-common (from .../linux-headers-2.6.26-1-common_2.6.26-13_i386.deb) ... Selecting previously deselected package linux-kbuild-2.6.26. Unpacking linux-kbuild-2.6.26 (from .../linux-kbuild-2.6.26_2.6.26-3_i386.deb) ... Selecting previously deselected package linux-headers-2.6.26-1-686. Unpacking linux-headers-2.6.26-1-686 (from .../linux-headers-2.6.26-1-686_2.6.26-13_i386.deb) ... Processing triggers for man-db ... Setting up binutils (2.18.1~cvs20080103-7) ... Setting up gcc-4.1-base (4.1.2-25) ... Setting up cpp-4.1 (4.1.2-25) ... Setting up gcc-4.1 (4.1.2-25) ... Setting up linux-libc-dev (2.6.26-13) ... Setting up libc6-dev (2.7-18) ... Setting up linux-headers-2.6.26-1-common (2.6.26-13) ... Setting up linux-kbuild-2.6.26 (2.6.26-3) ... Setting up linux-headers-2.6.26-1-686 (2.6.26-13) ... Creating symlink... apt-get install build-essential Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: dpkg-dev g++ g++-4.3 gcc gcc-4.3 libgomp1 libstdc++6-4.3-dev libtimedate-perl Suggested packages: debian-keyring g++-multilib g++-4.3-multilib gcc-4.3-doc libstdc++6-4.3-dbg gcc-multilib manpages-dev autoconf automake1.9 libtool flex bison gdb gcc-doc gcc-4.3-multilib libmudflap0-4.3-dev gcc-4.3-locales libgcc1-dbg libgomp1-dbg libmudflap0-dbg libstdc++6-4.3-doc The following NEW packages will be installed: build-essential dpkg-dev g++ g++-4.3 gcc gcc-4.3 libgomp1 libstdc++6-4.3-dev libtimedate-perl 0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Need to get 8374kB of archives. After this operation, 25.4MB of additional disk space will be used. Do you want to continue [Y/n]? Get:1 http://ftp.riken.jp lenny/main libgomp1 4.3.2-1.1 [13.2kB] Get:2 http://ftp.riken.jp lenny/main gcc-4.3 4.3.2-1.1 [2747kB] Get:3 http://ftp.riken.jp lenny/main gcc 4:4.3.2-2 [5008B] Get:4 http://ftp.riken.jp lenny/main libstdc++6-4.3-dev 4.3.2-1.1 [1389kB] Get:5 http://ftp.riken.jp lenny/main g++-4.3 4.3.2-1.1 [3414kB] Get:6 http://ftp.riken.jp lenny/main g++ 4:4.3.2-2 [1368B] Get:7 http://ftp.riken.jp lenny/main libtimedate-perl 1.1600-9 [32.9kB] Get:8 http://ftp.riken.jp lenny/main dpkg-dev 1.14.25 [765kB] Get:9 http://ftp.riken.jp lenny/main build-essential 11.4 [7118B] Fetched 8374kB in 7s (1126kB/s) Selecting previously deselected package libgomp1. (Reading database ... 113390 files and directories currently installed.) Unpacking libgomp1 (from .../libgomp1_4.3.2-1.1_i386.deb) ... Selecting previously deselected package gcc-4.3. Unpacking gcc-4.3 (from .../gcc-4.3_4.3.2-1.1_i386.deb) ... Selecting previously deselected package gcc. Unpacking gcc (from .../gcc_4%3a4.3.2-2_i386.deb) ... Selecting previously deselected package libstdc++6-4.3-dev. Unpacking libstdc++6-4.3-dev (from .../libstdc++6-4.3-dev_4.3.2-1.1_i386.deb) ... Selecting previously deselected package g++-4.3. Unpacking g++-4.3 (from .../g++-4.3_4.3.2-1.1_i386.deb) ... Selecting previously deselected package g++. Unpacking g++ (from .../g++_4%3a4.3.2-2_i386.deb) ... Selecting previously deselected package libtimedate-perl. Unpacking libtimedate-perl (from .../libtimedate-perl_1.1600-9_all.deb) ... Selecting previously deselected package dpkg-dev. Unpacking dpkg-dev (from .../dpkg-dev_1.14.25_all.deb) ... Selecting previously deselected package build-essential. Unpacking build-essential (from .../build-essential_11.4_i386.deb) ... Processing triggers for man-db ... Setting up libgomp1 (4.3.2-1.1) ... Setting up gcc-4.3 (4.3.2-1.1) ... Setting up gcc (4:4.3.2-2) ... Setting up libtimedate-perl (1.1600-9) ... Setting up dpkg-dev (1.14.25) ... Setting up libstdc++6-4.3-dev (4.3.2-1.1) ... Setting up g++-4.3 (4.3.2-1.1) ... Setting up g++ (4:4.3.2-2) ... Setting up build-essential (11.4) ... Done! download Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: debhelper gettext html2text intltool-debian libcompress-raw-zlib-perl libcompress-zlib-perl libfile-remove-perl libio-compress-base-perl libio-compress-zlib-perl libio-stringy-perl libmail-box-perl libmail-sendmail-perl libmailtools-perl libmime-types-perl libobject-realize-later-perl libuser-identity-perl po-debconf Suggested packages: dh-make cvs gettext-doc libmime-tools-perl libhtml-format-perl libmail-imapclient-perl kernel-package The following NEW packages will be installed: debhelper gettext html2text intltool-debian libcompress-raw-zlib-perl libcompress-zlib-perl libfile-remove-perl libio-compress-base-perl libio-compress-zlib-perl libio-stringy-perl libmail-box-perl libmail-sendmail-perl libmailtools-perl libmime-types-perl libobject-realize-later-perl libuser-identity-perl ndiswrapper-source po-debconf 0 upgraded, 18 newly installed, 0 to remove and 0 not upgraded. Need to get 5482kB of archives. After this operation, 15.6MB of additional disk space will be used. Get:1 http://ftp.riken.jp lenny/main html2text 1.3.2a-5 [91.5kB] Get:2 http://ftp.riken.jp lenny/main gettext 0.17-4 [2672kB] Get:3 http://ftp.riken.jp lenny/main intltool-debian 0.35.0+20060710.1 [30.8kB] Get:4 http://ftp.riken.jp lenny/main po-debconf 1.0.15 [237kB] Get:5 http://ftp.riken.jp lenny/main debhelper 7.0.15 [554kB] Get:6 http://ftp.riken.jp lenny/main libcompress-raw-zlib-perl 2.012-1 [56.4kB] Get:7 http://ftp.riken.jp lenny/main libio-compress-base-perl 2.012-1 [59.4kB] Get:8 http://ftp.riken.jp lenny/main libio-compress-zlib-perl 2.012-1 [148kB] Get:9 http://ftp.riken.jp lenny/main libcompress-zlib-perl 2.012-1 [36.7kB] Get:10 http://ftp.riken.jp lenny/main libfile-remove-perl 1.42-1 [12.9kB] Get:11 http://ftp.riken.jp lenny/main libio-stringy-perl 2.110-4 [99.7kB] Get:12 http://ftp.riken.jp lenny/main libmime-types-perl 1.24-1 [30.8kB] Get:13 http://ftp.riken.jp lenny/main libmailtools-perl 2.03-1 [96.6kB] Get:14 http://ftp.riken.jp lenny/main libobject-realize-later-perl 0.18-1 [17.7kB] Get:15 http://ftp.riken.jp lenny/main libuser-identity-perl 0.92-2 [75.5kB] Get:16 http://ftp.riken.jp lenny/main libmail-box-perl 2.082-2 [1078kB] Get:17 http://ftp.riken.jp lenny/main libmail-sendmail-perl 0.79-5 [23.4kB] Get:18 http://ftp.riken.jp lenny/main ndiswrapper-source 1.53-2 [161kB] Fetched 5482kB in 4s (1183kB/s) Selecting previously deselected package html2text. (Reading database ... 114394 files and directories currently installed.) Unpacking html2text (from .../html2text_1.3.2a-5_i386.deb) ... Selecting previously deselected package gettext. Unpacking gettext (from .../gettext_0.17-4_i386.deb) ... Selecting previously deselected package intltool-debian. Unpacking intltool-debian (from .../intltool-debian_0.35.0+20060710.1_all.deb) ... Selecting previously deselected package po-debconf. Unpacking po-debconf (from .../po-debconf_1.0.15_all.deb) ... Selecting previously deselected package debhelper. Unpacking debhelper (from .../debhelper_7.0.15_all.deb) ... Selecting previously deselected package libcompress-raw-zlib-perl. Unpacking libcompress-raw-zlib-perl (from .../libcompress-raw-zlib-perl_2.012-1_i386.deb) ... Selecting previously deselected package libio-compress-base-perl. Unpacking libio-compress-base-perl (from .../libio-compress-base-perl_2.012-1_all.deb) ... Selecting previously deselected package libio-compress-zlib-perl. Unpacking libio-compress-zlib-perl (from .../libio-compress-zlib-perl_2.012-1_all.deb) ... Selecting previously deselected package libcompress-zlib-perl. Unpacking libcompress-zlib-perl (from .../libcompress-zlib-perl_2.012-1_all.deb) ... Selecting previously deselected package libfile-remove-perl. Unpacking libfile-remove-perl (from .../libfile-remove-perl_1.42-1_all.deb) ... Selecting previously deselected package libio-stringy-perl. Unpacking libio-stringy-perl (from .../libio-stringy-perl_2.110-4_all.deb) ... Selecting previously deselected package libmime-types-perl. Unpacking libmime-types-perl (from .../libmime-types-perl_1.24-1_all.deb) ... Selecting previously deselected package libmailtools-perl. Unpacking libmailtools-perl (from .../libmailtools-perl_2.03-1_all.deb) ... Selecting previously deselected package libobject-realize-later-perl. Unpacking libobject-realize-later-perl (from .../libobject-realize-later-perl_0.18-1_all.deb) ... Selecting previously deselected package libuser-identity-perl. Unpacking libuser-identity-perl (from .../libuser-identity-perl_0.92-2_all.deb) ... Selecting previously deselected package libmail-box-perl. Unpacking libmail-box-perl (from .../libmail-box-perl_2.082-2_all.deb) ... Selecting previously deselected package libmail-sendmail-perl. Unpacking libmail-sendmail-perl (from .../libmail-sendmail-perl_0.79-5_all.deb) ... Selecting previously deselected package ndiswrapper-source. Unpacking ndiswrapper-source (from .../ndiswrapper-source_1.53-2_all.deb) ... Processing triggers for man-db ... Setting up html2text (1.3.2a-5) ... Setting up gettext (0.17-4) ... Setting up intltool-debian (0.35.0+20060710.1) ... Setting up po-debconf (1.0.15) ... Setting up debhelper (7.0.15) ... Setting up libcompress-raw-zlib-perl (2.012-1) ... Setting up libio-compress-base-perl (2.012-1) ... Setting up libio-compress-zlib-perl (2.012-1) ... Setting up libcompress-zlib-perl (2.012-1) ... Setting up libfile-remove-perl (1.42-1) ... Setting up libio-stringy-perl (2.110-4) ... Setting up libmime-types-perl (1.24-1) ... Setting up libmailtools-perl (2.03-1) ... Setting up libobject-realize-later-perl (0.18-1) ... Setting up libuser-identity-perl (0.92-2) ... Setting up libmail-box-perl (2.082-2) ... Setting up libmail-sendmail-perl (0.79-5) ... Setting up ndiswrapper-source (1.53-2) ... Updated infos about 1 packages unpack Extracting the package tarball, /usr/src/ndiswrapper.tar.bz2, please wait... "/usr/share/modass/packages/default.sh" build KVERS=2.6.26-1-686 KSRC=/lib/modules/2.6.26-1-686/build KDREV=2.6.26-13 kdist_image Done with /usr/src/ndiswrapper-modules-2.6.26-1-686_1.53-2+2.6.26-13_i386.deb . dpkg -Ei /usr/src/ndiswrapper-modules-2.6.26-1-686_1.53-2+2.6.26-13_i386.deb Selecting previously deselected package ndiswrapper-modules-2.6.26-1-686. (Reading database ... 115687 files and directories currently installed.) Unpacking ndiswrapper-modules-2.6.26-1-686 (from .../ndiswrapper-modules-2.6.26-1-686_1.53-2+2.6.26-13_i386.deb) ... Setting up ndiswrapper-modules-2.6.26-1-686 (1.53-2+2.6.26-13) ...
2009-02-07 ndiswrapper を使った無線LANの設定(ubuntu 8.10)
ハードディスクを換装して OS を入れ直したので、Ubuntu 用に設定する。
過去に設定した記録 http://d.hatena.ne.jp/asesino/20080511 を見ながらやる。
# aptitude install ndiswrapper
# mkdir ~/src ; cd src/ # mount /mnt/etchroot # cp -r /mnt/etchroot/root/ucg300n/ . # cd ucg300n/ # ndiswrapper -i netucg3n.inf installing netucg3n ...
# ndiswrapper -l
netucg3n : driver installed
device (0411:00E8) present
# ndiswrapper -m
adding "alias wlan0 ndiswrapper" to /etc/modprobe.d/ndiswrapper ...
************************************************************************
*
* The update-modules command is deprecated and should not be used!
*
************************************************************************
# modinfo ndiswrapper
filename: /lib/modules/2.6.27-11-generic/kernel/ubuntu/ndiswrapper/ndiswrapper.ko
license: GPL
version: 1.53
description:NDIS wrapper driver
author: ndiswrapper team <ndiswrapper-general@lists.sourceforge.net>
srcversion: ED1F39AAE9904B93C47D2FD
depends: usbcore
vermagic: 2.6.27-11-generic SMP mod_unload modversions 586
parm: if_name:Network interface name or template (default: wlan%d) (charp)
parm: proc_uid:The uid of the files created in /proc (default: 0). (int)
parm: proc_gid:The gid of the files created in /proc (default: 0). (int)
parm: debug:debug level (int)
parm: hangcheck_interval:The interval, in seconds
, for checking if driver is hung. (default: 0) (int)
parm: utils_version:Compatible version of utils (read only: 1.9) (charp)
# modprobe ndiswrapper
# dmesg | grep ndis
ndiswrapper version 1.53 loaded (smp=yes, preempt=no)
ndiswrapper: driver netucg3n (BUFFALO INC.,08/08/2007, 1.20.00.0001) loaded
usbcore: registered new interface driver ndiswrapper
- ネットワークの設定を書く
# cd /etc/network # cp interfaces interfaces.org # vi interfaces
# wireless connection allow-hotplug wlan0 iface wlan0 inet dhcp wireless-essid XXXXXXXXXXXX wpa-driver wext wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf auto wlan0
# cp /mnt/etchroot/etc/wpa_supplicant/wpa_supplicant.conf wpa_supplicant/ # vi /etc/wpa_supplicant/wpa_supplicant.conf
/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="XXXXXXXXXXXX"
psk="???????????????????????????????????????????????????????????????"
}
# /etc/init.d/networking stop
* Deconfiguring network interfaces...
# /etc/init.d/networking start
* Configuring network interfaces...
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/wlan0/??:??:??:??:??:??
Sending on LPF/wlan0/??:??:??:??:??:??
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPOFFER of 192.168.11.3 from 192.168.11.1
DHCPREQUEST of 192.168.11.3 on wlan0 to 255.255.255.255 port 67
DHCPACK of 192.168.11.3 from 192.168.11.1
bound to 192.168.11.3 -- renewal in 71890 seconds.
[ OK ]
# /sbin/ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr ??:??:??:??:??:??
inet addr:192.168.11.3 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: ????:????:????:????:????:????/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2269 (2.2 KB) TX bytes:5200 (5.2 KB)
2009-02-05 ノートPCの grub 設定
TOSHIBA EX1/524CD は 40GB で狭かったので WD1600BEVE (160 GB)をつけた。
で、こんなパーテションにしてみた。
# fdisk -l /dev/sda Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xd3522a74 Device Boot Start End Blocks Id System /dev/sda1 * 1 5222 41945683+ 7 HPFS/NTFS /dev/sda2 5223 6527 10482412+ 83 Linux /dev/sda3 6528 7832 10482412+ 83 Linux /dev/sda4 7833 19457 93377812+ 5 Extended /dev/sda5 7833 9137 10482381 83 Linux /dev/sda6 9138 19268 81377226 83 Linux /dev/sda7 19269 19457 1518111 82 Linux swap / Solaris
- Windwos は基本パーテションの一番目にいれるのがいい。
- /home は Ubuntu, Debian, CentOS で同じ場所 (/home/hda6) にした
- Ubuntu だけは、SCSI じゃない hda のことを sda と呼んでいるけど、そういう仕様なのだろう。画像も Ubuntu の Live CD でとったから /dev/sda になっている。
default 0 timeout 30 color cyan/blue white/blue title Ubuntu 8.10 - Intrepid Ibex (on /dev/sda3) root (hd0,2) kernel /boot/vmlinuz-2.6.27-11-generic root=/dev/sda3 ro quiet splash initrd /boot/initrd.img-2.6.27-11-generic savedefault quiet title Debian - lenny (on /dev/hda2) root (hd0,1) kernel /boot/vmlinuz-2.6.26-1-686 root=/dev/hda2 ro quiet initrd /boot/initrd.img-2.6.26-1-686 savedefault boot title Cent OS 5.2 (on /dev/hda5) root (hd0,4) kernel /boot/vmlinuz-2.6.18-92.el5 root=/dev/hda5 ro quiet initrd /boot/initrd-2.6.18-92.el5.img savedefault boot title Windows XP Home Edition (on /dev/sda1 ) root (hd0,0) savedefault makeactive chainloader +1
2008-05-11 無線LAN on Debian
使用機材
■ 光プレミアム: [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は使わないと思うので )とりあえず考えることは以下のようになった。
■ ドライバの作成で、まずはまる。
このルータに付属している 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 を使う。
# modprobe ndiswrapper
以下は、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-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
とやれば認証ができることに気づくまで、かなり時間がかかった。
■ apt でインストールしたパッケージ
(1) 必須(だと思われる)
wpasupplicant, wireless-tools
(2) WPA 認証状態を確認するために入れた
wpagui
(3) DHCPクライアント(Debian で使える三種類*2のうちの一つ)
dhcp3-client
■ 手動でインストール(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

