LoginSignup
13
6

More than 3 years have passed since last update.

SSHでbind: Cannot assign requested addressとなった時の対応方法

Last updated at Posted at 2019-06-19
  • 環境(Docker)
    • CentOS Linux release 7.6.1810 (Core)
    • OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017

事象 : SSHでポートフォワードしようとしたらなんか言われた

別段、接続できないわけでも何でもないが気になった。

$ ssh -N -L 1521:10.0.1.2:1521 -i ~/.ssh/key.pem ec2-user@1.23.45.67
bind: Cannot assign requested address

原因 : IPv6のポートを使用しようとしているため

ssh 接続時に IPv6 のポートを転送しないようにする
SSH port forwarding: bind: Cannot assign requested address | Electricmonk.nl weblog

対応 : IPv4であることを-4オプションで明示する

$ ssh -N -L 1521:10.0.1.2:1521 -i ~/.ssh/key.pem -4 ec2-user@1.23.45.67
13
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
6