0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

アカウント登録不要のCloudflare Quick Tunnelsで自宅サーバーにトンネリング

Posted at

Cloudflare Tunnelのサブ機能みたい感じのQuick Tunnelという仕組みがあるということで、これはアカウント登録せずに利用できます。ngrokなどのような感じです。

アカウント接続するともうちょい手順必要ですが、トンネリングするくらいならアカウント登録不要で利用できます。

Jetson Nanoで利用してみる

今回はJetson NanoにインストールしているOllamaに外部からアクセスしたく、ngrokでも良いのですが最近触ってなかったCloudflare Tunnelの方を選択。

インストールするJetson NanoのOSバージョン確認

古いけどUbuntu 18.04.4ということがわかりました。

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

Cloudflare Tunnelのコマンドcloudflaredのインストール

Cloudflare Tunnelはcloudflaredというツールをエッジデバイス側にインストールします。

  • 鍵を保存
$ sudo mkdir -p --mode=0755 /usr/share/keyrings
$ curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
  • aptのパッケージリストに追加
$ echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared focal main' \
  | sudo tee /etc/apt/sources.list.d/cloudflared.list
  • インストール
$ sudo apt-get update && sudo apt-get install cloudflared
  • 無事にインストール完了
$ cloudflared -v
cloudflared version 2025.8.1 (built 2025-08-21-1535 UTC)
  • 任意: アップデートする場合
$ sudo apt-get update && sudo apt-get install --only-upgrade cloudflared

トンネリング

ollamaは既に起動済みだとして、11434ポートで待ち受けてくれてるので以下のコマンドでトンネリングできます。

$ cloudflared tunnel --url http://localhost:11434

2025-09-17T06:12:25Z INF Thank you for trying Cloudflare Tunnel. Doing so, without a Cloudflare account, is a quick way to experiment and try it out. However, be aware that these account-less Tunnels have no uptime guarantee, are subject to the Cloudflare Online Services Terms of Use (https://www.cloudflare.com/website-terms/), and Cloudflare reserves the right to investigate your use of Tunnels for violations of such terms. If you intend to use Tunnels in production you should use a pre-created named tunnel by following: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
2025-09-17T06:12:25Z INF Requesting new quick Tunnel on trycloudflare.com...
2025-09-17T06:12:28Z INF +--------------------------------------------------------------------------------------------+
2025-09-17T06:12:28Z INF |  Your quick Tunnel has been created! Visit it at (it may take some time to be reachable):  |
2025-09-17T06:12:28Z INF |  https://xxxxxxxxxxxxxxx.trycloudflare.com                                         |
2025-09-17T06:12:28Z INF +--------------------------------------------------------------------------------------------+
2025-09-17T06:12:28Z INF Cannot determine default configuration path. No file [config.yml config.yaml] in [~/.cloudflared ~/.cloudflare-warp ~/cloudflare-warp /etc/cloudflared /usr/local/etc/cloudflared]

...

https://xxxxxxxxxxxxxxx.trycloudflare.comのようなURLが発行されるのでこれにアクセスします。

ollamaに外部ブラウザからアクセス

https://xxxxxxxxxxxxxxx.trycloudflare.com/api/tags

{
	"models": [
		{
			"name": "embeddinggemma:300m",
			"model": "embeddinggemma:300m",
			"modified_at": "2025-09-17T15:30:30.280036567+09:00",
			"size": 621875917,
			"digest": "85462619ee721b466c5927d109d4cb765861907d5417b9109caebc4e614679f1",
			"details": {
				"parent_model": "",
				"format": "gguf",
				"family": "gemma3",
				"families": [
					"gemma3"
				],
				"parameter_size": "307.58M",
				"quantization_level": "BF16"
			}
		},
		{
			"name": "gemma3:1b-it-qat",
			"model": "gemma3:1b-it-qat",
			"modified_at": "2025-08-19T22:40:59.762014004+09:00",
			"size": 1003539988,
			"digest": "b491bd3989c65bf74267bfb9e7d5fd0bf7b6548bc12f91a98df3c56865ce2f80",
			"details": {
				"parent_model": "",
				"format": "gguf",
				"family": "gemma3",
				"families": [
					"gemma3"
				],
				"parameter_size": "999.89M",
				"quantization_level": "Q4_0"
			}
		}
	]
}

無事にアクセスできました。

安定化

SSH切ったら切れちゃうのでさらに〜って話はまた続きの記事へ

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?