前回の続きです。
接続状況を把握する
tailscale status
コマンドで接続状況を把握。
Windowsでもコマンドラインから使えます。
>tailscale status 100.64.xxx.xxx pc03 username@ windows active; offers exit node; relay "tok", tx 192355640 rx 5935112
relay "tok"
という表示。
Tailscale will either connect your nodes directly or via a DERP relay.
Tailscale runs DERP relay servers distributed around the world to link your Tailscale nodes peer-to-peer as a side channel during NAT traversal, and as a fallback in case NAT traversal fails and a direct connection cannot be established.
なるほど、中継サーバーを経由する接続であれば、遅いのも納得。 では中継サーバーを経由しない方法は?
My devices are using a relay. What can I do to help them connect peer-to-peer?
If two of your devices are on difficult networks, allowing connections to UDP port 41641 on one of them may help Tailscale make a peer-to-peer connection, rather than falling back to a relay.
なるほど、UDP:41641からの発信を通すように構成すればよいと。 Windowsパソコンの場合はWindowsファイアウォールに自動的に設定が追加されているようですが、ダメなら手動で追加しましょう。 パソコン、ルーターともに、ファイアウォールなどでUDP:41641からの発信を許可し、テスト。
まずはrelayモードで接続されているときの結果。
>iperf3 -c 同一LAN内にあるpc03のTailscale IPv4 アドレス Connecting to host 100.64.xxx.xxx, port 5201 [ 4] local 自分のPCのTailscale IPv4 アドレス port 57386 connected to pc03のTailscale IPv4 アドレス port 5201 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.01 sec 1.12 MBytes 9.38 Mbits/sec [ 4] 1.01-2.01 sec 1.12 MBytes 9.40 Mbits/sec [ 4] 2.01-3.00 sec 2.62 MBytes 22.2 Mbits/sec [ 4] 3.00-4.00 sec 3.12 MBytes 26.3 Mbits/sec [ 4] 4.00-5.01 sec 2.62 MBytes 21.8 Mbits/sec [ 4] 5.01-6.01 sec 2.88 MBytes 24.2 Mbits/sec [ 4] 6.01-7.01 sec 3.62 MBytes 30.4 Mbits/sec [ 4] 7.01-8.00 sec 4.50 MBytes 37.9 Mbits/sec [ 4] 8.00-9.01 sec 6.00 MBytes 50.2 Mbits/sec [ 4] 9.01-10.01 sec 4.62 MBytes 38.7 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 4] 0.00-10.01 sec 32.2 MBytes 27.0 Mbits/sec sender [ 4] 0.00-10.01 sec 32.1 MBytes 26.9 Mbits/sec receiver
次に、directモードで接続されているときの結果。
>tailscale status 100.64.xxx.xxx pc03 username@ windows active; offers exit node; direct IPv4かIPv6アドレス:41641, tx 192355640 rx 5935112
おお、41641って表示された。効いてそう。
>iperf3 -c 同一LAN内にあるpc03のTailscale IPv4 アドレス Connecting to host 100.64.xxx.xxx, port 5201 [ 4] local 自分のPCのTailscale IPv4 アドレス port 61603 connected to pc03のTailscale IPv4 アドレス port 5201 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.00 sec 11.0 MBytes 91.8 Mbits/sec [ 4] 1.00-2.01 sec 12.0 MBytes 101 Mbits/sec [ 4] 2.01-3.00 sec 15.1 MBytes 128 Mbits/sec [ 4] 3.00-4.01 sec 16.4 MBytes 137 Mbits/sec [ 4] 4.01-5.01 sec 16.1 MBytes 135 Mbits/sec [ 4] 5.01-6.00 sec 16.2 MBytes 137 Mbits/sec [ 4] 6.00-7.01 sec 16.1 MBytes 135 Mbits/sec [ 4] 7.01-8.00 sec 15.9 MBytes 133 Mbits/sec [ 4] 8.00-9.00 sec 16.4 MBytes 138 Mbits/sec [ 4] 9.00-10.00 sec 16.2 MBytes 136 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 4] 0.00-10.00 sec 152 MBytes 127 Mbits/sec sender [ 4] 0.00-10.00 sec 151 MBytes 127 Mbits/sec receiver
やったー!別次元! 暗号化なしの速度には遠く及ばないけど、同一LAN内で100Mbps超えれば上等上等。