キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 
cancel
9168
閲覧回数
6
いいね!
0
コメント
yushimaz
Cisco Employee
Cisco Employee

    FTP は、制御用の control connection, Data 転送用の data connection という 2 つの connection を張ります。 さらに data connection には active mode,  passive mode という 2 つの mode があります。

    # active  mode

    port command を使用。

    client が待ち受け port server に送信。

    server から connection を張る。

    #  passive mode

    pasv command を使用。

    server が待ち受け port client に返信。

    client から connection を張る。

    active/passive mode の大きな違いは上記になります。

    実際に file download した場合の capture を用い、動作の違いについて確認してみます。

    # 構成

    ftp_01.png

    # client  log


    client:/# ftp 192.168.71.254

    Connected to    192.168.71.254.

    220 (vsFTPd    2.0.7)

    Name    (192.168.71.254:root): anonymous

    331 Please    specify the password.

    Password:

    230 Login    successful.

    Remote system    type is UNIX.

    Using binary    mode to transfer files.

    ftp>

    ftp> get welcome.msg

    !___ active mode file download

    local:    welcome.msg remote: welcome.msg

    200 PORT    command successful. Consider using PASV.

    150 Opening    BINARY mode data connection for welcome.msg (166 bytes).

    226 File send    OK.

    166 bytes    received in 0.00 secs (267.5 kB/s)

    ftp> passive

    Passive mode    on.

    ftp>

    ftp> get welcome.msg

    !___ passive mode file download

    local:    welcome.msg remote: welcome.msg

    227 Entering    Passive Mode (192,168,71,254,190,46)

    150 Opening    BINARY mode data connection for welcome.msg (166 bytes).

    226 File send    OK.

    166 bytes    received in 0.00 secs (343.5 kB/s)

    ftp> quit

    221 Goodbye.

    #capture  (active mode)

    ftp_02.png


    active mode の場合、上記 capture のように、PORT command 中に client が待ち受ける ip address, port# の情報が入っています (ip address:192.168.71.11,  port#:130x256+39=33319)

    その情報を用い、22 行目のように、server(192.168.71.254:20) ->  client(192.168.71.11:33319) に対して connection を張ります。

    #capture  (passive mode)

    ftp_03.png

    passive mode の場合、上記 capture 33 行目のように、PASV command を送信します。 active  mode と異なり、この packet 中に ip  address port# の情報は含まれず、その次 (34行目) の、server からの 227 response 中に、server が待ち受ける ip address, port# の情報が入っています (ip address:192.168.71.254, port#:21x256+109=5485)

    その情報を用い、35 行目のように、client(192.168.71.11:48365) ->  server(192.168.71.254:5485) に対して connection を張ります。 client port#48365 は任意の番号です。

    FTP に関する Troubleshooting を行う場合、

    - Control Connection 自体が張れないのか、Data  Connection 側の問題なのか

    - Data Connection の問題の場合、active/passive どちらかのみで発生するのか、active/passive 両方で発生するのか

    といった切り分けを行うことで、原因が特定しやすくなり、問題解決までの時間が短くなります。

Getting Started

検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう

シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします