[[PageOutline]] * 注意: 非純正ファームウェアで無線を使うと(日本では)電波法違反になる可能性がある。 * see also [../../Linux/OpenWRT] = reference = * [http://matsuk-xmit.blogspot.jp/2012/03/wzr-hp-ag300hdd-wrt-openwrt.html matsuk_start_xmit: WZR-HP-AG300HにDD-WRT / OpenWrtをインストールする] > DD-WRTと比べると運用方法も一気に難易度があがります。自分で全部manageしたいという方にしかおすすめできません。 > * T8 トルクスドライバー > * マイナスドライバー (筐体ひっぺがし用) > * TTLレベルのシリアル接続ができるケーブル (秋月のFT232RLとか) > * はんだ、はんだごて、銅線とか。ようははんだづけしなきゃならんです。 * 後述するが、純正ファームウェアからWebUI経由で適用出来る * [http://wiki.openwrt.org/toh/buffalo/wzr-hp-ag300h Buffalo WZR-HP-AG300H - OpenWrt Wiki] * [http://wiki.openwrt.org/doc/howto/hardware.button Attach functions to the hardware button - OpenWrt Wiki] * [http://ameblo.jp/pirorigin/entry-10997073769.html WZR-HP-AG300HをDD-WRT化に|デジタル家電・PC イマコリ!!] = binary = * DD-WRT * ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2011/12-20-11-r18024/buffalo_wzr-hp-ag300h/ * OpenWRT * http://downloads.openwrt.org/snapshots/trunk/ar71xx/ = Official Firm = * 純正ファームウェアへの戻し方 * WAN以外のポートに接続する * [http://buffalo.jp/download/driver/lan/wzr-hp-ag300h_fw-win.html ドライバーダウンロード WZR-HP-AG300Hシリーズ | BUFFALO バッファロー] * wzrhpag300h-172.exe > wzrhpag300h-172 1. $ sudo ifconfig eth0:1 192.168.11.2 1. $ sudo arp -s 192.168.11.1 02:aa:bb:cc:dd:20 1. $ tftp 192.168.11.1 {{{ tftp> binary tftp> put wzrhpag300h-172 Sent 20467964 bytes in 26.5 seconds }}} * DIAG LED(赤)が点滅すれば成功 * [http://www34.atwiki.jp/ddwrt/pages/19.html DD-WRTまとめwiki - Buffaloルータのデバッグモード] > http://192.168.11.1/cgi-bin/cgi?req=frm&frm=py-db/55debug.html > * ユーザー名:bufpy > * パスワード:otdpopy+ルートのパスワード * 初期状態でrootにパスワードが設定されていない状態では「otdpopy」 * telnetdの起動や、/var/log/messages、その他の設定状況が見られる * リセットボタン * 純正ファームウェアでも、DD-WRTのデフォルト状態でも動作する * OpenWRTではsquashfsを使った上で、スクリプトを設置しないと動作しない = transfer firmware with tftp = * see [http://wiki.openwrt.org/jp/toh/buffalo/wzr-hp-ag300h#tftpを使用してインストールする TFTPを使用してインストールする] > 訳注) 日本版のAG300Hは標準状態では、OpenWrtファームウェアイメージをtftp経由でアップロードを行っても無視されますので、まずはじめに[http://wiki.openwrt.org/toh/buffalo/wzr-hp-g300h#problem.with.newer.and.japanese.versions.locked.u-boot.too.short.time.tftp.window こちら]を参照してブートローダの設定変更を行ってください。 * 純正ファームへの書き戻しは、「setenv accept_open_rt_fmt 1」なしでも可能 * それ以外は、setenv無しには無理な模様 * mitty@ubuntu64:~/OpenWRT$ tftp 192.168.11.1 {{{ tftp> binary tftp> put openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-tftp.bin Sent 2555940 bytes in 17.1 seconds tftp> }}} * 変化しない * mitty@ubuntu64:~/OpenWRT$ sudo ifconfig eth0:1 192.168.11.2 * mitty@ubuntu64:~/OpenWRT$ sudo arp -s 192.168.11.1 02:aa:bb:cc:dd:20 * mitty@ubuntu64:~$ ifconfig eth0:1 {{{ eth0:1 Link encap:Ethernet HWaddr 00:0c:29:a3:81:7f inet addr:192.168.11.2 Bcast:192.168.11.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 }}} * mitty@ubuntu64:~$ arp -n {{{ Address HWtype HWaddress Flags Mask Iface 192.168.11.1 ether 02:aa:bb:cc:dd:20 CM eth0 }}} * mitty@ubuntu64:~/OpenWRT$ tftp 192.168.11.1 -m binary -c put openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-tftp.bin {{{ usage: tftp host-name [port] }}} * wikiのコマンドラインではうまくいかなかった * mitty@ubuntu64:~/OpenWRT$ tftp 192.168.11.1 {{{ tftp> put openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-tftp.bin Sent 2575462 bytes in 16.6 seconds }}} * しかし、上でも述べたように適用されない = deploy with WebUI = * official firm (ファームウェアを更新する) -> buffalo_to_ddwrt_webflash-MULTI.bin * OK -> DD-WRT化 * official firm (ファームウェアを更新する) -> openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-factory.bin * OK -> OpenWRT化(squashfs) * 基礎的な機能(telnetd, sshd)しか導入されない * official firm (ファームウェアを更新する) -> openwrt-ar71xx-generic-wzr-hp-ag300h-jffs2-factory.bin * OK -> OpenWRT化(jffs2) * 基礎的な機能(telnetd, sshd)しか導入されない * jffs2なので、リセット機能(firstboot)がうまく動かない(?) * DD-WRT (Admin. > Firm. Upgrade) -> openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-*.bin * NG = OpenWRT = * [http://wiki.openwrt.org/doc/howto/log.essentials Basic Log Support - OpenWrt Wiki] * logread コマンド * su コマンドが存在しない * sudoはある * [http://siriuth.blogspot.jp/2012/04/su.html Siriuth's Diary: suが一般ユーザーで使えない] == jffs2 == * root@OpenWrt:/# df {{{ Filesystem 1K-blocks Used Available Use% Mounted on rootfs 31296 2936 28360 9% / /dev/root 31296 2936 28360 9% / tmpfs 63320 60 63260 0% /tmp tmpfs 512 0 512 0% /dev }}} * root@OpenWrt:/# mount {{{ rootfs on / type rootfs (rw) /dev/root on / type jffs2 (rw,noatime) proc on /proc type proc (rw,noatime) sysfs on /sys type sysfs (rw,noatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755) devpts on /dev/pts type devpts (rw,noatime,mode=600) debugfs on /sys/kernel/debug type debugfs (rw,relatime) none on /proc/bus/usb type usbfs (rw,relatime) }}} === reset function === * [http://wiki.openwrt.org/doc/howto/hardware.button Attach functions to the hardware button - OpenWrt Wiki]を参考に設定するがうまく動かない * root@OpenWrt:~# mkdir -p /etc/hotplug.d/button * root@OpenWrt:~# vim /etc/hotplug.d/button/buttons {{{#!sh #!/bin/sh logger $BUTTON logger $ACTION }}} * root@OpenWrt:~# opkg update * root@OpenWrt:~# opkg install wget * root@OpenWrt:~# wget -O /etc/hotplug.d/button/00-button http://dev.openwrt.org/export/21216/trunk/target/linux/atheros/base-files/etc/hotplug.d/button/00-button --no-check-certificate * root@OpenWrt:~# uci add system button {{{ cfg055d81 }}} * root@OpenWrt:~# uci set system.@button[-1].button=reset * root@OpenWrt:~# uci set system.@button[-1].action=released * root@OpenWrt:~# uci set system.@button[-1].handler="firstboot && reboot" * root@OpenWrt:~# uci set system.@button[-1].min=5 * root@OpenWrt:~# uci set system.@button[-1].max=10 * root@OpenWrt:~# uci commit system * root@OpenWrt:~# uci export system.button {{{ package system config system option hostname 'OpenWrt' option timezone 'UTC' config timeserver 'ntp' list server '0.openwrt.pool.ntp.org' list server '1.openwrt.pool.ntp.org' list server '2.openwrt.pool.ntp.org' list server '3.openwrt.pool.ntp.org' option enable_server '0' config button option button 'reset' option action 'released' option handler 'firstboot && reboot' option min '5' option max '10' }}} * 以下のようにより簡単なスクリプトも試してみたが、動作しない * root@OpenWrt:~# vim /etc/hotplug.d/button/10-button {{{#!sh #!/bin/sh [ "$ACTION" = "released" -a "$BUTTON" = "reset" ] && { logger -t button-hotplug Button: $BUTTON / Action: $ACTION firstboot && reboot } }}} * firstbootコマンド自体がうまく動かない模様 * root@OpenWrt:~# firstboot {{{ firstboot has already been run jffs2 partition is mounted, only resetting files MTD partition not found. }}} * root@OpenWrt:~# echo $? {{{ 1 }}} == squashfs == * root@OpenWrt:/# df {{{ Filesystem 1K-blocks Used Available Use% Mounted on rootfs 29824 852 28972 3% / /dev/root 1536 1536 0 100% /rom tmpfs 63320 64 63256 0% /tmp tmpfs 512 0 512 0% /dev root 63320 32 63288 0% /tmp/root overlayfs:/tmp/root 63320 32 63288 0% /tmp/root /dev/mtdblock7 29824 852 28972 3% /overlay overlayfs:/overlay 29824 852 28972 3% / }}} * root@OpenWrt:/# mount {{{ rootfs on / type rootfs (rw) /dev/root on /rom type squashfs (ro,relatime) proc on /proc type proc (rw,noatime) sysfs on /sys type sysfs (rw,noatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime) tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755) devpts on /dev/pts type devpts (rw,noatime,mode=600) root on /tmp/root type tmpfs (rw,noatime,mode=755) overlayfs:/tmp/root on /tmp/root type overlayfs (ro,noatime,lowerdir=/,upperdir= /tmp/root) debugfs on /sys/kernel/debug type debugfs (rw,relatime) none on /proc/bus/usb type usbfs (rw,relatime) /dev/mtdblock7 on /overlay type jffs2 (rw,noatime) overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay) }}} === reset function === * 正常に動作する * root@OpenWrt:~# firstboot && reboot {{{ firstboot has already been run jffs2 partition is mounted, only resetting files root@OpenWrt:~# Connection to 192.168.1.1 closed by remote host. }}} * root@OpenWrt:~# mkdir -p /etc/hotplug.d/button * root@OpenWrt:~# vim /etc/hotplug.d/button/10-button {{{#!sh #!/bin/sh [ "$ACTION" = "released" -a "$BUTTON" = "reset" ] && { logger -t button-hotplug Button: $BUTTON / Action: $ACTION firstboot && reboot } }}} * 期待通り動く…が、完全に初期状態に戻るため、opkgでインストールしたものなども消えてしまう * -> reset用スクリプトも消える == uhttpd == * root@OpenWrt:~# opkg update * root@OpenWrt:~# opkg install luci * root@OpenWrt:~# /etc/init.d/uhttpd enable * root@OpenWrt:~# uci export uhttpd {{{ package uhttpd config uhttpd 'main' list listen_http '0.0.0.0:80' list listen_https '0.0.0.0:443' option home '/www' option rfc1918_filter '1' option cert '/etc/uhttpd.crt' option key '/etc/uhttpd.key' option cgi_prefix '/cgi-bin' option script_timeout '60' option network_timeout '30' option tcp_keepalive '1' config cert 'px5g' option days '730' option bits '1024' option country 'DE' option state 'Berlin' option location 'Berlin' option commonname 'OpenWrt' }}} * root@OpenWrt:~# /etc/init.d/uhttpd start * root@OpenWrt:~# opkg update * root@OpenWrt:~# opkg install luci-ssl * root@OpenWrt:~# /etc/init.d/uhttpd restart {{{ Generating RSA private key, 1024 bit long modulus Generating selfsigned certificate with subject 'C=DE;ST=Berlin;L=Berlin;CN=OpenWrt;' and validity 2012-05-08 13:30:09-2014-05-08 13:30:09 }}} * root@OpenWrt:~# opkg install luci-i18n-japanese == useradd / sudo == * install sudo, shadow via webUI * opkg install でももちろん可 * suコマンドは存在しない模様 * root@ag300h:~# mkdir /home * root@ag300h:~# useradd -m -s /bin/bash mitty * root@ag300h:~# visudo {{{ mitty ALL=NOPASSWD: ALL }}} * root@ag300h:~# vim /etc/shadow {{{ mitty:!:15468:::::: }}} * パスワードログインを不可能にする * mitty@ag300h:~$ sudo chmod o-rwx /etc/shadow * mitty@ag300h:~$ sudo chmod o-rwx /etc/shadow- * mitty@ag300h:~$ sudo chmod o-rwx /etc/uhttpd.* * 一般ユーザでも見れる状態になってしまっている = PPPoE spec = * フレッツ光ネクスト マンション with OCN * 通信スループット測定ツール of PacketiX VPN 3.0[[br]][[Image(throughput.png,33%)]] * WZR-HP-AG300H[[br]][[Image(wzh-down.png,33%)]] [[Image(wzh-up.png,33%)]] [[Image(wzh-updown.png,33%)]] * 以下は他の方法でPPPoE接続したときのスループット測定 * Windows 7 x64[[br]][[Image(win7-down.png,33%)]] [[Image(win7-up.png,33%)]] [[Image(win7-updown.png,33%)]] * MZK-WNH[[br]][[Image(mzk-down.png,33%)]] [[Image(mzk-up.png,33%)]] [[Image(mzk-updown.png,33%)]]