本記事の対象となるエラー
検証環境のNW機器にSSHログインを試行したところ、クライアント側で以下のエラーが出力された。
# ssh xxxx@x.x.x.x
Unable to negotiate with x.x.x.x port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
SSHサーバとなるNW機器が古い鍵交換アルゴリズムにしか対応しておらず、接続に失敗していることがわかる。
解決
-o オプションで鍵交換アルゴリズムを追加してやることで解決した。
# ssh -o KexAlgorithms=+diffie-hellman-group-exchange-sha1 xxxx@x.x.x.x
configファイルを作成している場合は以下のように記載する。
~/.ssh/config
HOST hoge
HOSTNAME x.x.x.x
USER hoge
KexAlgorithms diffie-hellman-group-exchange-sha1
注意点
今回は個人的な検証環境なので問題なかったが、セキュリティ的によろしくはない。