1197 文字
6 分
Proxmox VEのLXC上でTailscaleを実行する
2026-05-04

経緯#

自宅のサーバ環境に外出先から接続したいことがあります。 無償で利用可能なTailscaleを使っています。 Ubuntu 26.04 LTSがリリースされたので、Proxmox VE上のLXCコンテナとして実行環境を構築する記録を残します。

前提条件#

  • Tailscaleのアカウントは作成済み
  • Proxmox Kernel Version: Linux 7.0.0-3-pve (2026-04-21T22:56Z)
  • 各種コマンドは特権で実行

LXCテンプレートのダウンロード#

Proxmox VEが提供する基本テンプレートを利用します。利用可能なテンプレートリストは1日1回バックグラウンドで更新されていますが、手動で更新しておきます。

Terminal window
:~# pveam update
update successful

ベースOSの入ったテンプレートの一覧は下記のコマンドで確認可能です。

Terminal window
:~# pveam available --section system
system almalinux-10-default_20250930_amd64.tar.xz
system almalinux-9-default_20240911_amd64.tar.xz
system alpine-3.22-default_20250617_amd64.tar.xz
system alpine-3.23-default_20260116_amd64.tar.xz
system archlinux-base_20260420-1_amd64.tar.zst
system centos-9-stream-default_20240828_amd64.tar.xz
system debian-12-standard_12.12-1_amd64.tar.zst
system debian-13-standard_13.1-2_amd64.tar.zst
system devuan-5.0-standard_5.0_amd64.tar.gz
system fedora-42-default_20250428_amd64.tar.xz
system fedora-43-default_20260115_amd64.tar.xz
system gentoo-current-openrc_20250508_amd64.tar.xz
system openeuler-25.03-default_20250507_amd64.tar.xz
system opensuse-15.6-default_20240910_amd64.tar.xz
system opensuse-16.0-default_20260116_amd64.tar.xz
system rockylinux-10-default_20251001_amd64.tar.xz
system rockylinux-9-default_20240912_amd64.tar.xz
system ubuntu-22.04-standard_22.04-1_amd64.tar.zst
system ubuntu-24.04-standard_24.04-2_amd64.tar.zst
system ubuntu-25.04-standard_25.04-1.1_amd64.tar.zst
system ubuntu-26.04-standard_26.04-1_amd64.tar.zst

今回はUbuntu 26.04を利用します。tailscaleだけを動かすのであれば、より軽量なイメージを選択するのもよいですが、稼働後の運用を考えると普段使い慣れたOSが良いかと思います。

上記テンプレートの一覧からイメージを選択しダウンロードします。以下のコマンドでダウンロードすることで、テンプレートフォルダーにイメージを配置してくれます。

Terminal window
:~# pveam download local ubuntu-26.04-standard_26.04-1_amd64.tar.zst
downloading http://download.proxmox.com/images/system/ubuntu-26.04-standard_26.04-1_amd64.tar.zst to /var/lib/vz/template/cache/ubuntu-26.04-standard_26.04-1_amd64.tar.zst
--2026-05-04 11:35:51-- http://download.proxmox.com/images/system/ubuntu-26.04-standard_26.04-1_amd64.tar.zst
Resolving download.proxmox.com (download.proxmox.com)... 51.91.38.34, 2001:41d0:b00:5900::34
Connecting to download.proxmox.com (download.proxmox.com)|51.91.38.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 158434587 (151M) [application/octet-stream]
Saving to: '/var/lib/vz/template/cache/ubuntu-26.04-standard_26.04-1_amd64.tar.zst.tmp_dwnl.1825'
0K ........ ........ ........ ........ 21% 922K 2m12s
32768K ........ ........ ........ ........ 42% 357K 2m53s
65536K ........ ........ ........ ........ 63% 484K 1m52s
98304K ........ ........ ........ ........ 84% 367K 51s
131072K ........ ........ ....... 100% 349K=5m52s
2026-05-04 11:41:44 (439 KB/s) - '/var/lib/vz/template/cache/ubuntu-26.04-standard_26.04-1_amd64.tar.zst.tmp_dwnl.1825' saved [158434587/158434587]
calculating checksum...OK, checksum verified
download of 'http://download.proxmox.com/images/system/ubuntu-26.04-standard_26.04-1_amd64.tar.zst' to '/var/lib/vz/template/cache/ubuntu-26.04-standard_26.04-1_amd64.tar.zst' finished

これで準備はととのいました。なお、イメージのダウンロードはWEB GUIからも実行可能です。

LXCコンテナの作成#

CTを作成からコンテナを作成します。 テンプレートは先程ダウンロードしたテンプレートを指定します。

リソースは初期設定のまま与えましたが、流石にディスクリソース8GBは足りなかったかもしれません。 ディスクを使うときはパッケージのUpdate時だと思うので、不足を感じたときは増やしたいと思います。

CT作成

起動前に、Proxmox側でコンテナの設定ファイルを変更します。これはコンテナがTUNデバイスを使用するために必要な設定です。

confのファイル名はコンテナ作成時にProxmoxで指定したCT IDに一致します。

Terminal window
:~# vim /etc/pve/lxc/102.conf

末尾に以下の設定を追記します。

lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
Terminal window
:~# cat /etc/pve/lxc/102.conf
arch: amd64
cores: 1
features: nesting=1
hostname: tailscale26.04
memory: 512
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:24:11:F6:7C:69,ip=dhcp,type=veth
ostype: ubuntu
rootfs: local-lvm:vm-102-disk-0,size=8G
swap: 512
unprivileged: 1
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

設定が終わったらコンテナを起動し、問題なく起動するか確認します。

コンテナ内での設定#

まずはSSHできないと不便なので一般ユーザを作成します。

Terminal window
:~# adduser username

SSH接続後rootに昇格しUpdateします。

Terminal window
:~$ su -
Password:
:~# apt update
:~# apt upgrade

サブネットルーターとして動作させるため、IP Forwardingを有効化します。

Terminal window
:~# apt install vim
:~# vim /etc/sysctl.d/99-tailscale.conf

以下の内容を記述しますが、IPv4のみ利用する場合はIPv6行の記述は不要です。

net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
Terminal window
:~# cat /etc/sysctl.d/99-tailscale.conf
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1

設定が完了したら適用します。

Terminal window
:~# sysctl -p /etc/sysctl.d/99-tailscale.conf
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1

Tailscaleのインストール#

Tailscaleをインストールします。

Terminal window
:~# apt install curl
:~# curl -fsSL https://tailscale.com/install.sh | sh
Installing Tailscale for ubuntu resolute, using method apt
+ mkdir -p --mode=0755 /usr/share/keyrings
+ curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/resolute.noarmor.gpg
+ tee /usr/share/keyrings/tailscale-archive-keyring.gpg
+ chmod 0644 /usr/share/keyrings/tailscale-archive-keyring.gpg
+ curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/resolute.tailscale-keyring.list
+ tee /etc/apt/sources.list.d/tailscale.list
# Tailscale packages for ubuntu resolute
deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/ubuntu resolute main
+ chmod 0644 /etc/apt/sources.list.d/tailscale.list
+ apt-get update
Get:1 https://pkgs.tailscale.com/stable/ubuntu resolute InRelease
Get:2 https://pkgs.tailscale.com/stable/ubuntu resolute/main all Packages [354 B]
Get:3 https://pkgs.tailscale.com/stable/ubuntu resolute/main amd64 Packages [14.7 kB]
Hit:4 http://archive.ubuntu.com/ubuntu resolute InRelease
Hit:5 http://archive.ubuntu.com/ubuntu resolute-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu resolute-security InRelease
Fetched 21.7 kB in 2s (10.3 kB/s)
Reading package lists... Done
+ [ -n ]
+ apt-get install -y tailscale tailscale-archive-keyring
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Solving dependencies... Done
The following NEW packages will be installed:
tailscale tailscale-archive-keyring
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.6 MB of archives.
After this operation, 71.9 MB of additional disk space will be used.
Get:1 https://pkgs.tailscale.com/stable/ubuntu resolute/main amd64 tailscale amd64 1.96.4 [36.6 MB]
Get:2 https://pkgs.tailscale.com/stable/ubuntu resolute/main all tailscale-archive-keyring all 1.35.181 [3082 B]
Fetched 36.6 MB in 1s (28.4 MB/s)
Selecting previously unselected package tailscale.
(Reading database ... 24457 files and directories currently installed.)
Preparing to unpack .../tailscale_1.96.4_amd64.deb ...
Unpacking tailscale (1.96.4) ...
Selecting previously unselected package tailscale-archive-keyring.
Preparing to unpack .../tailscale-archive-keyring_1.35.181_all.deb ...
Unpacking tailscale-archive-keyring (1.35.181) ...
Setting up tailscale-archive-keyring (1.35.181) ...
Setting up tailscale (1.96.4) ...
Created symlink '/etc/systemd/system/multi-user.target.wants/tailscaled.service' '/usr/lib/systemd/system/tailscaled.service'.
+ [ false = true ]
+ set +x
Installation complete! Log in to start using Tailscale by running:
tailscale up

後は起動、認証を通します。その後経路情報を広報します。

Terminal window
:~# tailscale up
To authenticate, visit:
https://login.tailscale.com/a/xxxxxxxxxxxx
Success.
:~# tailscale set --advertise-routes=10.3.0.0/24,10.3.4.0/24

Tailscaleの WEB Console で該当の経路広報にチェックを入れ有効化したら完了です。

Edit RouteAdd

参考情報#