2つのサーバー間にSCPがあるときにIPV4を使用する方法は?

2つのサーバー間にSCPがあるときにIPV4を使用する方法は?

scpローカルコンピュータでコマンドを実行して、ホスト1からホスト2にファイルをコピーしたいと思います。ホスト1とホスト2の間にIPV6接続がないため、ホスト1からホスト2への接続はIPV4を使用する必要があります(私が制御できない理由で)。

私のローカルコンピュータでは、次のものを使用します。

scp -4 -v -r -o "ForwardAgent=yes" user@host1:myFile user@host2:

出力には次のものがあります。

debug1: Connecting to host1 [a.b.c.d] port 22.

これは正しいです。ただし、IPV6を使用してホスト1からホスト2に接続してみてください。

debug1: Connecting to host2 [a:b:c:d:e:f:g:h] port 22

ただし、IPv6接続がないため失敗します。

ホスト1からホスト2への接続でscpがIPV4を使用するように強制する方法は?

PS:私はscpmacOS 10.13.3を使用しています。

====編集

以下は完全なログです。 scpがhost1からコマンドを送信するときにオプションを追加しないという事実で問題が発生することがわかります-4。次の行を参照してください。

debug1: Sending command: scp -v -r /myFile user@host2:.

OpenSSH_7.6p1, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /Users/user/.ssh/config
debug1: /Users/user/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /usr/local/etc/ssh/ssh_config
debug1: Connecting to host1 [a.b.c.d] port 22.
debug1: Connection established.
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u3
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to host1:22 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:/sfbwfbhwh/wsfgwhwthwth
debug1: Host 'host1' is known and matches the ECDSA host key.
debug1: Found key in /Users/user/.ssh/known_hosts:66
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to host1.com ([a.b.c.d]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: Requesting authentication agent forwarding.
debug1: Sending command: scp -v -r /myFile user@host2:.
Executing: program /usr/bin/ssh host host2, user user, command scp -v -r -t .
OpenSSH_7.4p1 Debian-10+deb9u3, OpenSSL 1.0.2l  25 May 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to host2 [a:b:c:d:e:f:g:h] port 22.

ベストアンサー1

お試しください::scp -4 -v -r -o "ForwardAgent=yes" user@host1:myFile [email protected]

ここで、defg はホスト 2 の IPv4 アドレスです。 DNSが正しいアドレスを返していることを確認してください。

おすすめ記事