buffalo WHR-HP-GN, Fon2200 は mips 系CPUが搭載されている。
BackTrack 5 Linux(ubuntu) に qemu をインストールして,mips エミュレーターで, openwrt を起動する。更に仮想マシンから USB無線LANアダプタ buffalo WLI-U2-SG54HP (ra73usb) を利用する。
BackTrack 5 で,qemu のインストール
git clone git://git.qemu.org/qemu.git
cd qemu
./configure
make
make install
qemu が対応している malta coreLV board をターゲットにして,openwrt をビルドする。
openwrt のビルド
su - 一般user
svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk/
./scripts/feeds update
./scripts/feeds luci
make menuconfig
Kernel modules > wireless Drivers で rt73usb を追加する。
コンパイルを行う。
make V=99 j=2
~/trunk/bin/malta/openwrt-malta-le-vmlinux.elf がビルドされる。
qemu で mips 仮想マシンを起動する。
cd ~/trunk/bin/malta/
qemu-system-mipsel -kernel openwrt-malta-le-vmlinux.elf –nographic -net nic -net user –usb -redir tcp:888::80
-net nic –net user はユーザモードネットワークの有効化,-usb は usb デバイスの有効化。
-redir tcp:8888::80 は,http://localhost:888/ で,luci に接続できる。
USB 無線LANアダプタの接続
ctrl+a c を押して qemu モニターに切り替える。
info usbhost で ven_id:pr_id を確認し,usb_add host 0411:00d8 で接続する。ctrl+a c で openwrt に戻る。
root@OpenWrt:/# (ctrl+a c)
(qemu) info usbhost
Bus 5, Addr 2, Port 1, Speed 12 Mb/s
Class e0: USB device 0c24:001c
Bus 5, Addr 3, Port 2, Speed 12 Mb/s
Vendor Specific: USB device 08ff:2580, Fingerprint Sensor
Bus 1, Addr 3, Port 2, Speed 480 Mb/s
Still Image: USB device 0411:00d8, WLI-U2-SG54HP
(qemu) usb_add host:0411:00d8
(qemu) [ 139.260000] usb 1-1: new full-speed USB device number 2 using uhci_hcd (ctrl+a c)
root@OpenWrt:/# iwconfig
hwsim0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11bg ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
eth0 no wireless extensions.
ifconfigの結果と,iwlist のスキャン。
root@OpenWrt:/etc/config# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 00:16:01:CA:87:ED
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@OpenWrt:/etc/config# iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 00:16:01:XX:XX:XX
Channel:10
Frequency:2.457 GHz (Channel 10)
Quality=26/70 Signal level=-84 dBm
Encryption key:on
ESSID:"WZR-AMPG300NH_a"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=000002a820093fd2
Extra: Last beacon: 1080ms ago
仮想LAN は,dhcp で 10.0.2.15 が割り当てられる。gw は 10.0.2.2 ,dns は 10.0.2.3。
openwrt はブリッジが起動するのでブリッジから eth0 を切り離す。
brctl show
bectl deiif br-lan eth0
dhcpクライアントを起動する。
udhcpc
/etc/resolv.conf を書き換える。
nameserver 10.0.2.3
ping は外にいかないが,wget http://yahoo.co.jp/ で index.html がダウンロードできる。