外部ローカルネットワークからRaspiに接続しようとすると、SSHタイムアウトが発生します。

外部ローカルネットワークからRaspiに接続しようとすると、SSHタイムアウトが発生します。

SSHを使用してローカルネットワーク外のRaspberry Piに接続しようとしています。

ローカルネットワーク内で接続できます。

私のパイには固定IPアドレスとポート転送が正しく設定されています。

私のSSHポートは22から別の無料ポートに変更されました。

私が使用するコマンドは次のとおりです。

ssh -vvvp 49100 pi@**.***.**.*

以下はsshコマンドの詳細な出力です。

OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to **.***.**.* port 49100.
debug1: Connection established.
debug1: identity file /Users/armandfardeau/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /Users/armandfardeau/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/armandfardeau/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/armandfardeau/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/armandfardeau/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/armandfardeau/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/armandfardeau/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/armandfardeau/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Raspbian-10+deb9u3
debug1: match: OpenSSH_7.4p1 Raspbian-10+deb9u3 pat OpenSSH* compat 0x04000000
debug3: fd 5 is O_NONBLOCK
debug1: Authenticating to **.***.**.*:49100 as 'pi'
debug3: put_host_port: [**.***.**.*]:49100
debug3: hostkeys_foreach: reading file "/Users/armandfardeau/.ssh/known_hosts"
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent

何が問題なのか知っていますか?

ベストアンサー1

この問題は、よく知られているMTU /断片化の問題と似ています。 ssh-server および ssh-client ネットワークインターフェイスの MTU を同じ小さい値に置き換えます。ネットワークインタフェースがSSHを受信して​​いるとしますeth0(Detect itを使用ifconfig)。インターフェイスの現在のMTU値を確認します。

cat /sys/class/net/eth0/mtu

インターフェイスの現在のMTU(おそらく1500)をより小さい数字に一時的に置き換えます。たとえば、次のようになります。

sudo ifconfig eth0 mtu 1496

または

echo 1496 | sudo tee /sys/class/net/eth0/mtu

1496番で問題が解決しない場合は、MTU 1250などをお試しください。特定の MTU 値の後に問題が消えた場合は、インターフェイスの変更を維持します。

次の内容をよくお読みください。http://www.snailbook.com/faq/mtu-mismatch.auto.html

おすすめ記事