ssh -w: 無効な tun デバイス "tun0"

ssh -w: 無効な tun デバイス

SSHトンネルを作成して標準のネットワークインターフェイスとして使用しようとしています。

私が試したことは次のとおりです。

myuser@client-pc:

ip tuntap add mode tun user myuser name tun0
ip address add dev tun0 192.168.20.1/24
ip link set tun0 up

root@server-pc:

ip tuntap add mode tun user root name tun0
ip address add dev tun0 192.168.20.2/24
ip link set tun0 up

以下を使用しようとしたときにssh -w tun0 root@server-pc問題が発生しました。

Bad tun device 'tun0'

実行しても-vvv同じ結果が出ます。

何が間違っている可能性がありますか?

ベストアンサー1

tunプレフィックスなしで数字を指定するだけです。

この情報はSSHのマニュアルページにありますman ssh

-w local_tun[:remote_tun]
     Requests tunnel device forwarding with the specified tun(4) devices between the
     client (local_tun) and the server (remote_tun).

     The devices may be specified by numerical ID or the keyword “any”, which uses the
     next available tunnel device.  If remote_tun is not specified, it defaults to “any”.
     See also the Tunnel and TunnelDevice directives in ssh_config(5).

デジタルID「または」どの" は唯一の有効な値です。

したがって、コマンドは次のようにする必要があります。

ssh -w 0 root@server-pc

おすすめ記事