同じネットワーク上のWSLのSSHサーバーに接続しようとしましたが、SSH接続がタイムアウトしました。

同じネットワーク上のWSLのSSHサーバーに接続しようとしましたが、SSH接続がタイムアウトしました。

そこで、WSLを実行しているWindows 11コンピュータに接続するようにUbuntu 22ノートブックを設定しようとしました。昨日はうまくいき、私が望むすべてを想像できました。ところで、今は接続できません。ssh -vvv username@ip_address -p 2222お客様が私に提供した内容は次のとおりです。

OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: /etc/ssh/ssh_config line 19: Including file /etc/ssh/ssh_config.d/dummy.conf depth 0
debug1: Reading configuration data /etc/ssh/ssh_config.d/dummy.conf
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname [[ip_address]] is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/marlen/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/marlen/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to [[ip_address]] [[[ip_address]]] port 2222.
debug3: set_sock_tos: set socket 3 IP_TOS 0x10
debug1: connect to address [[ip_address]] port 2222: Connection timed out
ssh: connect to host [[ip_address]] port 2222: Connection timed out

Windowsシステムでは、次のようにリダイレクトを構成しました。

netsh interface portproxy add v4tov4 listenaddress=[[ip_address]] listenport=2222 connectaddress=[[internal_ip_address]] connectport=22

だから22番ポートに入ろうとします。また、次のようにファイアウォールのルールを追加しました。

netsh advfirewall firewall add rule name=WSL2 dir=in action=allow protocol=TCP localport=2222

昨日のプロセスを再現しようとしたので、いくつかのWSL2ルールがあります。これが理由なのか気になります。

WSL2に関する追加情報は次のとおりです。

sudo service ssh status
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; ven>
     Active: active (running) since Thu 2024-03-28 11:57:10 -05; 2>

======

sudo netstat -paunt | egrep sshd\|:22
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      51694/sshd: /usr/sb
tcp6       0      0 :::22                   :::*                    LISTEN      51694/sshd: /usr/sb

IPに関連するすべてが問題ないようです。

Windowsの場合:

Wireless LAN Wi-Fi 2:
IPv4. . . . . . . . . . . . . . : 192.168.0.149

WSL情報

$ ip addr | grep eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 172.21.135.113/20 brd 172.21.143.255 scope global eth0

それが私が持っている情報のすべてです。私に助けてくれてありがとう。

ベストアンサー1

おすすめ記事