3つの同じサーバー - すべてscpを介して61KBファイルを許可しますが、そのうちの2つは62KBを超えるすべてのファイルを拒否します。

3つの同じサーバー - すべてscpを介して61KBファイルを許可しますが、そのうちの2つは62KBを超えるすべてのファイルを拒否します。

同じUbuntu 18.04 LTSを実行している3つのVMサーバーがあります。増分IP範囲を持つ識別子:

99.99.99.140
99.99.99.141
99.99.99.142

そのうちの1つ(.141)が次にデータを送信しています。どのWorld Wide Webでホストされています。ファイルをコピーするために非常に簡単なテストを実行しています。

#!/bin/bash
# scp-speed-test.sh
# Author: Alec Jacobson alecjacobsonATgmailDOTcom
#
# Test ssh connection speed by uploading and then downloading a 10000K test
# file (optionally user-specified size)
#
# Usage:
#   ./scp-speed-test.sh user@hostname [test file size in KBs]
#

ssh_server=$1
test_file=".scp-test-file"

test_size=$2

# generate a x kilobytes random file
echo "Generating $test_size KB test file..."
`dd if=/dev/urandom of=$test_file bs=$(echo "$test_size*1024" | bc) \
  count=1 &> /dev/null`

# upload test
echo "Testing upload to $ssh_server..."
up_speed=`scp -v $test_file $ssh_server:$test_file 2>&1 | \
  grep "Bytes per second" | \
  sed "s/^[^0-9]*\([0-9.]*\)[^0-9]*\([0-9.]*\).*$/\1/g"`
up_speed=`echo "($up_speed*0.0009765625*100.0+0.5)/1*0.01" | bc`

# download test
echo "Testing download to $ssh_server..."
down_speed=`scp -v $ssh_server:$test_file $test_file 2>&1 | \
  grep "Bytes per second" | \
  sed "s/^[^0-9]*\([0-9.]*\)[^0-9]*\([0-9.]*\).*$/\2/g"`
down_speed=`echo "($down_speed*0.0009765625*100.0+0.5)/1*0.01" | bc`

# clean up
echo "Removing test file on $ssh_server..."
`ssh $ssh_server "rm $test_file"`
echo "Removing test file locally..."
`rm $test_file`

# print result
echo ""
echo "Upload speed:   $up_speed KB/s"
echo "Download speed: $down_speed KB/s"

3 つのサーバーすべてにアップロードする場合61キロバイトファイル、すべて利用可能:

ZENBOOK:~$ ./scp-speed-test.sh [email protected] 61
Generating 61 KB test file...
Testing upload to [email protected]...
Testing download to [email protected]...
Removing test file on [email protected]...
Removing test file locally...

Upload speed:   78.98 KB/s
Download speed: 73.88 KB/s


ZENBOOK:~$ ./scp-speed-test.sh [email protected] 61
Generating 61 KB test file...
Testing upload to [email protected]...
Testing download to [email protected]...
Removing test file on [email protected]...
Removing test file locally...

Upload speed:   77.13 KB/s
Download speed: 74.59 KB/s


ZENBOOK:~$ ./scp-speed-test.sh [email protected] 61
Generating 61 KB test file...
Testing upload to [email protected]...
Testing download to [email protected]...
Removing test file on [email protected]...
Removing test file locally...

Upload speed:   73.11 KB/s
Download speed: 73.85 KB/s

しかし、上記の内容を繰り返すと62キロバイト、突然そのうちの2つが失敗しました(.140と.142)。


ZENBOOK:~$ ./scp-speed-test.sh [email protected] 62
Generating 62 KB test file...
Testing upload to [email protected]...
(standard_in) 1: syntax error
(standard_in) 1: syntax error
Testing download to [email protected]...
Removing test file on [email protected]...
Removing test file locally...

Upload speed:    KB/s                <-----------------------------------
Download speed: 65.02 KB/s


ZENBOOK:~$ ./scp-speed-test.sh [email protected] 62
Generating 62 KB test file...
Testing upload to [email protected]...
Testing download to [email protected]...
Removing test file on [email protected]...
Removing test file locally...

Upload speed:   81.97 KB/s
Download speed: 75.92 KB/s


ZENBOOK:~$ ./scp-speed-test.sh [email protected] 62
Generating 62 KB test file...
Testing upload to [email protected]...
(standard_in) 1: syntax error
(standard_in) 1: syntax error
Testing download to [email protected]...
Removing test file on [email protected]...
Removing test file locally...

Upload speed:    KB/s                <-----------------------------------
Download speed: 57.48 KB/s

上記のように、.140または.142はどちらもファイルを正しく受信しません。しかし、.141大量(1MB以上)のデータをホストに転送する際に問題を引き起こす問題です。

.140で実行すると、ファイルサイズは62KBです。scp -vvv .scp-test-file [email protected]:.scp-test-file

debug1: Sending command: scp -v -t .scp-test-file
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Sending file modes: C0644 63488 .scp-test-file
debug2: channel 0: rcvd ext data 33
Sink: C0644 63488 .scp-test-file
.scp-test-file                                                                                                                              0%    0     0.0KB/s   --:-- ETA
debug2: channel 0: written 33 to efd 7

約20秒後のタイムアウト:

Sink: C0644 63488 .scp-test-file
.scp-test-file                                                                                                                              0%    0     0.0KB/s   --:-- ETA
debug2: channel 0: written 33 to efd 7
debug3: send packet: type 1
Connection reset by 99.99.99.140 port 22
lost connection

私は読んだhttps://superuser.com/questions/395356/scp-doesnt-work-but-ssh-doesしかし、scpは動作しませんが、62KBを超えるエントリでは動作しません。

PMTUブラックホール方向の他の点、https://serverfault.com/questions/120505/problems-with-scp-stalling-during-file-copy-over-vpnしかし、似たようなものが見つかりません。

ネットワークインタフェースでdiffを実行しても結果は表示されません。

ZENBOOK:~$ diff <(ssh [email protected] 'ifconfig | grep mtu | grep -v veth') <(ssh [email protected] 'ifconfig | grep mtu | grep -v veth')
ZENBOOK:~$ diff <(ssh [email protected] 'ifconfig | grep mtu | grep -v veth') <(ssh [email protected] 'ifconfig | grep mtu | grep -v veth')
ZENBOOK:~$ diff <(ssh [email protected] 'ifconfig | grep mtu | grep -v veth') <(ssh [email protected] 'ifconfig | grep mtu | grep -v veth')
ZENBOOK:~$

この問題をどのようにさらにデバッグできますか?

編集:コメントから:

他の考えられる原因を取り除くために、最初に各ターゲットシステムのログインスクリプトがメッセージまたは端末制御エスケープコードを出力していないことを確認しました(接続が対話型でない場合)。たとえば、SSHを実行すると[Eメール保護]/bin/true | od -t x1z、出力は 0000000 でなければならず、他に何もありません。 ... – 昨日の通信

ZENBOOK:~$ ssh [email protected] /bin/true | od -t x1z
0000000
ZENBOOK:~$ ssh [email protected] /bin/true | od -t x1z
0000000
ZENBOOK:~$ ssh [email protected] /bin/true | od -t x1z
0000000

ベストアンサー1

おすすめ記事