Experiment with the PASV transmission mode of FTP under the command line

Source: Internet
Author: User
Tags ftp commands

 

FTPOfPASVTransmission Mode is also called passive transmission mode.

 

As we all know, standardsFTPTwoTCP/IPConnection, which has a command connectionFTPClient andFTPInformation about commands and execution results is transmitted between servers. There is also a data connection, which is used to transfer file data when you upload or download files.

The port connecting the command is fixed and the connection is persistent.21Port number. The data connection ports are randomly generated on a temporary basis and are disconnected along with the connection.

 

Rfc959A simple example of the standard protocol document shows this architecture. 

-------------
|/--------- \ |
| User | --------
| Interface | <---> | user |
| \ ---- ^ ----/| --------
---------- |
|/------ \ | FTP commands |/---- v ---- \ |
| Server | <----------------> | user |
| PI | FTP replies | PI |
| \ -- ^ ---/| \ ---- ^ ----/|
|
-------- |/-- V --- \ | data |/---- v ---- \ | --------
| File | <---> | Server | <----------------> | user | <---> | file |
| System | DTP | connection | DTP | system |
-------- | \ ------/| \ ---------/| --------
-----------------------

Servers-FTP USER-FTP

Based on whether the client actively initiates a data port or the server actively initiates a data portFTPTwo transmission modes,PortAndPASV.

 

PortMode.PortCommand to tell the server to use the data port number, and then actively establish this port on the clientTCP/IPListen. During file transfer, the server connects to the data port of the client for data transmission.

 

PASVMode.PASVCommand to tell the server, want to usePASVTransmission Mode. After the server receives the command, it establishes a data port on the server.TCP/IPListen and return the data port number to the client. During file transfer, the client connects to the data port on the server for data transmission.

 

For better understandingPASVTransmission Mode. I simulated it in the command line.FTPOfTCP/IPConnection.

In the experiment, I usedIISBuilt-inFTPServer (anyFTPAll server software is supported.PASVMode ).

SimulationFTPDuring connection, I usedTelnet loalhost 21This method is used for simulation.TCP/IPConnection.

 

1.InFTPServer root directory (generallyC: \ Inetpub \ ftproot) To createTest.txtFile.

 

 

 

2.In the command line (CMD).

(1)Telnet localhost 21

(2)User xxxx<-ThisXxxxYesWindowUser Name

(3)Pass xxxx<-ThisXxxxIs the user's logon Password

 

 

3.RunPASVCommand to tell the server to usePASVTransmission Mode. The server returns the port number of the data port. 

 

The data returned by the server is, 0, Including the server sideIPAnd data port number

ServerIP:127.0.0.1

Data port number:5×256+ 20 = 1300

 

 

4.Open another command line (CMD) Window, create a connection to the server data port, and use the port number you just obtained.

Telnet fig 1300

 

 

 

5.Enter download in the command portTest.txt.

RETR test.txt

 

 

6. test.txtFile Content, transmitted through the data port, is displayed in the data connection command line window.

 

 

The preceding steps are completed.PASV.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.