OpenWRT仮想ルータ疎通設定
初回起動をESXi Host Clientのブラウザコンソールで確認すると、2つのI225有線LANポートがそれぞれ、
- eth0 : LAN (br-lan)
- eth1 : WAN
となっていて違和感を感じ、以下の要領で入れ替えました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
config device option name 'br-lan' option type 'bridge' list ports 'eth1' config interface 'lan' option device 'br-lan' option proto 'static' option ipaddr '192.168.51.5' option netmask '255.255.255.0' config interface 'wan' option device 'eth0' option proto 'dhcp' |
1 2 |
# vi /etc/config/network # /etc/init.d/network reload |
さらに、暫定的にWANから管理できるようにFirewallを設定します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
config redirect option target 'DNAT' option src 'wan' option dest 'lan' option src_dport '8888' option dest_port '22' option name 'ssh_WAN' option proto 'tcp' option dest_ip '192.168.51.5' config redirect option target 'DNAT' option src 'wan' option dest 'lan' option src_dport '8887' option dest_port '80' option name 'luci_WAN' option proto 'tcp' option dest_ip '192.168.51.5' |
1 2 |
# vi /etc/config/firewall # /etc/init.d/firewall reload |
この状態でWANポートを既存の自宅LANへ繋いで、以降のセットアップを進めます。
ルートパーティションの拡張
OpenWRTのルートパーティション拡張手順は、公式ユーザガイドで主にx86アーキテクチャ向けに解説されています。
コンソールに入り、 parted をインストールして現在のパーティション構成を確認します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# opkg update # opkg install parted Installing parted (3.4-2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/parted_3.4-2_x86_64.ipk Installing libparted (3.4-2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/libparted_3.4-2_x86_64.ipk Installing libreadline8 (8.1-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/libreadline8_8.1-1_x86_64.ipk Configuring libparted. Configuring libreadline8. Configuring parted. # parted -l ---pretend-input-tty Model: VMware Virtual disk (scsi) Disk /dev/sda: 1074MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 128 17.4kB 262kB 245kB bios_grub 1 262kB 17.0MB 16.8MB fat16 legacy_boot 2 17.0MB 126MB 109MB ext2 |
次に blkid で拡張前の PARTUUID を確認しておきます。
1 2 3 4 5 6 7 8 9 10 11 |
# opkg install blkid Installing blkid (2.37.4-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/blkid_2.37.4-1_x86_64.ipk Configuring blkid. # blkid /dev/sda2: LABEL="rootfs" UUID="ff313567-e9f1-5a5d-9895-3ba130b4a864" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="abeae232-5289-82a1-0e57-2f2fe899f402" /dev/sda128: PARTUUID="abeae232-5289-82a1-0e57-2f2fe899f480" /dev/sda1: SEC_TYPE="msdos" LABEL_FATBOOT="kernel" LABEL="kernel" UUID="1234-ABCD" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="abeae232-5289-82a1-0e57-2f2fe899f401" |
ルートパーティション /dev/sda2 を最大値まで拡張したら、もう一度 blkid を実行してみて、 PARTUUID が変わっていないことを確認します。
1 2 3 4 5 6 7 8 |
# parted -s /dev/sda resizepart 2 100% # blkid /dev/sda2: LABEL="rootfs" UUID="ff313567-e9f1-5a5d-9895-3ba130b4a864" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="abeae232-5289-82a1-0e57-2f2fe899f402" /dev/sda128: PARTUUID="abeae232-5289-82a1-0e57-2f2fe899f480" /dev/sda1: SEC_TYPE="msdos" LABEL_FATBOOT="kernel" LABEL="kernel" UUID="1234-ABCD" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="abeae232-5289-82a1-0e57-2f2fe899f401" |
続いてファイルシステムの拡張です。通常はアンマウント状態で行うものですが、OpenWRT 19.07以降ではマウント状態のままでも拡張可能と言われています。
ファイルシステムを操作する resize2fs の他に、ループデバイスを扱う losetup をインストールします。
1 2 3 4 5 6 7 |
# opkg install losetup resize2fs Installing losetup (2.37.4-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/losetup_2.37.4-1_x86_64.ipk Installing resize2fs (1.46.5-2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/resize2fs_1.46.5-2_x86_64.ipk Configuring resize2fs. Configuring losetup. |
そのままルートパーティション /dev/sda2 をループデバイスに登録し、そのループデバイス /dev/loop1 に対し resize2fs でパーティション一杯までファイルシステムをリサイズします。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# losetup /dev/loop1 /dev/sda2 # resize2fs -f /dev/loop1 resize2fs 1.46.5 (30-Dec-2021) Resizing the filesystem on /dev/loop1 to 257979 (4k) blocks. The filesystem on /dev/loop1 is now 257979 (4k) blocks long. # df -h Filesystem Size Used Available Use% Mounted on /dev/root 1006.1M 924.1M 79.8M 92% / tmpfs 493.0M 1.1M 491.9M 0% /tmp /dev/sda1 16.0M 5.7M 10.2M 36% /boot /dev/sda1 16.0M 5.7M 10.2M 36% /boot tmpfs 512.0K 0 512.0K 0% /dev |
df で確認すると既にリサイズが反映されている感じですが、一度再起動するのが安全です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
BusyBox v1.35.0 (2023-01-03 00:24:21 UTC) built-in shell (ash) _______ ________ __ | |.-----.-----.-----.| | | |.----.| |_ | - || _ | -__| || | | || _|| _| |_______|| __|_____|__|__||________||__| |____| |__| W I R E L E S S F R E E D O M ----------------------------------------------------- OpenWrt 22.03.3, r20028-43d71ad93e ----------------------------------------------------- # df -h Filesystem Size Used Available Use% Mounted on /dev/root 994.5M 20.4M 958.1M 2% / tmpfs 493.0M 68.0K 493.0M 0% /tmp /dev/sda1 16.0M 5.7M 10.2M 36% /boot /dev/sda1 16.0M 5.7M 10.2M 36% /boot tmpfs 512.0K 0 512.0K 0% /dev |
DR7915直通のWiFiインターフェイス
WiFi6対応WiFiモジュールDR7915のOpenWRTでのセットアップは、デバイスをパススルーモードにしているので、前回の記事と同じ要領です。
pciutil をインストールしてデバイスが存在していることを確認します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# opkg install pciutils Installing pciutils (3.8.0-2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/pciutils_3.8.0-2_x86_64.ipk Installing libkmod (27-2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/libkmod_27-2_x86_64.ipk Installing libpci (3.8.0-2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/libpci_3.8.0-2_x86_64.ipk Installing pciids (0.359-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/pciids_0.359-1_x86_64.ipk Configuring libpci. Configuring pciids. Configuring libkmod. Configuring pciutils. # lspci 00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01) 00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01) 00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08) 00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) 00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08) 00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10) 00:0f.0 VGA compatible controller: VMware SVGA II Adapter 02:00.0 Serial Attached SCSI controller: VMware PVSCSI SCSI Controller (rev 02) 02:01.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03) 02:02.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03) 02:03.0 Unclassified device [0002]: MEDIATEK Corp. MT7915E 802.11ax PCI Express Wireless Network Adapter |
MT7915のカーネルモジュールとhostapdをインストールしたら、一度OpenWRTを再起動。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# opkg install hostapd Installing hostapd (2022-01-16-cff80b4f-15.2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/hostapd_2022-01-16-cff80b4f-15.2_x86_64.ipk Configuring hostapd. # opkg install kmod-mt7915e Installing kmod-mt7915e (5.10.161+2022-09-06-d7054646-5) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-mt7915e_5.10.161%2b2022-09-06-d7054646-5_x86_64.ipk Installing iw (5.16-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/iw_5.16-1_x86_64.ipk Installing iwinfo (2022-12-15-8d158096-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/iwinfo_2022-12-15-8d158096-1_x86_64.ipk Installing wireless-regdb (2022.08.12-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/wireless-regdb_2022.08.12-1_all.ipk Installing kmod-cfg80211 (5.10.161+5.15.81-1-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-cfg80211_5.10.161%2b5.15.81-1-1_x86_64.ipk Installing kmod-crypto-cmac (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-cmac_5.10.161-1_x86_64.ipk Installing kmod-crypto-null (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-null_5.10.161-1_x86_64.ipk Installing kmod-crypto-aead (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-aead_5.10.161-1_x86_64.ipk Installing kmod-crypto-manager (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-manager_5.10.161-1_x86_64.ipk Installing kmod-crypto-hmac (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-hmac_5.10.161-1_x86_64.ipk Installing kmod-crypto-sha256 (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-sha256_5.10.161-1_x86_64.ipk Installing kmod-crypto-rng (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-rng_5.10.161-1_x86_64.ipk Installing kmod-crypto-seqiv (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-seqiv_5.10.161-1_x86_64.ipk Installing kmod-crypto-ctr (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-ctr_5.10.161-1_x86_64.ipk Installing kmod-crypto-ccm (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-ccm_5.10.161-1_x86_64.ipk Installing kmod-crypto-gf128 (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-gf128_5.10.161-1_x86_64.ipk Installing kmod-crypto-ghash (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-ghash_5.10.161-1_x86_64.ipk Installing kmod-crypto-gcm (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-crypto-gcm_5.10.161-1_x86_64.ipk Installing hostapd-common (2022-01-16-cff80b4f-15.2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/base/hostapd-common_2022-01-16-cff80b4f-15.2_x86_64.ipk Installing kmod-mac80211 (5.10.161+5.15.81-1-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-mac80211_5.10.161%2b5.15.81-1-1_x86_64.ipk Installing kmod-mt76-core (5.10.161+2022-09-06-d7054646-5) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-mt76-core_5.10.161%2b2022-09-06-d7054646-5_x86_64.ipk Installing kmod-mt76-connac (5.10.161+2022-09-06-d7054646-5) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-mt76-connac_5.10.161%2b2022-09-06-d7054646-5_x86_64.ipk Installing kmod-mt7615-common (5.10.161+2022-09-06-d7054646-5) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-mt7615-common_5.10.161%2b2022-09-06-d7054646-5_x86_64.ipk Installing kmod-thermal (5.10.161-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/targets/x86/64/packages/kmod-thermal_5.10.161-1_x86_64.ipk Configuring iwinfo. Configuring kmod-crypto-gf128. Configuring iw. Configuring kmod-crypto-null. Configuring kmod-crypto-aead. Configuring kmod-crypto-manager. Configuring kmod-crypto-hmac. Configuring kmod-crypto-sha256. Configuring kmod-crypto-rng. Configuring kmod-crypto-seqiv. Configuring kmod-crypto-ctr. Configuring wireless-regdb. Configuring kmod-cfg80211. Configuring kmod-crypto-cmac. Configuring kmod-crypto-ccm. Configuring kmod-crypto-ghash. Configuring kmod-crypto-gcm. Configuring hostapd-common. Configuring kmod-mac80211. Configuring kmod-mt76-core. Configuring kmod-mt76-connac. Configuring kmod-mt7615-common. Configuring kmod-thermal. Configuring kmod-mt7915e. # reboot |
再起動後、 wlan0 、 wlan1 インターフェイスが増えているのを確認したら、以下の要領で2.4G、5GのWiFiをセットアップします。
- radio0: 2.4G AX mode 40MHz 600Mbps 26dBm/398mW
- radio1: 5.0G AX mode 80MHz 1200Mbps 23dBm/199mW
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
config wifi-device 'radio0' option type 'mac80211' option path 'pci0000:02/0000:02:03.0' option band '2g' option htmode 'HE40' option cell_density '0' option noscan '1' option country 'US' option txpower '26' option channel '4' config wifi-iface 'default_radio0' option device 'radio0' option network 'lan' option mode 'ap' option ssid '########' option encryption 'psk2+ccmp' option key '########' option ieee80211r '1' option nasid '############' option mobility_domain '####' option ft_over_ds '0' option ft_psk_generate_local '1' config wifi-device 'radio1' option type 'mac80211' option path 'pci0000:02/0000:02:03.0+1' option band '5g' option cell_density '0' option country 'US' option txpower '23' option htmode 'HE80' option channel '40' config wifi-iface 'default_radio1' option device 'radio1' option network 'lan' option mode 'ap' option ssid '########' option encryption 'psk2+ccmp' option key '########' option ieee80211r '1' option nasid '############' option mobility_domain '####' option ft_over_ds '0' option ft_psk_generate_local '1' |
ASUS Zenfone8 Flip(関連記事はこちら)からWiFiに繋いで、インターネットスピードテストを試してみた結果もまずまず。
物理インストール時とのベンチマーク比較
前回、物理ルータとしてOpenWRTをインストールした時にいくつかベンチマークを取得していたので、今回も同じ要領で計測して結果を比較してみたいと思います。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# opkg install openssl-util # openssl speed -evp aes-256-gcm OpenSSL 1.1.1s 1 Nov 2022 type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes aes-256-gcm 228388.02k 626892.95k 1018575.79k 1201624.75k 1259233.28k 1264396.97k # openssl speed -evp aes-256-gcm -multi 4 OpenSSL 1.1.1s 1 Nov 2022 evp 911406.29k 2477903.91k 4057706.15k 4787234.82k 5017578.15k 4907046.23k # openssl speed -evp chacha20-poly1305 OpenSSL 1.1.1s 1 Nov 2022 type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes chacha20-poly1305 151248.49k 295438.34k 457241.77k 485685.59k 496410.62k 497309.01k # openssl speed -evp chacha20-poly1305 -multi 4 OpenSSL 1.1.1s 1 Nov 2022 evp 606389.06k 1169949.80k 1820961.79k 1935807.83k 1977606.14k 1914694.31k # opkg install coremark # coremark 2K performance run parameters for coremark. CoreMark Size : 666 Total ticks : 13544 Total time (secs): 13.544000 Iterations/Sec : 14766.686356 Iterations : 200000 |
仮想マシンとしてのOpenWRTベンチマーク計測結果を、前回の物理マシンOpenWRTの計測値(カッコ内)と比較してみると、〜3%程度の低下に収まっているので、仮想化はデメリットにはなり得ないと言えるでしょう。
- AES-256-GCM_8KB
Single: 1,259,233.28k (1,304,805.38k) -3.5%
Multi : 5,017,578.15k (5,051,872.60k) -0.68% - ChaCha20-Poly1305_8KB
Single: 496,410.62k ( 513,794.05k) -3.4%
Multi : 1,977,606.14k (1,988,444.16k) -0.54%
- CoreMark
: 14,766 (15,301) -3.5%
OpenWRTの定番カスタマイズ
まず、open-vm-toolsのOpenWRT向けパッケージをインストールします。
1 2 |
# opkg update && opkg install open-vm-tools # reboot |
仮想マシンを再起動後、ESXi Host Client上にネットワークやストレージ情報が表示されるようなりました。
次に以前、FriendlyElec NanoPi R2Sで動くOpenWRTに施したマルチコア向け設定を元に、IRQ BalanceとFlow Offloadingを有効にします。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# opkg install irqbalance Installing irqbalance (1.9.2-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/irqbalance_1.9.2-1_x86_64.ipk Configuring irqbalance. # uci set firewall.@defaults[0].flow_offloading=1 # uci set network.globals.packet_steering=1 # uci set irqbalance.irqbalance.enabled=1 # uci commit # /etc/init.d/irqbalance status active with no instances # /etc/init.d/irqbalance start # /etc/init.d/irqbalance status running |
続いてデフォルトシェルをbashに変更します。
1 2 3 |
# opkg install bash # nano /etc/passwd # nano ~/.bashrc |
1 2 3 4 |
旧) root:x:0:0:root:/root:/bin/ash 新) root:x:0:0:root:/root:/bin/bash |
1 2 3 4 |
HISTCONTROL=ignoreboth:erasedups HISTIGNORE=history:ls:ll:'ls -la':pwd:exit:top:htop:dmesg:uptime:lsusb:'df -h' HISTSIZE= HISTFILESIZE= |
1 2 3 4 5 |
# echo ". $HOME/.bashrc" > /root/.bash_profile # ls -la ~/ -rw------- 1 root root 425 Jan 9 17:24 .bash_history -rw-r--r-- 1 root root 16 Jan 9 16:54 .bash_profile -rw-r--r-- 1 root root 136 Jan 9 16:53 .bashrc |
アップグレード時など、bashパッケージを喪失した場合の備えを /etc/rc.local に仕掛けておきます。
1 2 3 4 5 6 7 |
# Put your custom commands here that should be executed once # the system init finished. By default this file does nothing. # Check whether bash is available, change default shell to ash if unavailable. test -x /bin/bash && sed '/^root/ s_/bin/.*_/bin/bash_g' -i /etc/passwd || sed '/^root/ s_/bin/.*_/bin/ash_g' -i /etc/passwd exit 0 |
最後にvnstatを導入します(同じOpenWRT系のGL-AR750Sへの導入例はこちら)。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# opkg install vnstat2 vnstati2 luci-app-vnstat2 Installing vnstat2 (2.9-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/vnstat2_2.9-1_x86_64.ipk Installing vnstati2 (2.9-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/vnstati2_2.9-1_x86_64.ipk Installing libjpeg-turbo (2.1.2-1) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/libjpeg-turbo_2.1.2-1_x86_64.ipk Installing libpng (1.6.37-11) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/libpng_1.6.37-11_x86_64.ipk Installing libwebp (1.2.1-2) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/libwebp_1.2.1-2_x86_64.ipk Installing libgd (2.3.2-4) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/packages/libgd_2.3.2-4_x86_64.ipk Installing luci-app-vnstat2 (git-21.223.26753-57f325a) to root... Downloading https://downloads.openwrt.org/releases/22.03.3/packages/x86_64/luci/luci-app-vnstat2_git-21.223.26753-57f325a_all.ipk Configuring vnstat2. Configuring libjpeg-turbo. Configuring libpng. Configuring libwebp. Configuring libgd. Configuring vnstati2. Configuring luci-app-vnstat2. |
OpenWRTが使うvnstatの設定ファイルはこのように。
1 2 3 4 5 6 |
config vnstat list interface 'br-lan' list interface 'eth0' list interface 'eth1' list interface 'wlan0' list interface 'wlan1' |
/etc/vnstat.conf に記載されているデフォルトのデータベースファイル保存場所 /var/lib/vnstat/ は、OpenWRTではtmpfsに属するので再起動すると消えてしまいます。
1 2 3 4 5 6 7 8 9 |
# ls -la /var lrwxrwxrwx 1 root root 3 Jan 3 08:24 /var -> tmp # df -h Filesystem Size Used Available Use% Mounted on /dev/root 994.5M 61.6M 916.9M 6% / tmpfs 493.0M 1.3M 491.8M 0% /tmp /dev/sda1 16.0M 5.7M 10.2M 36% /boot /dev/sda1 16.0M 5.7M 10.2M 36% /boot tmpfs 512.0K 0 512.0K 0% /dev |
GL-AR750Sの時はSDカードを保存先にしていましたが、今回はひとまず /root/ 下へ置くことに。
1 2 3 4 |
# service vnstat stop # mkdir /root/vnstat/ # mv /var/lib/vnstat/vnstat.db /root/vnstat/ # service vnstat start |
1 2 3 4 5 6 7 8 9 10 |
# vnStat 2.9 configuration file # # lines starting with # or ; are comments, everything has default # values, remove ; before each option to change its value # default interface (leave empty for automatic selection) ;Interface "" # location of the database directory DatabaseDir "/root/vnstat" |
以上、ルータとして基本機能が整ったところで今回はここまで。次回はESXiホストに今後作成する仮想マシンがアクセスするためのネットワークを構築したいと思います。