Alpine Linuxは要求するハードウェア的に非常に小さく、ネットワーク接続したいだけのような用途に最適である。
手順
curlを入れる
Alpine Linuxでは、apt installではなくapk addである
apk add curl
( 1/10) Installing brotli-libs (1.2.0-r0)
( 2/10) Installing c-ares (1.34.6-r0)
( 3/10) Installing libunistring (1.4.1-r0)
( 4/10) Installing libidn2 (2.3.8-r0)
( 5/10) Installing nghttp2-libs (1.68.0-r0)
( 6/10) Installing nghttp3 (1.13.1-r0)
( 7/10) Installing libpsl (0.21.5-r3)
( 8/10) Installing zstd-libs (1.5.7-r2)
( 9/10) Installing libcurl (8.17.0-r1)
(10/10) Installing curl (8.17.0-r1)
Executing busybox-1.37.0-r30.trigger
OK: 43.7 MiB in 51 packages
tailscaleをダウンロード・インストール
curl -fsSL https://tailscale.com/install.sh | sh
Installing Tailscale for alpine 3.23.2, using method apk
+ grep -Eq '^http.*/community$' /etc/apk/repositories
+ '[' -n ]
+ apk add tailscale
(1/3) Installing openresolv (3.17.4-r0)
(2/3) Installing tailscale (1.90.9-r4)
Executing tailscale-1.90.9-r4.pre-install
Executing tailscale-1.90.9-r4.post-install
*
* tailscaled runs as root by default. For security reasons, we highly
* recommend that you run it under an unprivileged user. See command_user
* in /etc/conf.d/tailscale for more information.
*
(3/3) Installing tailscale-openrc (1.90.9-r4)
Executing busybox-1.37.0-r30.trigger
OK: 78.0 MiB in 54 packages
+ rc-update add tailscale
* service tailscale added to runlevel default
+ rc-service tailscale start
* Caching service dependencies ... [ ok ]
* /var/log/tailscaled.log: creating file
* /var/log/tailscaled.log: correcting owner
* /run/tailscale: creating directory
* /run/tailscale: correcting owner
* Starting tailscale ... [ ok ]
+ set +x
Installation complete! Log in to start using Tailscale by running:
tailscale up
tailscaleを起動してみる
tailscale up --advertise-exit-node --advertise-routes=192.168.0.0/24 --ssh
failed to connect to local tailscaled; it doesn't appear to be running
起動しない
Alpine Linuxでは、一般的なLinuxで使われるsystemdではなく、OpenRCが使われている。
コマンドsystemctlに相当するものは、rc-serviceである。
rc-service tailscale status
* status: stopped
rc-service tailscale start
* Starting tailscale ... [ ok ]
rc-service tailscale status
* status: stopped
立ち上げてもすぐにクラッシュしていると考えられる。
VPN通信をするには、OS上に仮想的なネットワーク機器(/dev/net/tun)を作成する必要があるが、LXCのようなコンテナ環境ではその作成が許可されていないことがある。
PROXMOX(ホスト)のノードのシェル
nano /etc/pve/lxc/<CTのID>.conf
以下を書き込む
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
コンテナ(Alpine Linux)を再起動
rc-service tailscale start
* WARNING: tailscale has already been started
rc-service tailscale status
* status: started
動いてそうなので、tailscale upで自分のtailnetに接続する
tailscale up --advertise-exit-node --advertise-routes=192.168.0.0/24 --ssh
Warning: IP forwarding is disabled, subnet routing/exit nodes will not work.
See https://tailscale.com/s/ip-forwarding
Warning: UDP GRO forwarding is suboptimally configured on eth0, UDP forwarding throughput capability will increase with a configuration change.
See https://tailscale.com/s/ethtool-config-udp-gro
To authenticate, visit:
https://login.tailscale.com/a/************
Success.
Some peers are advertising routes but --accept-routes is false
URLを何かしら機器のブラウザでアクセスし、自分のtailscaleアカウントでログイン
Successと出て、WebコンソールにAlpine Linuxが追加されていればok

コメント