openwrtにtailscaleを追加する

OpenWrt 24.10.0に更新し、tailscaleをインストールしました。基本はopenwrt公式の方法で問題ありません。

携帯から自宅のサーバーにつなぎ自宅の回線でインターネットをすることを目的にします。自宅openwrtのwanからPPPoE接続している環境です。

opkg update && opkg install iptables ip6tables tailscale

Network → Interfaces → Add new interface

Name: tailscale
Protocol: Unmanaged
Device: tailscale0

Firewall settingでlanとリンクさせる方法でも可能ですが、

細かく制御したい場合はtailscale用のfirewallを作成します

ファイヤーウォール zone追加
Name: tailscale
Input: ACCEPT (default)
Output: ACCEPT (default)
Forward: ACCEPT
Masquerading: on
MSS Clamping: on
Covered networks: tailscale
Allow forward to destination zones: ルーターの通信をモバイル端末で使えるようにする wan lan
Allow forward from source zones: モバイル端末の通信をルーターで使えるようにする 空白

Allow forward to destination zonesをlanのみにするとインターネットにつながりません。wanのみにすると

また自宅サーバーにつながりません。今回は携帯からルーターへアクセスするだけなのでAllow forward from source zonesは空白にしています

openwrtで次を実行します

tailscale up –accept-routes –advertise-exit-node –advertise-routes=192.168.x.0/24

accept-routesはサブネット ルートの自動検出、 192.168.x.0/24は自身の環境に合わせます。–netfilter-mode=offは22.03では必須ですが、24.01では必要ありません

表示されるURLにアクセスしtailscaleにログインすると管理画面にルーターが登録されます

管理画面のルーターから Edit route settings からsubnet routesとexit nodeを有効にします。

携帯のtailscaleアプリからログインしてアクセスするだけです。

tailscaleにつないでいない状態

DNS_ServerNameIPResponse_TimeAverage
Google Primary8.8.8.8762.704522.71983333
Google Primary8.8.8.824.7923
Google Primary8.8.8.816.2882
Google Primary8.8.8.813.4906
Google Primary8.8.8.818.7202
Google Primary8.8.8.818.8913
Google Primary8.8.8.851.84
Google Primary8.8.8.820.8488
Google Primary8.8.8.820.2203
Google Primary8.8.8.819.3868
Google Secondary8.8.4.422.660120.38951
Google Secondary8.8.4.423.038
Google Secondary8.8.4.418.1392
Google Secondary8.8.4.418.5593
Google Secondary8.8.4.416.0395
Google Secondary8.8.4.421.5157
Google Secondary8.8.4.420.544
Google Secondary8.8.4.419.9864
Google Secondary8.8.4.424.2447
Google Secondary8.8.4.419.1682
openwrt100.***.***.**9.13899.71597
openwrt100.***.***.**10.006
openwrt100.***.***.**9.2468
openwrt100.***.***.**9.5834
openwrt100.***.***.**12.2122
openwrt100.***.***.**9.3147
openwrt100.***.***.**9.7202
openwrt100.***.***.**9.5397
openwrt100.***.***.**9.3972
openwrt100.***.***.**9.0006
cloudflare1.1.1.112.057112.22374
cloudflare1.1.1.111.7968
cloudflare1.1.1.115.7901
cloudflare1.1.1.113.4069
cloudflare1.1.1.17.0597
cloudflare1.1.1.113.4478
cloudflare1.1.1.113.1163
cloudflare1.1.1.112.1971
cloudflare1.1.1.112.2038
cloudflare1.1.1.111.1618
ISP***.***.***.***11.58911.39383
ISP***.***.***.***13.1392
ISP***.***.***.***11.3484
ISP***.***.***.***12.4867
ISP***.***.***.***11.8981
ISP***.***.***.***10.9722
ISP***.***.***.***11.6912
ISP***.***.***.***11.6097
ISP***.***.***.***11.9375
ISP***.***.***.***7.2663

tailscaleにつないでいる状態

DNS_ServerNameIPResponse_TimeAverage
Google Primary8.8.8.8715.619813.52087778
Google Primary8.8.8.814.455
Google Primary8.8.8.813.1093
Google Primary8.8.8.814.0082
Google Primary8.8.8.812.6194
Google Primary8.8.8.813.7543
Google Primary8.8.8.812.3082
Google Primary8.8.8.813.4283
Google Primary8.8.8.814.0581
Google Primary8.8.8.813.9471
Google Secondary8.8.4.47.237911.29841
Google Secondary8.8.4.412.0379
Google Secondary8.8.4.412.3387
Google Secondary8.8.4.47.3528
Google Secondary8.8.4.47.7392
Google Secondary8.8.4.412.7627
Google Secondary8.8.4.413.9651
Google Secondary8.8.4.412.7055
Google Secondary8.8.4.414.0453
Google Secondary8.8.4.412.799
openwrt100.***.***.**13.774614.46324
openwrt100.***.***.**12.1168
openwrt100.***.***.**14.2586
openwrt100.***.***.**15.589
openwrt100.***.***.**13.3877
openwrt100.***.***.**21.2356
openwrt100.***.***.**13.7076
openwrt100.***.***.**12.7394
openwrt100.***.***.**14.3978
openwrt100.***.***.**13.4253
cloudflare1.1.1.114.472513.0209
cloudflare1.1.1.112.6419
cloudflare1.1.1.114.4942
cloudflare1.1.1.113.2404
cloudflare1.1.1.113.7963
cloudflare1.1.1.18.0389
cloudflare1.1.1.112.5456
cloudflare1.1.1.113.5722
cloudflare1.1.1.114.2542
cloudflare1.1.1.113.1528
ISP***.***.***.***13.6213.05625
ISP***.***.***.***6.9548
ISP***.***.***.***17.2248
ISP***.***.***.***13.3688
ISP***.***.***.***14.0914
ISP***.***.***.***13.3208
ISP***.***.***.***13.202
ISP***.***.***.***13.3534
ISP***.***.***.***13.909
ISP***.***.***.***11.5175

何回か計測すると逆転も起こるので参考程度に

tailscaleをいれたOpenWrtのDNSのスピードを計測してみました。tailscaleによってDNSのスピードが9.71597から14.46324にダウンしていることがわかります。

何回やっても8.8.8.8は一回目はめちゃくちゃ遅くなりますので、平均から除いてます。最速はtailscaleにつないでいない状態でのopenwrt,最遅はtailscaleにつないでいない状態での8.8.8.8です。8.8.8.8より1.1.1.1のほうが速く安定している印象です。tailscaleは8.8.8.8と遜色ない速度が出ていていることがわかります。

AdguardHomeをいれてどこでも広告ブロックもできています。

OpenWrt

Posted by taroumaru