40923247 cp2020

  • Home
    • Site Map
    • reveal
    • blog
  • 首頁
  • HW1
    • U13
      • IPv4 and IPv6 Addresses
      • IPv4 Addressing
      • IPv4 Address Classes
      • Assigning an IP Address 分配IP地址
      • IPv6
      • Classful Vs  Classless Addressing  Subnet and CIDR
      • Windows Networking Windows網絡
    • U14
      • Overview 概述
      • TCP and UDP
      • TCP IP Stack
      • Networking Transfer Protocols 網絡傳輸協議
      • FTP
      • SSL
  • HW2
    • 2-1
    • 2-2
    • 2-3
  • HW3
    • Exercise 34 練習34
    • Exercise 24  練習24
    • Exercise 28  練習28
Networking Transfer Protocols 網絡傳輸協議 << Previous Next >> SSL

FTP

In the OSI (Open Systems Interconnection) model, the application layer uses protocols such as trivial file transfer protocol (TFTP), file transfer protocol (FTP), and file transfer protocol secure (FTPS using TLS/SSL) to allow users to migrate data in a client-server model. FTP concerns itself with data only and as such eliminates the overhead of extraneous information such as what HTTP allows in addition to the actual data (advertisements, banners, images, etc.). This alleviates processing and bandwidth overhead and allows the client to simply retrieve the data from the server.

FTP services can be accessed using client software such as ftp.exe (provided in all Microsoft operating systems), third-party software such as Filezilla or WinSCP, and any modern/current browser. Most light-duty users outside a corporate environment will not use a client FTP (or its secure version) because web browsers can negotiate FTP as well as HTTP. Public FTP servers allow for an anonymous user name so the client can reach file directories specifically designed for public access.

These network communications are passed through the presentation layer to the session layer, where sockets and sessions are created using logical port numbers as defined by TCP or UDP. TCP is stateful, connection-oriented and reliable. UDP is stateless, connectionless, and less reliable. The combination of source and destination address coupled with the logical port number creates a network socket, which establishes the session for process-to-process communication. The material in this section is used under CC-BY license from https://en.wikipedia.org/wiki/Transport_layer.

在OSI(開放系統互連)模型中,應用程序層使用諸如簡單文件傳輸協議(TFTP),文件傳輸協議(FTP)和安全文件傳輸協議(使用TLS / SSL的FTPS)之類的協議來允許用戶遷移數據在客戶端-服務器模型中。FTP僅關注數據本身,因此消除了額外信息的開銷,例如除了實際數據(廣告,橫幅,圖像等)之外,HTTP允許的信息。這減輕了處理和帶寬開銷,並使客戶端可以簡單地從服務器檢索數據。

可以使用諸如ftp.exe(在所有Microsoft操作系統中提供)之類的客戶端軟件,諸如Filezilla或WinSCP之類的第三方軟件以及任何現代/最新的瀏覽器來訪問FTP服務。公司環境之外的大多數輕型用戶將不會使用客戶端FTP(或其安全版本),因為Web瀏覽器可以協商FTP以及HTTP。公用FTP服務器允許使用匿名用戶名,以便客戶端可以訪問專門為公用訪問而設計的文件目錄。

這些網絡通信通過表示層傳遞到會話層,在會話層中,使用由TCP或UDP定義的邏輯端口號創建套接字和會話。TCP是有狀態的,面向連接的且可靠的。UDP是無狀態,無連接且可靠性較低。源地址和目標地址以及邏輯端口號的組合創建了一個網絡套接字,該網絡套接字建立了進程間通信的會話。 本節中的材料根據https://en.wikipedia.org/wiki/Transport_layer的CC-BY許可使用。

Active vs. Passive 主動與被動

Active FTP is a point-to-point connection that the client initiates and connects to the FTP server port 21 for commands and port 20 for data. That means that the server will actively initiate the connections back to the client’s listening port and will require the client to allow these connections, which the firewall blocks by default. Passive FTP allows the client to initiate the data connection on port 21, and then the FTP server moves the command and data connections to random ports on the server (with numbers higher than 1023). By initiating the connection from the client side, the burden of allowing a pass-through on the firewall resides with the FTP server administrator, who is better equipped to set a range of ports allowing connectivity.

For more information on active vs. passive FTP, visit this website.

主動FTP是點對點連接,客戶端啟動該點並連接到FTP服務器端口21(用於命令)和端口20(用於數據)。這意味著服務器將主動啟動回到客戶端偵聽端口的連接,並要求客戶端允許這些連接,防火牆默認情況下會阻止這些連接。被動FTP允許客戶端在端口21上啟動數據連接,然後FTP服務器將命令和數據連接移至服務器上的隨機端口(數字大於1023)。通過從客戶端發起連接,允許通過防火牆的負擔由FTP服務器管理員承擔,他可以更好地設置一系列允許連接的端口。

有關主動與被動FTP的更多信息,請訪問此網站。

Using FTP 使用FTP

Accessing FTP public servers using the command line is not nearly as user-friendly as using a web browser. However, both methods are viable and in use in corporate networks.

  • Open a web browser of choice
  • Use this URL: ftp.funet.fi
  • Click “pubs,” then “standards,” then “RFC”
  • Search RFC 959 and access either the .txt or .pdf file (left-click)
  • Search RFC 4217 and access either the .txt or .pdf file (left-click)
  • If you actually needed the file you can right-click and save as.

Now that you see the file structure, notice it is similar to navigating a local hard drive with the only difference being that you use the “/” (forward slash) instead of the “\” (backslash) because you are accessing the folders through the Internet.

Note: In this next step using the command-line interface, you will only be able to navigate the FTP server, and will not be able to transfer files, because ftp.exe does not support passive mode by default. You can use a command-line tool in a Linux Distro; or, in Windows, you can go to Passive-FTP.com and download the freeware.

However, you can create a workaround by first allowing FTP through your firewall (be sure to put firewall restrictions back in place after the exercise), and then issuing the following commands after you enter the password:

  • quote pasv
  • 使用命令行訪問FTP公共服務器並不像使用Web瀏覽器那樣友好。但是,這兩種方法都是可行的,並且已在公司網絡中使用。

    • 打開選擇的網絡瀏覽器
    • 使用此URL:ftp.funet.fi
    • 點擊“發布”,然後點擊“標準”,然後點擊“ RFC”
    • 搜索RFC 959並訪問.txt或.pdf文件(單擊鼠標左鍵)
    • 搜索RFC 4217並訪問.txt或.pdf文件(單擊鼠標左鍵)
    • 如果您確實需要該文件,則可以右鍵單擊並另存為。

    現在您已經看到文件結構,請注意,它類似於瀏覽本地硬盤驅動器,唯一的區別是您使用“ /”(正斜杠)而不是“ \”(反斜杠),因為您通過以下方式訪問文件夾互聯網。

    注意:在接下來的使用命令行界面的步驟中,您將只能瀏覽FTP服務器,並且將無法傳輸文件,因為ftp.exe默認情況下不支持被動模式。您可以在Linux Distro中使用命令行工具。或者,在Windows中,您可以轉到Passive-FTP.com並下載免費軟件。

    但是,您可以通過首先允許FTP通過防火牆(確保在練習後將防火牆限制放回原位),然後在輸入密碼後發出以下命令來創建解決方法:

    • 引用pasv

Image used under CC-BY license from Russell Burchill.

  • Now the “dir, ls” (list directory contents), and “get” (download) commands will work.
  • By default, the file will download to your user root at C:\Windows\Users\**your user name** or at the root of C:\ (wherever your OS is installed).

As a public FTP server set to passive mode, certain commands do not work and invoke the server to close the socket. If that happens, re-do your log on.

Use the keyboard command  + r and type ftp (from an administrative command line interface you can also type ftp). The prompt changes to ftp>

  • 現在,“ dir,ls”(列出目錄內容)和“ get”(下載)命令將起作用。
  • 默認情況下,該文件將下載到用戶根目錄C:\ Windows \ Users \ **或用戶名**或C:\根目錄(無論安裝了OS的位置)。

將公共FTP服務器設置為被動模式後,某些命令將不起作用,並調用服務器以關閉套接字。如果發生這種情況,請重新登錄。

使用鍵盤命令+ r並鍵入ftp(在管理命令行界面中,您也可以鍵入ftp)。提示符更改為ftp>

Image used under CC-BY license from Russell Burchill.

  • Type “help” and look at the commands.
  • Type at the command prompt: open ftp.funet.fi.
  • Follow the prompts to log on.
  • Username: anonymous.
  • Password: any generic e-mail (such as user@user.com).

You get a welcome message and can now navigate through the directory structure you saw in the browser by typing the following commands:

  • pwd — lists the current directory.
  • cd — changes the directory. This may be in the form of:
    • cd pub (refer to the URL path from the previous exercise), or
    • cd/pub/standards/RFC/
  • 輸入“ help”並查看命令。
  • 在命令提示符下鍵入:打開ftp.funet.fi。
  • 按照提示進行登錄。
  • 用戶名:匿名。
  • 密碼:任何通用電子郵件(例如user@user.com)。

您會收到一條歡迎消息,現在可以通過鍵入以下命令來瀏覽瀏覽器中看到的目錄結構:

  • pwd-列出當前目錄。
  • cd —更改目錄。可以採用以下形式:
    • cd pub(請參閱上一練習中的URL路徑),或
    • cd / pub / standards / RFC /
  • Image used under CC-BY license from Russell Burchill.

Now if you are using the workaround, Mac, or Linux you can download a file using the “get” command:

Image used under CC-BY license from Russell Burchill.

  • 圖片由Russell Burchill根據CC-BY許可使用。

現在,如果您使用的是變通方法,Mac或Linux,則可以使用“ get”命令下載文件:

圖片由Russell Burchill根據CC-BY許可使用。

Without the passive mode workaround, a third-party FTP client, Mac, or Linux this is as far as you can go. However, in the corporate environment you might be required to troubleshoot FTP on the local intranet, which would most likely be set to active FTP. Clearly, the need for command-line FTP service is fairly limited compared to using a browser.

如果沒有被動模式解決方法,則只能使用第三方FTP客戶端,Mac或Linux。但是,在公司環境中,可能需要對本地Intranet上的FTP進行故障排除,這很可能會設置為活動FTP。顯然,與使用瀏覽器相比,命令行FTP服務的需求非常有限。


Networking Transfer Protocols 網絡傳輸協議 << Previous Next >> SSL

Copyright © All rights reserved | This template is made with by Colorlib