0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

フラッシュメモリの空き容量が 10MB しかない OpenWrt で Tailscale を使用する

Last updated at Posted at 2024-10-11

この記事を書いた目的

以前の記事「OpenWrt で縮小版 Tailscale を使用する」では、 Tailscale の標準パッケージを利用して設定ファイルと依存パッケージの導入を行いましたが 😉、フラッシュメモリの空き容量が少なく、標準パッケージをインストールすることが不可能な場合もあると思います。😵

そういった OpenWrt 機器でも Tailscale を使えるようにこの記事を書きました。🤔

👉 手持ちの機器で実行し、Tailscale を使用できることを確認しました。🎉

インストール手順

0. 現状確認

まずは、以下のコードを実行してみましょう。

find /etc /usr/sbin -name "*tailscale*"

インストール前は何も表示されないはずですが、以下の 1. ~ 4. の手順を実行すると以下の表示になるはずです。😍

/etc/config/tailscale
/etc/init.d/tailscale
/etc/rc.d/S80tailscale
/etc/tailscale
/etc/tailscale/tailscaled.state
/usr/sbin/tailscaled
/usr/sbin/tailscale

1. ファイルの作成 ( /etc/config/tailscale , /etc/init.d/tailscale )

以下のコードを実行し、 GitHub から設定ファイルをダウンロードします。

wget -O /etc/config/tailscale \
  https://raw.githubusercontent.com/openwrt/packages/refs/heads/master/net/tailscale/files/tailscale.conf
wget -O /etc/init.d/tailscale \
  https://raw.githubusercontent.com/openwrt/packages/refs/heads/master/net/tailscale/files/tailscale.init

chmod +x /etc/init.d/tailscale

👉 この時点で find /etc /usr/sbin -name "*tailscale*" を実行すると、以下の 2 つのファイルが作成されているはずです。

/etc/config/tailscale
/etc/init.d/tailscale

2. パッケージのインストール ( ca-bundle , kmod-tun )

以下のコードを実行します。

opkg update
opkg install ca-bundle kmod-tun

OpenWrt 22.03 以降であれば以下のパッケージも追加します。

opkg install iptables-nft kmod-nft-nat \
  kmod-ipt-conntrack kmod-ipt-conntrack-extra kmod-ipt-conntrack-label

3. 縮小版 Tailscale のインストール

以前の記事の「縮小版 Tailscale への置き換え」の部分を参照して実行してください。

具体的には以下のコードを実行することになります。

opkg update
opkg install xz
service tailscale stop
sleep 5

wget -O /tmp/tailscaled \
  https://github.com/Admonstrator/glinet-tailscale-updater/releases/latest/download/tailscaled-linux-arm64

mv /tmp/tailscaled /usr/sbin/tailscaled
ln -svf /usr/sbin/tailscaled /usr/sbin/tailscale
chmod +x /usr/sbin/tailscaled

service tailscale start
tailscale set --auto-update=false

👉 この時点で find /etc /usr/sbin -name "*tailscale*" を実行すると、以下のファイルが作成されているはずです。

/etc/config/tailscale
/etc/init.d/tailscale
/etc/tailscale
/etc/tailscale/tailscaled.state
/usr/sbin/tailscaled
/usr/sbin/tailscale

4. Tailscale を service に登録

以下のコードを実行します。

/etc/init.d/tailscale enable
/etc/init.d/tailscale start

👉 この時点で find /etc -name "*tailscale*" を実行すると、以下のファイルが表示されているはずです。🎉🎉
( /etc/tailscale はディレクトリです。)

/etc/config/tailscale
/etc/init.d/tailscale
/etc/rc.d/S80tailscale
/etc/tailscale
/etc/tailscale/tailscaled.state
/usr/sbin/tailscaled
/usr/sbin/tailscale

本当に 10MB 以内に収まるの?

👉 df でインストール前とインストール後のフラッシュメモリの使用状況を確認すると、フラッシュメモリの使用量が 9.7MB ほど増えています。

root@OpenWrt:/etc/config# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.5M      4.5M         0 100% /rom
tmpfs                   119.8M     80.0K    119.7M   0% /tmp
/dev/ubi0_1              41.0M    236.0K     38.6M   1% /overlay
overlayfs:/overlay       41.0M    236.0K     38.6M   1% /
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:/etc/config# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.5M      4.5M         0 100% /rom
tmpfs                   119.8M     64.0K    119.7M   0% /tmp
/dev/ubi0_1              41.0M      9.7M     29.2M  25% /overlay
overlayfs:/overlay       41.0M      9.7M     29.2M  25% /
tmpfs                   512.0K         0    512.0K   0% /dev

その他の設定

以前の記事を参照して、InterfaceFirewall を追加します。

あとは、 tailscale up で Tailnet に登録できます。

👉 念のため、 tailscale set --auto-update=false を実行して自動更新を停止してください。

Tailscale の設定内容の確認方法などは 以前の記事 を参照してください。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?