FTP Active mode 與 Passive mode 的不同及優缺點
FTP(檔案傳輸協定)在傳輸資料時,有兩種主要的連接模式:主動模式(Active Mode)和被動模式(Passive Mode)。這兩種模式的主要區別在於資料連線的建立方式,這會影響到它們在不同網路環境下的適用性。
以下詳細比較這兩種模式的差異、優缺點:
1. 主動模式(Active Mode)
- 運作方式:
- 客戶端向伺服器發送PORT指令,告知伺服器客戶端用於資料連線的埠號。
- 伺服器主動向客戶端指定的埠號建立資料連線。
- 優點:
- 在沒有防火牆或NAT(網路位址轉換)的簡單網路環境下,運作效率較高。
- 缺點:
- 客戶端必須開放一個埠號給伺服器連線,這在防火牆或NAT環境下可能被阻擋,導致連線失敗。
- 由於是Server端主動連線client端,在防火牆的設定上較為麻煩。
2. 被動模式(Passive Mode)
- 運作方式:
- 客戶端向伺服器發送PASV指令,請求伺服器開啟一個用於資料連線的埠號。
- 伺服器回應客戶端一個隨機的埠號。
- 客戶端主動向伺服器指定的埠號建立資料連線。
- 優點:
- 客戶端主動建立資料連線,更容易穿透防火牆和NAT,適用於複雜的網路環境。
- 由於是Client端主動連線Server端,在防火牆的設定上較為簡單。
- 缺點:
- 伺服器需要開啟一系列的埠號用於被動模式的資料連線,這可能需要調整伺服器的防火牆設定。
- 由於伺服器開啟一系列的埠號,在安全性上需多加注意。
總結
- 在現代網路環境中,由於防火牆和NAT的普及,被動模式通常是更可靠的選擇。
- 主動模式在一些特定的簡單網路環境下可能仍然適用,但需要確保客戶端的防火牆允許伺服器的連線。
選擇建議:
- 如果遇到FTP連線問題,特別是無法列出目錄或傳輸檔案,可以嘗試切換主動模式和被動模式。
- 在大多數情況下,建議優先使用被動模式。
- 如果伺服器有防火牆,必須要設定被動模式的port範圍。
希望這些資訊能幫助您理解FTP的主動模式和被動模式。
Active and Passive Modes
In Active mode, the FTP server will attempt to connect back to a port on the GoAnywhere FTP client in order perform the data transfer. The challenge with Active mode is that your firewall may block the FTP server from trying to open a port back into your network.
In Passive mode, the FTP server does not need to connect back to a port on the GoAnywhere FTP client, which is a more firewall-friendly mode. Therefore, if you have problems with connecting to the FTP server, you may want to change the Use Passive Mode setting to Yes on the FTP Server resource Connection tab.
下圖範例是 Active Mode 的對話
Client 送出command PORT 告訴 Server 我會在 192.168.1.248 的 port 40355 (157x256+163=40355)等你 (listening)連過來

下圖範例是 Passive Mode 的對話
Client 送出command PASV 請求Passive mode. Server 回覆說我會在 192.168.1.25 的 port 53722 (209x256+218=53722)等你 (listening)連過來

GoAnywhere MFT
玉山科技 版權所有 © Copyright AsiaPeak 2006, All Rights Reserved
|