テスト環境用ゲートウェイサーバをarmbianで作ったことのメモ


とりあえず客先のIPアドレスで構築する時に、ちょうどいいサーバが無かったので余ってたorangepiでゲートウェイサーバを作った。

調達したスイッチがタグVLANしゃべれるやつだったので、orangepiの1ポートしかないNICに、VLANを4つ載せた

最近のarmbianはNetworkManagerによる制御にあるので、nmtuiコマンドなどでネットワーク設定を行った。

nmtuiで[Add]-[VLAN]を選んだあと、下記の様な感じでデバイスは空欄、「Parent(親)」は、実際のネットワークインターフェイスであるeth0を指定、そして、作成したいVLAN IDを「VLAN id」に入力し、作成

これでネットワーク設定を行った結果は、 /etc/NetworkManager/system-connections に出力されている。

DNSサーバ

次に、VLANを割り当てているサブネット以外の場所にあるDNSサーバをどうやってごまかすかを考えた。

応答する内容については、 /etc/hosts に書いたものを利用する dnsmasq を試用することとした。

root@orangepi2:~# diff -u /etc/dnsmasq.conf.org /etc/dnsmasq.conf
--- /etc/dnsmasq.conf.org       2022-02-28 11:54:50.037516142 +0900
+++ /etc/dnsmasq.conf   2022-02-28 16:05:58.999972348 +0900
@@ -8,6 +8,7 @@
 # (53). Setting this to zero completely disables DNS function,
 # leaving only DHCP and/or TFTP.
 #port=5353
+port=53

 # The following two options make you a better netizen, since they
 # tell dnsmasq to filter out queries which the public DNS cannot
@@ -16,7 +17,7 @@
 # these requests from bringing up the link unnecessarily.

 # Never forward plain names (without a dot or domain part)
-#domain-needed
+domain-needed
 # Never forward addresses in the non-routed address spaces.
 #bogus-priv

@@ -43,7 +44,7 @@

 # Change this line if you want dns to get its upstream servers from
 # somewhere other that /etc/resolv.conf
-#resolv-file=
+resolv-file=/etc/resolv-tmp.conf

 # By  default,  dnsmasq  will  send queries to any of the upstream
 # servers it knows about and tries to favour servers to are  known
@@ -72,6 +73,7 @@
 # Add local-only domains here, queries in these domains are answered
 # from /etc/hosts or DHCP only.
 #local=/localnet/
+local=/osakana.net/

 # Add domains which you want to force to an IP address here.
 # The example below send any host in double-click.net to a local
@@ -142,6 +144,7 @@
 #    domain of all systems configured by DHCP
 # 3) Provides the domain part for "expand-hosts"
 #domain=thekelleys.org.uk
+domain=osakana.net,客先IPアドレス帯/24

 # Set a different domain for a particular subnet
 #domain=wireless.thekelleys.org.uk,192.168.2.0/24

osakana.net ドメインの名前解決を、ちゃんとしたDNSサーバに聞きに行かないよう「local=/ドメイン名/」を定義して、阻止する。

domain=の記述はいらないような感じだけど、とりあえず追加しておいたもの。

「resolv-file=/etc/resolv-tmp.conf」と入れてるのは、Network Manager生成の/etc/resolv.conf だと期待値と違ったものがあったため、あえて別ファイルとしているもので、通常は不要。

DNSサーバが他のサブネットにある件は、とりあえず、ダミーのVLANを作成し、そこにIPアドレスを割り当て、/etc/sysctl.d/98-ipforward.conf にip_forward設定を入れることで、応答を返せるようにした。

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

NTPサーバ

ntpサーバは chronyで作成した。

/etc/chrony.conf を修正するのではなく、 /etc/chrony/conf.d/server.conf に下記を記述した。

allow 172.17.44.0/24
allow 192.168.20.0/26
local stratum 10

これでchrony再起動で問題なかった。

proxyサーバ

要件には無かったが、ひとまずproxyサーバとしても動作できるようsquidをインストールした。

しかし、 armbian初期設定では /var/log が RAMディスク作成で50MBのため /var/log/squid が作成できずエラーとなった

/var/logの50MBというのは /etc/default/armbian-ramlog にて「SIZE=50M」で定義されている。

これを「SIZE=100M」などと変えて再起動すると反映される。

また、/var/log/squid をRAMディスク以外に逃がすことで対応した。

面倒なので、/ディレクトリ直下に/work/squidを作成し、そこに/var/log/squidのシンボリックリンクを作成している

root@orangepi2:/var/log/squid# ls -ld /var/log/squid
lrwxrwxrwx 1 root root 11 Feb 28 15:05 /var/log/squid -> /work/squid
root@orangepi2:/var/log/squid#

ラズパイ3のOSMCがアップデートされてなかった


ラズパイ3をメディアプレーヤーとして使うためにOSMCをインストールしているんですが、確認してみたら「OSMC November 2020 2020.11-1」からアップデートされていなかったので調査。

GUIからやってみると、updateを取得にしにいくもののすぐに終わる。

じゃあ、ssh接続してコマンドでやってみるか、と、「Keeping your OSMC system up to date」にある「sudo apt-get update」を実行してみるとエラー

osmc@osmc:~$ sudo apt-get update
Get:1 http://security.debian.org buster/updates InRelease [65.4 kB]
Get:2 http://ftp.debian.org/debian buster InRelease [122 kB]
Get:4 http://ftp.debian.org/debian buster-updates InRelease [51.9 kB]
Hit:3 http://ftp.fau.de/osmc/osmc/apt buster InRelease
Reading package lists... Done
E: Repository 'http://security.debian.org buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
N: Repository 'http://ftp.debian.org/debian buster InRelease' changed its 'Version' value from '10.10' to '10.11'
E: Repository 'http://ftp.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
E: Repository 'http://ftp.debian.org/debian buster-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
osmc@osmc:~$

このエラーの場合は、–allow-releaseinfo-change オプションで対応できるとのこと

osmc@osmc:/etc/apt$ sudo apt-get update --allow-releaseinfo-change
Get:1 http://security.debian.org buster/updates InRelease [65.4 kB]
Get:2 http://ftp.debian.org/debian buster InRelease [122 kB]
Get:3 http://ftp.debian.org/debian buster-updates InRelease [51.9 kB]
Get:5 http://security.debian.org buster/updates/main armhf Packages [306 kB]
Get:6 http://security.debian.org buster/updates/main Translation-en [166 kB]
Hit:4 http://ftp.fau.de/osmc/osmc/apt buster InRelease
Get:7 http://ftp.debian.org/debian buster/main armhf Packages [7698 kB]
Get:8 http://ftp.debian.org/debian buster-updates/main armhf Packages.diff/Index [9100 B]
Get:9 http://ftp.debian.org/debian buster/main Translation-en [5968 kB]
Get:10 http://ftp.debian.org/debian buster/contrib armhf Packages [40.1 kB]
Get:11 http://ftp.debian.org/debian buster/non-free armhf Packages [62.1 kB]
Get:12 http://ftp.debian.org/debian buster/non-free Translation-en [88.8 kB]
Get:13 http://ftp.debian.org/debian buster-updates/main armhf Packages 2021-09-18-2009.26.pdiff [1109 B]
Get:14 http://ftp.debian.org/debian buster-updates/main armhf Packages 2021-09-28-1420.03.pdiff [184 B]
Get:15 http://ftp.debian.org/debian buster-updates/main armhf Packages 2021-10-26-2004.40.pdiff [283 B]
Get:15 http://ftp.debian.org/debian buster-updates/main armhf Packages 2021-10-26-2004.40.pdiff [283 B]
Fetched 14.3 MB in 16s (881 kB/s)
Reading package lists... Done
N: Repository 'http://security.debian.org buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: Repository 'http://ftp.debian.org/debian buster InRelease' changed its 'Version' value from '10.10' to '10.11'
N: Repository 'http://ftp.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: Repository 'http://ftp.debian.org/debian buster-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
osmc@osmc:/etc/apt$

これは大丈夫なのかな?と心配になりつつも「E:」がないので大丈夫だろう、と、「sudo apt upgrade」を実行

osmc@osmc:/etc/apt$ sudo apt upgrade
Running apt upgrade on your system can cause adverse effects on your system
Use apt full-upgrade, which is the proper way to administer a Debian / Ubuntu system
For more information about updates, see https://osmc.tv/wiki/general/keeping-your-osmc-system-up-to-date/
osmc@osmc:/etc/apt$

apt full-upgrade を使えと怒られた

osmc@osmc:/etc/apt$ sudo apt full-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  armv7-libass-osmc armv7-libnfs-osmc dh-python g++-6 gnupg-agent libass5 libavcodec57 libavformat57 libavutil55 libbind9-140
  libbluray1 libcdio13 libcryptsetup4 libdevmapper-event1.02.1 libdns162 libegl1-mesa libenca0 libevent-2.0-5 libgdbm3
  libgl1-mesa-glx libgles2-mesa libicu57 libisc160 libisccc140 libisccfg140 libiso9660-8 liblivemedia57 liblvm2app2.2 liblwres141
  libmicrodns0 libncurses5 libnfs8 libntfs-3g871 libpcre16-3 libperl5.24 libpostproc54 libprocps6 libprotobuf-lite10 libproxy1v5
  libpython3.5-minimal libpython3.5-stdlib libsndio6.1 libssl1.0.2 libstdc++-6-dev libswresample2 libswscale4 libunistring0
  libupnp6 libva-drm1 libva-wayland1 libva-x11-1 libva1 libvlccore8 libvpx4 libwayland-egl1-mesa libwebpmux2 libx264-148
  libx265-95 python-apt python-certifi python-chardet python-dbus python-gi python-gobject python-gobject-2 python-idna
  python-imaging python-pexpect python-pil python-ptyprocess python-requests python-six python-unidecode python-urllib3
  python3-distutils python3-lib2to3 python3.5 python3.5-minimal wireless-firmware-osmc
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  armv7-bluezalsa-osmc libbluetooth3 libfdk-aac1 libpython3.7 libsbc1 python-crypto python-ldb python-samba python-tdb
  python3-dbus python3-gi python3-pil python3-unidecode rbp2-image-5.10.78-2-osmc rbp2-mesa-osmc samba-common-bin
The following packages will be upgraded:
  apt apt-utils armv7-bluez-osmc armv7-eventlircd-osmc armv7-network-osmc armv7-remote-osmc avahi-daemon base-files
  base-files-osmc bind9-host ca-certificates curl debconf debian-archive-keyring distro-info-data iproute2 libapt-inst2.0
  libapt-pkg5.0 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-compat-libdnssd1 libavahi-core7 libavcodec58
  libavformat58 libavutil56 libbind9-161 libbsd0 libc-bin libc-dev-bin libc-l10n libc6 libc6-dev libcairo2 libcurl4 libdns1104
  libgcrypt20 libglib2.0-0 libgnutls30 libgssapi-krb5-2 libhogweed4 libicu63 libisc1100 libisccc161 libisccfg163 libk5crypto3
  libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common libldb1 liblirc-client0 liblwres161 liblz4-1 libmariadb3 libnettle6
  libnss-myhostname libnss3 libntfs-3g883 libopenjp2-7 libp11-kit0 libpam-systemd libpostproc55 libpython3.7-minimal
  libpython3.7-stdlib libsmbclient libsndfile1 libssl-dev libssl1.1 libswresample3 libswscale5 libsystemd0 libtiff5 libudev1
  libvlc-bin libvlc5 libvlccore9 libwbclient0 libwebp6 libwebpdemux2 libwebpmux3 libx11-6 libx11-data libx11-xcb1 libxml2
  libzstd1 linux-libc-dev locales mariadb-common mediacenter-addon-osmc mediacenter-eventclients-common-osmc
  mediacenter-send-osmc mediacenter-skin-osmc multiarch-support ntfs-3g openssl openvpn psmisc python3.7 python3.7-minimal
  rbp-bootloader-osmc rbp-userland-osmc rbp2-device-osmc rbp2-ftr-osmc rbp2-kernel-osmc rbp2-libcec-osmc rbp2-mediacenter-osmc
  samba-common samba-libs sudo systemd systemd-sysv tzdata udev vlc vlc-bin vlc-data vlc-l10n vlc-plugin-base vlc-plugin-qt
  vlc-plugin-video-output wpasupplicant
122 upgraded, 16 newly installed, 0 to remove and 0 not upgraded.
Need to get 223 MB of archives.
After this operation, 76.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.debian.org buster/updates/main armhf libsmbclient armhf 2:4.9.5+dfsg-5+deb10u2 [155 kB]
<略>
Get:61 http://ftp.fau.de/osmc/osmc/apt buster/main armhf rbp2-device-osmc armhf 1.5.7 [553 kB]
Get:62 http://ftp.fau.de/osmc/osmc/apt buster/main armhf multiarch-support armhf 2.28-110.1 [215 kB]
Fetched 223 MB in 2min 18s (1619 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 41428 files and directories currently installed.)
Preparing to unpack .../base-files_10.3+deb10u11_armhf.deb ...
Unpacking base-files (10.3+deb10u11) over (10.3+deb10u7) ...
Setting up base-files (10.3+deb10u11) ...
<略>

Preparing to unpack .../56-liblwres161_1%3a9.11.5.P4+dfsg-5.1+deb10u6_armhf.deb ...
Unpacking liblwres161:armhf (1:9.11.5.P4+dfsg-5.1+deb10u6) over (1:9.11.5.P4+dfsg-5.1+deb10u2) ...
Preparing to unpack .../57-avahi-daemon_0.7-4+deb10u1_armhf.deb ...
Unpacking avahi-daemon (0.7-4+deb10u1) over (0.7-4+b1) ...
dpkg: warning: unable to delete old directory '/etc/resolvconf/update-libc.d': Directory not empty
dpkg: warning: unable to delete old directory '/etc/resolvconf': Directory not empty
Preparing to unpack .../58-mediacenter-addon-osmc_3.0.737_all.deb ...
Unpacking mediacenter-addon-osmc (3.0.737) over (3.0.699) ...
dpkg: warning: unable to delete old directory '/usr/share/kodi/addons/script.module.osmcsetting.updates/resources/osmc': Directory not empty
dpkg: warning: unable to delete old directory '/usr/share/kodi/addons/script.module.osmcsetting.services/resources/osmc': Directory not empty
dpkg: warning: unable to delete old directory '/usr/share/kodi/addons/script.module.osmcsetting.remotes/resources/osmc': Directory not empty
dpkg: warning: unable to delete old directory '/usr/share/kodi/addons/script.module.osmcsetting.pi/resources/osmc': Directory not empty
dpkg: warning: unable to delete old directory '/usr/share/kodi/addons/script.module.osmcsetting.networking/resources/osmc': Directory not empty
dpkg: warning: unable to delete old directory '/usr/share/kodi/addons/script.module.osmcsetting.logging/resources/osmc': Directory not empty
dpkg: warning: unable to delete old directory '/usr/share/kodi/addons/script.module.osmcsetting.apfstore/resources/osmc': Directory not empty
Preparing to unpack .../59-mediacenter-skin-osmc_19.1.0-19_all.deb ...
Unpacking mediacenter-skin-osmc (19.1.0-19) over (18.5.0-4) ...
Preparing to unpack .../60-libnss3_2%3a3.42.1-1+deb10u4_armhf.deb ...
Unpacking libnss3:armhf (2:3.42.1-1+deb10u4) over (2:3.42.1-1+deb10u3) ...
Preparing to unpack .../61-rbp2-libcec-osmc_6.0.2-3_armhf.deb ...
Unpacking rbp2-libcec-osmc (6.0.2-3) over (4.0.4-5) ...
<略>
Setting up libavformat58:armhf (7:4.1.8-0+deb10u1) ...
Setting up libbind9-161:armhf (1:9.11.5.P4+dfsg-5.1+deb10u6) ...
Setting up samba-common-bin (2:4.9.5+dfsg-5+deb10u2) ...
Checking smb.conf with testparm
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE

Done
Setting up vlc-plugin-base:armhf (3.0.12-0+deb10u1) ...
Setting up vlc (3.0.12-0+deb10u1) ...
Setting up bind9-host (1:9.11.5.P4+dfsg-5.1+deb10u6) ...
Setting up avahi-daemon (0.7-4+deb10u1) ...
Removing obsolete conffile /etc/network/if-up.d/avahi-daemon ...
Removing obsolete conffile /etc/resolvconf/update-libc.d/avahi-daemon ...
Setting up rbp2-mediacenter-osmc (19.3.0-7) ...
Setting up rbp2-device-osmc (1.5.7) ...
Processing triggers for dbus (1.12.20-0+deb10u1) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for libc-bin (2.28-110.1) ...
Processing triggers for ntp (1:4.2.8p12+dfsg-4) ...
Processing triggers for ca-certificates (20200601~deb10u2) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for libvlc-bin:armhf (3.0.12-0+deb10u1) ...
osmc@osmc:/etc/apt$

そして再起動

無事に「OSMC November 2021 2021.11-2」にアップデートされました。

が・・・自作のプラグインとsteamlinkプラグインが無効化されてしまいました・・・

NanoPi R2S+OpenWRT 21.02.0でBIGLOBEのMAP-E接続


5月に「NanoPi R2S+openWRT 21.02.0RCでBIGLOBEのMAP-E接続」にてOpenWRT 21.02.0-RC版での手順を作成した。

しかし、OpenWRT 21.02.0リリース版になってみると、いろいろ設定画面が変更となり、この手順のままでは動作させることができなかった。

ぐぐってみたところ「OpenWrt(21.02)でIPv6インターネットを使う」に手順があったので、参考にしつつ手順を更新した。

前書き

OpenWRTルータを作成するにあたり、いろいろある選択肢からRockchip RK3328のNanoPi R2S と Rockchip RK3399のNanoPi R4S を候補にあげた。

Amazon日本の倉庫に在庫があるというのと、openWRTのページに「FriendlyARM NanoPi R2S」とデバイスに関する個別ページが作成されており、リリース版の提供がされていたので、NanoPi R2Sを買って設定を行った。

ちなみに置き換え対象となったGL-MV1000とのサイズ比較はこんな感じ

OpenWRT 21.02.0-RC版の時代はアップグレードしたら以前の設定を残しておくと起動しなくなるとか問題もありましたが、OpenWRT 21.02.0リリース版を書き込んだあと設定復旧で動作させることができました。

設定手順0: MicroSD作成

friendlyarm_nanopi-r2s-squashfs-sysupgrade.img.gz を展開したものをmicroSDに書き込んでNanoPi R2Sを起動。

設定手順1:パッケージの追加

mapパッケージと日本語UIパッケージ(luci-i18n-base-ja)をインストール

また、後述のニチバン対策を行う場合は iptables-mod-ipopt もインストールする。

GUIの場合、[システム]-[Software]にて、「Update lists」を実行してパッケージ一覧を取得した後に、「Filter」にパッケージ名を入れて、出てきたモジュールを「Install」する。

CLIでインストールする場合は以下を実行

# opkg update
# opkg install luci-i18n-base-ja
# opkg install map
# okpg install iptables-mod-ipopt

インストール後は再起動を行うこと。

再起動しないとluciのネットワーク設定で「プロトコル:MAP / LW4over6」が選択肢に現れません。

設定手順2:WAN6インタフェースの作成

WAN6インタフェースがなければ「プロトコル: DHCPv6クライアント」で作成する

最初はそのまま設定して、有効化し、WAN6インタフェースに割り当てられるIPv6アドレスを確認すること。

↑の画像は使い回しなので、この段階では無いはずの「MAP」インタフェースなどが入ってます

上記のようにWAN6インタフェースに「IPv6」アドレスが確認できたら、そのアドレスをコピーして、notepadにでも貼り付けておきます。

設定手順3:WAN6インタフェースにDHCPv6関連設定

openWRT 21.02.0のリリース版になったらWAN6インタフェースではDHCPv6関連設定がGUIできるようになりました。

[DHCPサーバー]を選択して、下記のようになっている場合は「DHCPサーバーをセットアップ」をクリックします。

クリックしたあと[一般設定]タブは下記のような感じで変更せず

[IPv6設定]タブで下記の設定を行います。

Designated master: チェックを入れる
RA-Service:リレーモード
DHCPv6-サービス: リレーモード
NDP-Proxy: リレーモード
(Learn routesは設定を変更していない)

設定手順4:LANインタフェースにDHCPv6関連設定

LANインタフェースの[DHCPサーバー]-[IPv6設定]で以下の設定を行います。

RA-Service:リレーモード
DHCPv6-サービス: サーバーモード
NDP-Proxy: リレーモード

(マスターにチェックは入れません)

設定手順5: IPv6 PD設定

OpenWRT 21.02.0-RC版だとIPv6 PD設定がWAN6にあったのですが、リリース版だと消えています。

これは別のインタフェースとして作成することで対応するようです。

[インタフェースを新規作成]から下記でインタフェースを作成します。

名前:WAN6PD
プロトコル:静的アドレス
デバイス: WAN6インタフェース(@wan6表記)

詳細設定では手順2で確認したIPv6アドレスを使います。

IPv6アドレスが「IPv6: wwww:xxxx:yyyy:zzzz:aaaa:bbbb:cccc:dddd/64」というようになっているとき、先頭の4カラム「wwww:xxxx:yyyy:zzzz」を使います。

まず、WAN6PDに割り当てる 「wwww:xxxx:yyyy:zzzz::1001」を「IPv6アドレス」に設定します。

「IPv6 ゲートウェイ」には「wwww:xxxx:yyyy:zzzz::1 」を指定します。このアドレスは設定完了後、WAN6PDインタフェースではなく、LANインタフェースに対して割り当てられます。

「IPv6ルートプレフィックス」には「wwww:xxxx:yyyy:zzzz::/56」と指定します。

設定すると上記のような感じです。

設定手順6: MAP-E接続設定

インタフェースの新規作成で「プロトコル:MAP / LW4over6」を作成して、必要な値を入れていきます。今回は「WAN_MAP」で作成しました。

[一般設定]では下記の様にしました。

プロトコル:MAP/LW4over6
タイプ:MAP-E
以後は環境に合わせた値

[詳細設定]では「従来のMAPを使用」にチェックを入れる

設定手順7: 各インタフェースのファイアウォールゾーン設定

wan系のゾーンに「wan_map」と「WAN6PD」を追加します。

設定完了

ひとまずこれで設定完了です。

うまく接続が始まらない場合は、再起動してみてください。

設定:ニチバン対策

通称「ニチバンベンチ」と呼ばれているものがある。

一部のIPv4通信のみが可能なサイトにアクセスした際に、一定数以上の通信が行えなくなりコンテンツが欠けるなどの現象が発生することがある。

これはNATテーブルの利用手法と、一回確保したNATテーブルエントリの有効期限設定の兼ね合いで、MAP-Eで確保できるIPv4通信用のNAT用ポートを使い果たしてしまった場合に発生している。

大量の小さなファイルがWebサーバ側の同時セッション数が非常に多い設定で流れてこなければならないので、この現象が発生しているかどうかを意図的に確認するのがなかなか難しいものがある。

しかし、長らくニチバンサイトではその条件に合致するサイト構造であったため、ニチバンサイトを10窓ぐらいでリロードすれば発生していたため、確認手法としてニチバンにアクセスすることを「ニチバンベンチ」と呼称していた。(なお、2021年9月時点のニチバンサイトはサイト内容が一新され発生しなくなっている)

このNATテーブルとIPv4 ポート割り当ての問題を解消するためにiptablesを利用して割り当て手法の調整を行う https://paste.teknik.io/VeN9r を使用した。

IP4,PSID, TUNDEVは自分の環境に合わせて変更すること
IP4, PSIDがわからない場合は http://ipv4.web.fc2.com/map-e.html で確認すること

TUNDEVは、GUIから設定した名前ではなく、アイコンの下に小さく書かれている方の名前を使う。↑の場合は「map-wan_map」になる。

また、units1とunits2は、BIGLOBEはV6plus相当であるため、数値を変更する。

units1=15 #V6plus:15 OCN:63
units2=4096 #V6plus 4096 OCN:1024
IP4='xxx.xxx.xxx.xxx'
PSID='x'
TUNDEV='map-wan_map'


iptables -t nat -F PREROUTING
iptables -t nat -F OUTPUT
iptables -t nat -F POSTROUTING

rule=1
while [ $rule -le $units1  ] ; do
  mark=`expr $rule + 16`
  pn=`expr $rule - 1`
  portl=`expr $rule \* $units2 + $PSID \* 16`
  portr=`expr $portl + 15`

  iptables -t nat -A PREROUTING -m statistic --mode nth --every $units1 --packet $pn -j MARK --set-mark $mark
  iptables -t nat -A OUTPUT -m statistic --mode nth --every $units1 --packet $pn -j MARK --set-mark $mark

  iptables -t nat -A POSTROUTING -p icmp -o $TUNDEV -m mark --mark $mark -j SNAT --to $IP4:$portl-$portr
  iptables -t nat -A POSTROUTING -p tcp -o $TUNDEV -m mark --mark $mark -j SNAT --to $IP4:$portl-$portr
  iptables -t nat -A POSTROUTING -p udp -o $TUNDEV -m mark --mark $mark -j SNAT --to $IP4:$portl-$portr
  rule=`expr $rule + 1`
done

上記をopenwrtの[ネットワーク]-[ファイヤーウォール]-[Custom Rules] (/etc/firewall.user) に記載する。

また、[システム]-[スタートアップ]-[ローカルスタートアップ] (/etc/rc.local)の exit 0よりも前に下記2行を追加する

sleep 30
sh /etc/firewall.user

なお、iptablesのstatisticモジュールはiptables-mod-ipoptに入っているが、標準では導入されていないため、冒頭でインストールしているが、まだの場合は下記のような感じでインストールする。

root@nanopi:~# opkg install iptables-mod-ipopt
Installing iptables-mod-ipopt (1.8.7-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.0-rc1/targets/rockchip/armv8/packages/iptables-mod-ipopt_1.8.7-1_aarch64_generic.ipk
Installing kmod-ipt-ipopt (5.4.111-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.0-rc1/targets/rockchip/armv8/packages/kmod-ipt-ipopt_5.4.111-1_aarch64_generic.ipk
Configuring kmod-ipt-ipopt.
Configuring iptables-mod-ipopt.
root@nanopi:~#

これで、とりあえずニチバンもスムースに開けるようになった。


参考資料

/etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdaf:6014:6f21::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth1'

config device
        option name 'eth1'
        option macaddr '1a:e4:a4:73:0d:0c'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.1.1'

config device
        option name 'eth0'
        option macaddr '1a:e4:a4:73:0d:0b'

config interface 'wan'
        option device 'eth0'
        option proto 'dhcp'
        option auto '0'

config interface 'wan6'
        option device 'eth0'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'

config interface 'wan_map'
        option proto 'map'
        option maptype 'map-e'
        option peeraddr '2404:9200:225:100::64'
        option ipaddr 'xxx.xxx.xxx.xxx'
        option ip4prefixlen '15'
        option ip6prefix 'wwww:xxxx::'
        option ip6prefixlen '31'
        option ealen '25'
        option psidlen '8'
        option offset '4'
        option legacymap '1'

config interface 'WAN6PD'
        option proto 'static'
        list ip6addr 'wwww:xxxx:yyyy:zzzz::1001'
        option ip6gw 'wwww:xxxx:yyyy:zzzz::1'
        option ip6prefix 'wwww:xxxx:yyyy:zzzz::/56'
        option device '@wan6'

/etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option ra 'relay'
        option ndp 'relay'
        list ra_flags 'none'
        option dhcpv6 'server'

config dhcp 'wan6'
        option dhcpv6 'relay'
        option ra 'relay'
        option ndp 'relay'
        option master '1'
        option interface 'wan6'
        option ignore '1'
        list ra_flags 'none'

iptablesの結果

意図した分散が行われているかを「iptables -t nat -L -v」のPOSTROUTING tcp/udpのpkts/bytesカウントが分散して増加していっているかを確認する。

ちなみに、 /etc/rc.local にsleep 30とsh /etc/firewall.user を入れないと、システムが生成した分散ルールも残って表示される。

root@nanopi:~# iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 2756 packets, 474K bytes)
 pkts bytes target     prot opt in     out     source               destination
  185 32012 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 MARK set 0x11
  184 28575 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 1 MARK set 0x12
  184 31952 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 2 MARK set 0x13
  184 31323 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 3 MARK set 0x14
  184 33123 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 4 MARK set 0x15
  184 36047 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 5 MARK set 0x16
  184 32939 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 6 MARK set 0x17
  184 33412 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 7 MARK set 0x18
  184 29916 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 8 MARK set 0x19
  184 28526 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 9 MARK set 0x1a
  184 29308 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 10 MARK set 0x1b
  183 32364 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 11 MARK set 0x1c
  183 30150 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 12 MARK set 0x1d
  183 29944 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 13 MARK set 0x1e
  183 34100 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 14 MARK set 0x1f

Chain INPUT (policy ACCEPT 598 packets, 40818 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 67 packets, 5056 bytes)
 pkts bytes target     prot opt in     out     source               destination
    5   372 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 MARK set 0x11
    5   372 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 1 MARK set 0x12
    5   372 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 2 MARK set 0x13
    5   372 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 3 MARK set 0x14
    5   380 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 4 MARK set 0x15
    5   380 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 5 MARK set 0x16
    5   380 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 6 MARK set 0x17
    4   300 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 7 MARK set 0x18
    4   304 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 8 MARK set 0x19
    4   304 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 9 MARK set 0x1a
    4   304 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 10 MARK set 0x1b
    4   304 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 11 MARK set 0x1c
    4   304 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 12 MARK set 0x1d
    4   304 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 13 MARK set 0x1e
    4   304 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 14 MARK set 0x1f

Chain POSTROUTING (policy ACCEPT 23 packets, 1064 bytes)
 pkts bytes target     prot opt in     out     source               destination
    2   168 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xxx.xxx.xxx:5856-5871
   41  2607 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xxx.xxx.xxx:5856-5871
    8   557 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xxx.xxx.xxx:5856-5871
    4   336 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xxx.xxx.xxx:9952-9967
   50  3503 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xxx.xxx.xxx:9952-9967
   13   868 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xxx.xxx.xxx:9952-9967
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xxx.xxx.xxx:14048-14063
   46  2981 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xxx.xxx.xxx:14048-14063
   11   771 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xxx.xxx.xxx:14048-14063
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xxx.xxx.xxx:18144-18159
   33  1991 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xxx.xxx.xxx:18144-18159
   10   709 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xxx.xxx.xxx:18144-18159
    2   168 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xxx.xxx.xxx:22240-22255
   38  2280 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xxx.xxx.xxx:22240-22255
   13   950 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xxx.xxx.xxx:22240-22255
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xxx.xxx.xxx:26336-26351
   42  3095 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xxx.xxx.xxx:26336-26351
   11   831 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xxx.xxx.xxx:26336-26351
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xxx.xxx.xxx:30432-30447
   51  3838 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xxx.xxx.xxx:30432-30447
   11   823 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xxx.xxx.xxx:30432-30447
    1    84 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xxx.xxx.xxx:34528-34543
   41  2564 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xxx.xxx.xxx:34528-34543
    9   656 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xxx.xxx.xxx:34528-34543
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xxx.xxx.xxx:38624-38639
   44  2665 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xxx.xxx.xxx:38624-38639
    9   629 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xxx.xxx.xxx:38624-38639
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xxx.xxx.xxx:42720-42735
   55  3841 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xxx.xxx.xxx:42720-42735
   11   762 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xxx.xxx.xxx:42720-42735
    1    84 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xxx.xxx.xxx:46816-46831
   53  3161 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xxx.xxx.xxx:46816-46831
   10   699 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xxx.xxx.xxx:46816-46831
    2   168 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xxx.xxx.xxx:50912-50927
   46  2965 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xxx.xxx.xxx:50912-50927
    9   632 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xxx.xxx.xxx:50912-50927
    1    84 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xxx.xxx.xxx:55008-55023
   45  2700 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xxx.xxx.xxx:55008-55023
   10   671 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xxx.xxx.xxx:55008-55023
    1    84 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xxx.xxx.xxx:59104-59119
   48  2992 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xxx.xxx.xxx:59104-59119
   15  1003 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xxx.xxx.xxx:59104-59119
    1    84 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xxx.xxx.xxx:63200-63215
   38  2280 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xxx.xxx.xxx:63200-63215
    9   615 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xxx.xxx.xxx:63200-63215

Chain postrouting_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain postrouting_rule (0 references)
 pkts bytes target     prot opt in     out     source               destination

Chain postrouting_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_rule (0 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain zone_lan_postrouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 postrouting_lan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom lan postrouting rule chain */

Chain zone_lan_prerouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
  389 44358 prerouting_lan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom lan prerouting rule chain */

Chain zone_wan_postrouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 postrouting_wan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom wan postrouting rule chain */
    0     0 MASQUERADE  all  --  any    any     anywhere             anywhere             /* !fw3 */

Chain zone_wan_prerouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
    6   786 prerouting_wan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom wan prerouting rule chain */
root@nanopi:~#

2021/09/22追記: 8日間稼働した後の状態

root@nanopi:~# iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 1434K packets, 285M bytes)
 pkts bytes target     prot opt in     out     source               destination
95575   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 MARK set 0x11
95574   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 1 MARK set 0x12
95574   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 2 MARK set 0x13
95574   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 3 MARK set 0x14
95574   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 4 MARK set 0x15
95574   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 5 MARK set 0x16
95574   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 6 MARK set 0x17
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 7 MARK set 0x18
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 8 MARK set 0x19
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 9 MARK set 0x1a
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 10 MARK set 0x1b
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 11 MARK set 0x1c
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 12 MARK set 0x1d
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 13 MARK set 0x1e
95573   19M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 14 MARK set 0x1f

Chain INPUT (policy ACCEPT 231K packets, 17M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 1399 packets, 222K bytes)
 pkts bytes target     prot opt in     out     source               destination
   94 15373 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 MARK set 0x11
   94 16668 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 1 MARK set 0x12
   94 13812 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 2 MARK set 0x13
   94 14151 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 3 MARK set 0x14
   93 14819 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 4 MARK set 0x15
   93 13431 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 5 MARK set 0x16
   93 15387 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 6 MARK set 0x17
   93 14528 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 7 MARK set 0x18
   93 15124 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 8 MARK set 0x19
   93 16367 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 9 MARK set 0x1a
   93 14850 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 10 MARK set 0x1b
   93 14763 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 11 MARK set 0x1c
   93 14121 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 12 MARK set 0x1d
   93 13029 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 13 MARK set 0x1e
   93 15394 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 14 MARK set 0x1f

Chain POSTROUTING (policy ACCEPT 1289 packets, 186K bytes)
 pkts bytes target     prot opt in     out     source               destination
  772 64680 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xxx.xxx.xxx:5856-5871
14703  948K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xxx.xxx.xxx:5856-5871
 3753  257K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xxx.xxx.xxx:5856-5871
  837 70140 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xxx.xxx.xxx:9952-9967
14623  945K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xxx.xxx.xxx:9952-9967
 3628  254K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xxx.xxx.xxx:9952-9967
  806 67536 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xxx.xxx.xxx:14048-14063
14690  930K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xxx.xxx.xxx:14048-14063
 3705  257K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xxx.xxx.xxx:14048-14063
  853 71540 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xxx.xxx.xxx:18144-18159
14620  936K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xxx.xxx.xxx:18144-18159
 3696  255K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xxx.xxx.xxx:18144-18159
  802 67088 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xxx.xxx.xxx:22240-22255
14833  942K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xxx.xxx.xxx:22240-22255
 3723  256K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xxx.xxx.xxx:22240-22255
  834 69944 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xxx.xxx.xxx:26336-26351
14759  930K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xxx.xxx.xxx:26336-26351
 3689  258K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xxx.xxx.xxx:26336-26351
  804 67480 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xxx.xxx.xxx:30432-30447
14874  946K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xxx.xxx.xxx:30432-30447
 3746  261K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xxx.xxx.xxx:30432-30447
  868 72800 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xxx.xxx.xxx:34528-34543
14703  937K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xxx.xxx.xxx:34528-34543
 3698  254K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xxx.xxx.xxx:34528-34543
  843 70644 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xxx.xxx.xxx:38624-38639
14651  931K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xxx.xxx.xxx:38624-38639
 3720  256K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xxx.xxx.xxx:38624-38639
  768 64288 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xxx.xxx.xxx:42720-42735
14731  942K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xxx.xxx.xxx:42720-42735
 3689  251K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xxx.xxx.xxx:42720-42735
  839 70084 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xxx.xxx.xxx:46816-46831
14826  944K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xxx.xxx.xxx:46816-46831
 3729  257K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xxx.xxx.xxx:46816-46831
  841 70420 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xxx.xxx.xxx:50912-50927
14751  939K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xxx.xxx.xxx:50912-50927
 3697  252K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xxx.xxx.xxx:50912-50927
  783 65492 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xxx.xxx.xxx:55008-55023
14802  937K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xxx.xxx.xxx:55008-55023
 3679  255K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xxx.xxx.xxx:55008-55023
  850 71288 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xxx.xxx.xxx:59104-59119
14824  942K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xxx.xxx.xxx:59104-59119
 3622  246K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xxx.xxx.xxx:59104-59119
  870 72968 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xxx.xxx.xxx:63200-63215
14802  941K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xxx.xxx.xxx:63200-63215
 3684  258K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xxx.xxx.xxx:63200-63215

Chain postrouting_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain postrouting_rule (0 references)
 pkts bytes target     prot opt in     out     source               destination

Chain postrouting_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_rule (0 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain zone_lan_postrouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 postrouting_lan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom lan postrouting rule chain */

Chain zone_lan_prerouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
  389 44358 prerouting_lan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom lan prerouting rule chain */

Chain zone_wan_postrouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 postrouting_wan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom wan postrouting rule chain */
    0     0 MASQUERADE  all  --  any    any     anywhere             anywhere             /* !fw3 */

Chain zone_wan_prerouting (0 references)
 pkts bytes target     prot opt in     out     source               destination
    6   786 prerouting_wan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom wan prerouting rule chain */
root@nanopi:~#

2022/04/14追記

32日起動していた場合の出力なんだけど、以前と違って「conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat」の数が増えてないのはなんなのだ???

root@nanopi:~# uptime
 09:48:41 up 32 days, 12:38,  load average: 0.00, 0.01, 0.00
root@nanopi:~# iptables -t nat -L -v
Chain PREROUTING (policy ACCEPT 6326K packets, 1296M bytes)
 pkts bytes target     prot opt in     out     source               destination
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 MARK set 0x11
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 1 MARK set 0x12
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 2 MARK set 0x13
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 3 MARK set 0x14
 422K   87M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 4 MARK set 0x15
 422K   87M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 5 MARK set 0x16
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 6 MARK set 0x17
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 7 MARK set 0x18
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 8 MARK set 0x19
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 9 MARK set 0x1a
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 10 MARK set 0x1b
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 11 MARK set 0x1c
 422K   87M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 12 MARK set 0x1d
 422K   87M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 13 MARK set 0x1e
 422K   86M MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 14 MARK set 0x1f
6326K 1296M prerouting_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom prerouting rule chain */
6321K 1295M zone_lan_prerouting  all  --  br-lan any     anywhere             anywhere             /* !fw3 */
    0     0 zone_wan_prerouting  all  --  eth0   any     anywhere             anywhere             /* !fw3 */
 4905  558K zone_wan_prerouting  all  --  map-wan_map any     anywhere             anywhere             /* !fw3 */

Chain INPUT (policy ACCEPT 1037K packets, 79M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 9463 packets, 1532K bytes)
 pkts bytes target     prot opt in     out     source               destination
  632  101K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 MARK set 0x11
  631  103K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 1 MARK set 0x12
  631  100K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 2 MARK set 0x13
  631 99184 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 3 MARK set 0x14
  631  101K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 4 MARK set 0x15
  631  103K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 5 MARK set 0x16
  631  105K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 6 MARK set 0x17
  631  102K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 7 MARK set 0x18
  631  102K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 8 MARK set 0x19
  631 97260 MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 9 MARK set 0x1a
  631  104K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 10 MARK set 0x1b
  631  102K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 11 MARK set 0x1c
  631  105K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 12 MARK set 0x1d
  630  100K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 13 MARK set 0x1e
  630  104K MARK       all  --  any    any     anywhere             anywhere             statistic mode nth every 15 packet 14 MARK set 0x1f

Chain POSTROUTING (policy ACCEPT 7238 packets, 1363K bytes)
 pkts bytes target     prot opt in     out     source               destination
 2962  257K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xx.xxx.xx:5856-5871
62597 4208K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xx.xxx.xx:5856-5871
14955 4828K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x11 to:xxx.xx.xxx.xx:5856-5871
 2998  256K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xx.xxx.xx:9952-9967
62399 4173K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xx.xxx.xx:9952-9967
14973 4852K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x12 to:xxx.xx.xxx.xx:9952-9967
 2972  263K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xx.xxx.xx:14048-14063
62056 4109K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xx.xxx.xx:14048-14063
14958 4830K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x13 to:xxx.xx.xxx.xx:14048-14063
 3020  270K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xx.xxx.xx:18144-18159
62491 4170K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xx.xxx.xx:18144-18159
15125 4922K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x14 to:xxx.xx.xxx.xx:18144-18159
 2948  255K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xx.xxx.xx:22240-22255
62215 4170K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xx.xxx.xx:22240-22255
15160 4931K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x15 to:xxx.xx.xxx.xx:22240-22255
 2985  259K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xx.xxx.xx:26336-26351
62214 4147K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xx.xxx.xx:26336-26351
15056 4989K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x16 to:xxx.xx.xxx.xx:26336-26351
 3116  271K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xx.xxx.xx:30432-30447
62050 4150K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xx.xxx.xx:30432-30447
15061 4789K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x17 to:xxx.xx.xxx.xx:30432-30447
 2973  256K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xx.xxx.xx:34528-34543
62684 4173K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xx.xxx.xx:34528-34543
15055 4832K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x18 to:xxx.xx.xxx.xx:34528-34543
 3046  272K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xx.xxx.xx:38624-38639
62090 4162K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xx.xxx.xx:38624-38639
14894 4747K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x19 to:xxx.xx.xxx.xx:38624-38639
 3045  263K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xx.xxx.xx:42720-42735
62550 4157K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xx.xxx.xx:42720-42735
15085 4847K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1a to:xxx.xx.xxx.xx:42720-42735
 2970  255K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xx.xxx.xx:46816-46831
62369 4167K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xx.xxx.xx:46816-46831
14965 4803K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1b to:xxx.xx.xxx.xx:46816-46831
 2912  257K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xx.xxx.xx:50912-50927
62665 4189K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xx.xxx.xx:50912-50927
15057 4704K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1c to:xxx.xx.xxx.xx:50912-50927
 3024  263K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xx.xxx.xx:55008-55023
62282 4191K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xx.xxx.xx:55008-55023
15039 4877K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1d to:xxx.xx.xxx.xx:55008-55023
 3022  262K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xx.xxx.xx:59104-59119
62369 4163K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xx.xxx.xx:59104-59119
15014 4877K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1e to:xxx.xx.xxx.xx:59104-59119
 3001  261K SNAT       icmp --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xx.xxx.xx:63200-63215
62511 4145K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xx.xxx.xx:63200-63215
15094 4836K SNAT       udp  --  any    map-wan_map  anywhere             anywhere             mark match 0x1f to:xxx.xx.xxx.xx:63200-63215
10025 1475K postrouting_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom postrouting rule chain */
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 0 */ to:xxx.xx.xxx.xx:5856-5871
 2787  111K SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 1 */ to:xxx.xx.xxx.xx:5856-5871
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 2 */ to:xxx.xx.xxx.xx:5856-5871
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 3 */ to:xxx.xx.xxx.xx:9952-9967
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 4 */ to:xxx.xx.xxx.xx:9952-9967
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 5 */ to:xxx.xx.xxx.xx:9952-9967
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 6 */ to:xxx.xx.xxx.xx:14048-14063
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 7 */ to:xxx.xx.xxx.xx:14048-14063
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 8 */ to:xxx.xx.xxx.xx:14048-14063
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 9 */ to:xxx.xx.xxx.xx:18144-18159
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 10 */ to:xxx.xx.xxx.xx:18144-18159
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 11 */ to:xxx.xx.xxx.xx:18144-18159
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 12 */ to:xxx.xx.xxx.xx:22240-22255
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 13 */ to:xxx.xx.xxx.xx:22240-22255
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 14 */ to:xxx.xx.xxx.xx:22240-22255
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 15 */ to:xxx.xx.xxx.xx:26336-26351
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 16 */ to:xxx.xx.xxx.xx:26336-26351
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 17 */ to:xxx.xx.xxx.xx:26336-26351
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 18 */ to:xxx.xx.xxx.xx:30432-30447
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 19 */ to:xxx.xx.xxx.xx:30432-30447
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 20 */ to:xxx.xx.xxx.xx:30432-30447
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 21 */ to:xxx.xx.xxx.xx:34528-34543
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 22 */ to:xxx.xx.xxx.xx:34528-34543
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 23 */ to:xxx.xx.xxx.xx:34528-34543
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 24 */ to:xxx.xx.xxx.xx:38624-38639
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 25 */ to:xxx.xx.xxx.xx:38624-38639
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 26 */ to:xxx.xx.xxx.xx:38624-38639
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 27 */ to:xxx.xx.xxx.xx:42720-42735
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 28 */ to:xxx.xx.xxx.xx:42720-42735
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 29 */ to:xxx.xx.xxx.xx:42720-42735
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 30 */ to:xxx.xx.xxx.xx:46816-46831
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 31 */ to:xxx.xx.xxx.xx:46816-46831
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 32 */ to:xxx.xx.xxx.xx:46816-46831
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 33 */ to:xxx.xx.xxx.xx:50912-50927
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 34 */ to:xxx.xx.xxx.xx:50912-50927
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 35 */ to:xxx.xx.xxx.xx:50912-50927
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 36 */ to:xxx.xx.xxx.xx:55008-55023
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 37 */ to:xxx.xx.xxx.xx:55008-55023
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 38 */ to:xxx.xx.xxx.xx:55008-55023
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 39 */ to:xxx.xx.xxx.xx:59104-59119
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 40 */ to:xxx.xx.xxx.xx:59104-59119
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 41 */ to:xxx.xx.xxx.xx:59104-59119
    0     0 SNAT       icmp --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 42 */ to:xxx.xx.xxx.xx:63200-63215
    0     0 SNAT       tcp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 43 */ to:xxx.xx.xxx.xx:63200-63215
    0     0 SNAT       udp  --  any    map-wan_map  anywhere             anywhere             #conn dst/32 <= 16 /* !fw3: ubus:wan_map[map] nat 44 */ to:xxx.xx.xxx.xx:63200-63215
 7137 1356K zone_lan_postrouting  all  --  any    br-lan  anywhere             anywhere             /* !fw3 */
    0     0 zone_wan_postrouting  all  --  any    eth0    anywhere             anywhere             /* !fw3 */
    0     0 zone_wan_postrouting  all  --  any    map-wan_map  anywhere             anywhere             /* !fw3 */

Chain postrouting_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain postrouting_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain postrouting_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_lan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain prerouting_wan_rule (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain zone_lan_postrouting (1 references)
 pkts bytes target     prot opt in     out     source               destination
 7137 1356K postrouting_lan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom lan postrouting rule chain */

Chain zone_lan_prerouting (1 references)
 pkts bytes target     prot opt in     out     source               destination
6321K 1295M prerouting_lan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom lan prerouting rule chain */

Chain zone_wan_postrouting (2 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 postrouting_wan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom wan postrouting rule chain */
    0     0 MASQUERADE  all  --  any    any     anywhere             anywhere             /* !fw3 */

Chain zone_wan_prerouting (2 references)
 pkts bytes target     prot opt in     out     source               destination
 4905  558K prerouting_wan_rule  all  --  any    any     anywhere             anywhere             /* !fw3: Custom wan prerouting rule chain */
root@nanopi:~#

これはどうやら、openwrt起動後にSoftwareパッケージの個別更新を実施していたのだが、ネットワークのrestartが行われた際に、iptablesが再設定されたためだったようで、openwrt全体を再起動した正常になった。

現在行っている設定はネットワーク開始後に /etc/rc.local からiptablesの設定を追加しているので、rc.localで行うことが消えた、という感じである

NanoPi R2S+openWRT 21.02.0RCでBIGLOBEのMAP-E接続


2021/09/14追記

OpenWRT 21.02.0リリース版にてだいぶ手順が変わってしまったので、あたらしく「NanoPi R2S+OpenWRT 21.02.0でBIGLOBEのMAP-E接続」として修正しています。

この記事は古い内容となります。


GL.iNET GL-MV1000を使っていたわけですが2020年8月以降IPv6が無効化、そのまま放置され、2021年4月になって再度有効化されたものの、GL.iNETが提供する機能以外の部分はほぼ切り捨てられてしまいました。

GL.iNET firmwareの駄目なところ
・GL.iNET UIで提供されている機能はGL.iNET側で有効化しないとluci側で行った設定が有効にならない(DynamicDNSやIPv6など)
・追加したパッケージはfirmwareバージョンアップ時に削除される(GUI上はパッケージを追加する、とか表示されるけど追加されたことはない)
・GL.iNet ver 3.201だとluci パッケージがインストールされていないため詳細設定が出来ない
・パッケージを追加するにはネットワーク接続が必須だがGL.iNET UIだと詳細設定ができないのでネットワーク接続ができない場合がある

そんな状況が約1年続いたわけなので、さすがに諦めました。

代替としてRockchip RK3328のNanoPi R2S と Rockchip RK3399のNanoPi R4S を候補にあげた。

Amazon日本の倉庫に在庫があるというのと、openWRTのページに「FriendlyARM NanoPi R2S」とデバイスに関する個別ページが作成されており、snapshotの提供がされていたので、NanoPi R2Sを買って設定を行った。

画像
画像

ちなみに置き換え対象となったGL-MV1000とのサイズ比較はこんな感じ

画像
画像

さて、openWRTの設定を行ったタイミングではopenWRT 21.02.0 rc1の提供が開始されていたのでそちらを使用した。(2021/07/12追記 openWRT 21.02.0 rc3は壊れているようでLANポートが稼働しないので使わないこと。やるのであればrc2)

friendlyarm_nanopi-r2s-squashfs-sysupgrade.img.gz を展開したものをmicroSDに書き込んでNanoPi R2Sを起動した。

設定手順1:パッケージの追加

mapパッケージと日本語UIパッケージ(luci-i18n-base-ja)をインストール

CLIでインストールする場合は以下を実行

# opkg update
# opkg install luci-i18n-base-ja
# opkg install map

インストール後は再起動を行うこと。

再起動しないとluciのネットワーク設定で「プロトコル:MAP / LW4over6」が選択肢に現れません。

設定手順2:WAN6インタフェースの作成

WAN6インタフェースがなければ「プロトコル: DHCPv6クライアント」で作成する

最初はそのまま設定して、有効化し、WAN6インタフェースに割り当てられるIPv6アドレスを確認すること。

↑の画像は使い回しなので、この段階では無いはずの「MAP」インタフェースが入ってます

上記のように「IPv6」アドレスが確認できたら、そのアドレスをコピーして、[詳細設定]の「委任されたカスタムIPv6プレフィックス」に貼り付け「/56」とかつけます。

設定手順3:WAN6インタフェースにDHCPv6関連設定

openWRT 21.02の段階でもWAN6インタフェースではDHCPv6関連設定がGUIできない状態であるため、/etc/config/dhcpファイルを直接書き換えます。

必要な設定は「option dhcpv6 ‘relay」「option ra ‘relay’」「option ndp ‘relay’」「option master ‘1’」です。

変更したあとは、以下の様な感じになるかと思います。

config dhcp 'wan6'
        option dhcpv6 'relay'
        option ra 'relay'
        option ndp 'relay'
        option master '1'
        option interface 'wan6'
        option start '100'
        option limit '150'
        option leasetime '12h'

ファイル変更後は下記を実行して変更を反映します。

# uci commit dhcp
# /etc/init.d/odhcpd restart
# /etc/init.d/network restart

設定手順4:LANインタフェースにDHCPv6関連設定

LANインタフェースの[DHCPサーバー]-[IPv6設定]で以下の設定を行います。

RA-Service:リレーモード
DHCPv6-サービス: リレーモード
NDP-Proxy: リレーモード

(マスターにチェックは入れません)

設定手順5: MAP-E接続設定

インタフェースの新規作成で「プロトコル:AP / LW4over6」を作成して、必要な値を入れていきます。

[一般設定]では下記の様にしました。

プロトコル:MAP/LW4over6
タイプ:MAP-E
以後は環境に合わせた値

[詳細設定]では下記の2つを設定します。

「トンネルリンク: WAN6」
「従来のMAPを使用」にチェックを入れる

設定完了

ひとまずこれで設定完了です。

うまく接続が始まらない場合は、再起動してみてください。

設定:ニチバン対策

2chの「v6プラス関連 Part21」に下記のような書き込みがある。

757名無しさんに接続中… (ブーイモ MM0e-wDGU)2020/09/27(日) 12:54:30.84ID:cYRzN3kgM>>758
openwrtでMAP-Eされてる方で、
https://gist.github.com/anonymous/0fdec75fa20a7f1ce4806391d6b0429b
このgitのコメントにあるように、
json_add_boolean connlimit_ports 1を
json_add_string connlimit_ports “1”
に変えるor最新のfirewallパッケージを入れるで安定して通信出来てる人いますか?

これをする事でopenwrtで当たり前となってるmap.sh編集してMARKターゲット作ってstatisticで分散してって事をせずとも、
connlimitでポートセット使い切ったら次のポートセット移ってってfirewallがちゃんと出来上がるようになるけど、
ルール通りロールアウトしてる気配が全く無い。
ロールアウトせずパケ詰まりしてしまう。

795 757 (ブーイモ MMe7-PIvK)2020/09/30(水) 20:53:39.27ID:1mR0IohpM>>802
最終的にこのようなcunstom rulesになりました。
https://pastebin.pl/view/raw/06212cd8
多分ですが、map.shで自動生成されるiptablesだと、
–connlimit-maskの指定がなく32になるので、
それだとdestinationが0.0.0.0/0なのでマッチせずロールアウトされないんだと思います。
0にしてあげたらロールアウトしました。(間違ってたらご指摘下さい。)
TCPもnf_conntrack調整したらconnlimitでも大丈夫な感じでしたが、
statisticでかなり安定してるのでTCPのみstatisticにしました。
map.shはlegacy=1をコメントアウトするか、snapshotsから最新のmapをインストールした場合は、
option legacymap ‘1’をnetworkのmapインターフェイスに追記するだけで動くと思います。
markターゲット追加する改変は不要です。
custom rulesに書いただけだと、リブート時、custom rulesの後にmap.shがiptablesを書いてしまうので、
local startupに
sleep 30
sh /etc/firewall.ser
を書けばmap.shで自動生成されたNATテーブルを削除して改めて書いてくれます。

これで、ニチバンベンチ回してもTCPは詰まらないですし、
MAP-EでUDP hole puch使うアプリケーションが使えるので、PS系ゲーム機でNATタイプ2になりましたし、
SoftEtherでUDP高速化機能が使るようになりました。

アドバイス下さった>>758様や、スクリプト考案の先駆者様等、
有難うございます。

GL-MV1000時代にも試した「OpenWrt map-e (JPNE v6plus) において、割当ポート240個をちゃんと使わせるための設定。」はここでもうまく動作していなかった模様。

代替としてhttps://pastebin.pl/view/raw/06212cd8にある設定に置き換えるとある。

しかし「OpenWrt map-e (JPNE v6plus) において、割当ポート240個をちゃんと使わせるための設定。」のコメント欄を見ると、誤植があるようだった。

また、誤植修正後も接続状況が不安定なので出力されるiptablesの確認したところ、範囲外のポートを指定していることが判明

(2021/05/21追記: この差異はV6プラス/BIGLOBEとOCN バーチャルコネクトとの仕様の違いとのこと)

修正版として https://gist.github.com/osakanataro/a9ba5ded340070b8e6abc28969d7ae4f を作成した。

修正点
「units=63」→「units=15」
「portl=expr $rule \* 1024 + $PSID \* 16」→「portl=expr $rule \* 4096 + $PSID \* 16

IP4,PSID, LANDEV,WAN6DEV,TUNDEVは自分の環境に合わせて変更すること
IP4, PSIDがわからない場合は http://ipv4.web.fc2.com/map-e.html で確認すること

#units=63
units=15

IP4='xxx.xxx.xxx.xxx'
PSID=110
LANDEV='br-lan'
WAN6DEV='eth0'
TUNDEV='map-MAP'

iptables -t nat -F PREROUTING
iptables -t nat -F OUTPUT
iptables -t nat -F POSTROUTING

rule=1
while [ $rule -le $units  ] ; do
  mark=`expr $rule + 16`
  pn=`expr $rule - 1`
  portl=`expr $rule \* 4096 + $PSID \* 16`
  portr=`expr $portl + 15`

  echo iptables -t nat -A PREROUTING -p tcp -m statistic --mode nth --every $units --packet $pn -j MARK --set-mark $mark
  iptables -t nat -A PREROUTING -p tcp -m statistic --mode nth --every $units --packet $pn -j MARK --set-mark $mark
  echo iptables -t nat -A OUTPUT -p tcp -m statistic --mode nth --every $units --packet $pn -j MARK --set-mark $mark
  iptables -t nat -A OUTPUT -p tcp -m statistic --mode nth --every $units --packet $pn -j MARK --set-mark $mark

  echo iptables -t nat -A POSTROUTING -p icmp -m connlimit --connlimit-daddr --connlimit-upto 16 --connlimit-mask 0 -o $TUNDEV -j SNAT --to $IP4:$portl-$portr
  iptables -t nat -A POSTROUTING -p icmp -m connlimit --connlimit-daddr --connlimit-upto 16 --connlimit-mask 0 -o $TUNDEV -j SNAT --to $IP4:$portl-$portr
  echo iptables -t nat -A POSTROUTING -p tcp -o $TUNDEV -m mark --mark $mark -j SNAT --to $IP4:$portl-$portr
  iptables -t nat -A POSTROUTING -p tcp -o $TUNDEV -m mark --mark $mark -j SNAT --to $IP4:$portl-$portr
  echo iptables -t nat -A POSTROUTING -p udp -m connlimit --connlimit-daddr --connlimit-upto 16 --connlimit-mask 0 -o $TUNDEV -j SNAT --to $IP4:$portl-$portr
  iptables -t nat -A POSTROUTING -p udp -m connlimit --connlimit-daddr --connlimit-upto 16 --connlimit-mask 0 -o $TUNDEV -j SNAT --to $IP4:$portl-$portr

  rule=`expr $rule + 1`
done

上記を

openwrtの[ネットワーク]-[ファイヤーウォール]-[Custom Rules] (/etc/firewall.user) に記載する。

また、[システム]-[スタートアップ]-[ローカルスタートアップ] (/etc/rc.local)の exit 0よりも前に下記2行を追加する

sleep 30
sh /etc/firewall.user

また、iptablesのstatisticモジュールはiptables-mod-ipoptに入っているが、標準では導入されていないため、下記のようにインストールする。

root@nanopi:~# opkg install iptables-mod-ipopt
Installing iptables-mod-ipopt (1.8.7-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.0-rc1/targets/rockchip/armv8/packages/iptables-mod-ipopt_1.8.7-1_aarch64_generic.ipk
Installing kmod-ipt-ipopt (5.4.111-1) to root...
Downloading https://downloads.openwrt.org/releases/21.02.0-rc1/targets/rockchip/armv8/packages/kmod-ipt-ipopt_5.4.111-1_aarch64_generic.ipk
Configuring kmod-ipt-ipopt.
Configuring iptables-mod-ipopt.
root@nanopi:~#

これで、とりあえずニチバンもスムースに開けるようになった。


失敗例コレクション

「プロトコル:MAP / LW4over6」が選択肢にない

画像

mapパッケージインストール後、openWRTを再起動するまで、このプロトコル一覧は更新されませんでした。

再起動すると表示されるようになりました。

「MAP rule is invalidError: MAP rule is invalid」になる

「MAP rule is invalidError: MAP rule is invalid」はWAN6インタフェースの詳細設定で「委任されたカスタムIPv6プレフィックス」(ip6prefix)を設定していない場合に出力されました。

invalidと表示された時のWAN6インタフェースの「IPv6-PD」に表示されている値を突っ込んだら、invalidが解消されました。

設定ファイル的には/etc/config/networkのWAN6に関する記述に「list ip6prefix」を追加する感じです。

LAN内にDHCPv6アドレスが配布されない

nanoPi上は特に問題無くIPv6アドレスが割り当てられており動作もしているが、LAN内のクライアントにDHCPv6アドレスが配布されていないという状態になった。

これは、LANインタフェースの[DHCPサーバ]-[IPv6設定]にある「マスター」にチェックを一度でも入れてしまうと発生する事象だった。

一度チェックを入れて保存すると、/etc/config/dhcp に以下の様な設定が行われる。

<略>
config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option ra_maxinterval '600'
        option ra_mininterval '200'
        option ra_lifetime '1800'
        option ra_mtu '0'
        option ra_hoplimit '0'
        option ra 'relay'
        option dhcpv6 'relay'
        option ndp 'relay'
        option master '1'
<略>

この後、マスターのチェックを外すと、以下の様になる

<略>
config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option ra_maxinterval '600'
        option ra_mininterval '200'
        option ra_lifetime '1800'
        option ra_mtu '0'
        option ra_hoplimit '0'
        option ra 'relay'
        option dhcpv6 'relay'
        option ndp 'relay'
<略>

ここで問題となったのは以下の値でした。

        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option ra_maxinterval '600'
        option ra_mininterval '200'
        option ra_lifetime '1800'
        option ra_mtu '0'
        option ra_hoplimit '0'

これらの値が存在しているとDHCPv6アドレスのLAN内への配布がうまくいきませんでした。

/etc/config/networkを編集したあと、下記で反映することで動作するようになりました。

# uci commit dhcp
# /etc/init.d/odhcpd restart
# /etc/init.d/network restart

参考: IPv6 working on router but not on clients

MAP-E接続が開始されない

GL-MV1000からnanoPi R2Sに置き換えてすぐは、IPv6接続はできているが、MAP-E接続が開始されない、という状態になった。

ONUの電源を切り、5分ぐらいしてから電源を入れnanoPiも起動するとMAP-E接続が可能となった。

おそらく、接続先でのセッション認識が消えないと別のデバイスでの接続が行うことができないようだ。(エラーにもならないので詳細は不明)


参考資料

/etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd23:66f8:d98f::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.1.1'
        option ip6assign '60'

config device 'lan_eth1_dev'
        option name 'eth1'
        option macaddr '1a:e4:a4:xx:xx:xx'

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'
        option auto '0'

config device 'wan_eth0_dev'
        option name 'eth0'
        option macaddr '1a:e4:a4:xx:xx:xx'

config interface 'wan6'
        option ifname 'eth0'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'
        list ip6prefix 'xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/56'

config interface 'MAP'
        option proto 'map'
        option maptype 'map-e'
        option peeraddr 'xxxx:xxxx:xxxx:xxxx::64'
        option ipaddr 'xxx.xxx.xxx.xxx'
        option ip4prefixlen '15'
        option ip6prefix '240b:10::'
        option ip6prefixlen '31'
        option ealen '25'
        option psidlen '8'
        option offset '4'
        option tunlink 'wan6'
        option legacymap '1'

/etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'
        option ednspacket_max '1232'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv4 'server'
        option ra 'relay'
        option dhcpv6 'relay'
        option ndp 'relay'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config dhcp 'wan6'
        option dhcpv6 'relay'
        option ra 'relay'
        option ndp 'relay'
        option master '1'
        option interface 'wan6'
        option start '100'
        option limit '150'
        option leasetime '12h'

microSDのアプリケーションクラス/ビデオクラスによる速度の違い実測


SD/SDHC/SDXCカードには速度に関する仕様がいくつかある。

以前は「スピードクラス」だけをうたっていたが、これだけだと実際にはある細かい性能差が表現できていないので「ビデオスピードクラス」というのと「アプリケーションクラス」というものが追加されている。

で・・・ラズパイでOS起動ディスクとして使う場合に何がいいのか、という話である。

Windows 10 on ARMの起動ディスクを作成し、初回起動するのにどれくらい時間がかかるかを確認してみた。

関連「microSDのA1/A2,V10/V30に差が出るか?

製品名クラス容量WoR書き込みお住まいの
地域選択
デスクトップ
表示
SanDisk Extreme ProU3/A2/V3064GB37分18分5分
SanDisk Extreme(金色)U3/A2/V3064GB28分16分5分
Lexar 633xU3/A1/V3064GB27分16分5分
SanDisk HIGH ENDURANCE(白)U3/V3032GB33分18分6分
KIOXIA EXCERIA PLUS(紫)U3/V3032GB32分17分5分
SanDisk Extreme ProU3/A1/V3032GB43分19分5分
Lexar 633xU1/A1/V1032GB30分17分6分
SanDisk UltraU1/A132GB33分17分5分
KIOXIA EXCERIA HIGH ENDURANCE(黄緑)U132GB31分  
Samsung EVO PlusU132GB74分35分8分

最近のmicroSDであればおもったより差がでない