1 Tips for the assignment. 2 Socket: a door between application process and end- end-transport protocol (UDP or TCP) TCP service: reliable transfer of.

Slides:



Advertisements
Similar presentations
FTP - File Transfer Protocol TFTP – Trivial FTP CISC 856 – Fall 2005 Michael Haggerty University of Delaware (some/most slides courtesy of Umakanth Puppala.
Advertisements

FTP - File Transfer Protocol TFTP – Trivial FTP CISC 856 – Fall 2007 Brian Lucas University of Delaware (some/most slides courtesy of Umakanth Puppala,
Data Communications and Networking (Third Edition)
1 FTP: File Transfer Protocol EE 122: Intro to Communication Networks Fall 2007 (WF 4-5:30 in Cory 277) Vern Paxson TAs: Lisa Fowler, Daniel Killebrew.
CPSC 441: FTP & SMTP1 Application Layer: FTP & Instructor: Carey Williamson Office: ICT Class.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Application Layer PART VI.
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
1 School of Computing Science Simon Fraser University CMPT 771/471: Internet Architecture and Protocols Socket Programming Instructor: Dr. Mohamed Hefeeda.
How Clients and Servers Work Together. Objectives Learn about the interaction of clients and servers Explore the features and functions of Web servers.
File Transfer Protocol (FTP)
Julia Ljunbjörk and Anita Mugenyi. What is a socket? Like a house Between the layers.
Introduction 1 Lecture 7 Application Layer (FTP, ) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering.
TCP/IP suit 4th Edition by Behrouz A Forouzan. 2 Internet Computing (CS-413)
Introduction 1-1 Chapter 2 FTP & Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 IC322 Fall.
Advanced Networking for DVRs
TCP Sockets Reliable Communication. TCP As mentioned before, TCP sits on top of other layers (IP, hardware) and implements Reliability In-order delivery.
FTP File Transfer Protocol. Introduction transfer file to/from remote host client/server model  client: side that initiates transfer (either to/from.
FTP - File Transfer Protocol TFTP – Trivial FTP CISC 856 – Fall 2005 Michael Haggerty University of Delaware (some/most slides courtesy of Umakanth Puppala.
2440: 141 Web Site Administration Remote Web Server Access Tools Instructor: Enoch E. Damson.
2: Application Layer1 Chapter 2 Application Layer These slides derived from Computer Networking: A Top Down Approach, 6 th edition. Jim Kurose, Keith Ross.
Module 7: Configuring TCP/IP Addressing and Name Resolution.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
Ferry Astika Saputra FTP & TFTP Server. Overview File Transfer Protocol (RFC 959) Why FTP? FTP’s connections FTP in action FTP commands/responses Trivial.
1 Web Server Administration Chapter 9 Extending the Web Environment.
IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 2: Application.
FTP (File Transfer Protocol) & Telnet
Simple Mail Transfer Protocol (SMTP)
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
FTP Client Application CSC 8560 Brian Jorgage 4/27/2004.
Discussion 2 Sockets Programming Applets TCP UDP HTTP Delay Estimation
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
File Transfer Protocol (FTP)
Application Layer 2-1 ESERCITAZIONE SOCKET PROGRAMMING.
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
1 INFO 321 Server Technologies II FTP Material adapted from Dr. Randy Kaplan.
Department of Computer Science Southern Illinois University Edwardsville Spring, 2008 Dr. Hiroshi Fujinoki FTP Protocol Programming.
2: Application Layer1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Chapter 2 Applications and Layered Architectures Sockets.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 8 Omar Meqdadi Department of Computer Science and Software Engineering University of.
Remote Shell CS230 Project #4 Assigned : Due date :
Computer Networking From LANs to WANs: Hardware, Software, and Security Chapter 13 FTP and Telnet.
TFTP: Trivial file transfer protocol
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
FTP File Transfer Protocol Graeme Strachan. Agenda  An Overview  A Demonstration  An Activity.
Tips on FTP Implementation
Client/Server Socket Programming Project
Socket Programming.
Department of Computer Science Southern Illinois University Edwardsville Spring, 2008 Dr. Hiroshi Fujinoki FTP Protocol Programming.
Tips on FTP Implementation
Understanding FTP BUPT/QMUL Part1: Using telnet to learn FTP operations in passive mode Steps: 1. Using telnet to connect to given FTP server.
Remote Access Usages. Remote Desktop Remote desktop technology makes it possible to view another computer's desktop on your computer. This means you can.
FTP COMMANDS OBJECTIVES. General overview. Introduction to FTP server. Types of FTP users. FTP commands examples. FTP commands in action (example of use).
Slides based on Carey Williamson’s: FTP & SMTP1 File Transfer Protocol (FTP) r FTP client contacts FTP server at port 21, specifying TCP as transport protocol.
1 COMP 431 Internet Services & Protocols Client/Server Computing & Socket Programming Jasleen Kaur February 2, 2016.
1 FTP FILE TRANSFER PROTOCOL FTP uses TCP. FTP uses two simultaneous TCP connections. Server port 21 is used for control, server port 20 for data transfers.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
1 FTP: File Transfer Protocol EE 122: Intro to Communication Networks Fall 2006 Vern Paxson TAs: Dilip Antony Joseph and Sukun Kim
INTERNET APPLICATIONS CPIT405 Install a web server and analyze packets.
1 Network Communications A Brief Introduction. 2 Network Communications.
1 K. Salah Application Layer Module K. Salah Network layer duties.
Socket Programming original by Joonbok Lee KAIST heavily adapted by /Jens.
Two FTP connections from different hosts
FTP & TFTP Server Ferry Astika Saputra.
Client/Server Example
Chapter 2: Application layer
File Transfer Protocol
Chapter 2 Application Layer
Presentation transcript:

1 Tips for the assignment

2 Socket: a door between application process and end- end-transport protocol (UDP or TCP) TCP service: reliable transfer of bytes from one process to another process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server process TCP with buffers, variables socket controlled by application developer controlled by operating system host or server Internet Socket Programming using TCP

3

4 client Client socket server Welcome socket Connection socket time Client socket bytes Client Sockets & Server Sockets

5 Client/server socket interaction: TCP wait for incoming connection request connectionSocket = accept() create socket, port= x, for incoming request: welcomeSocket = Socket() create socket, connect to hostid, port= x clientSocket = Socket() close connectionSocket read reply from clientSocket close clientSocket Server Server (running on hostid ) Client send request using clientSocket read request from connectionSocket write reply to connectionSocket TCP connection setup Application 2-5

6 socket bind listen loop "forever" { accept /* by creating new socket */ /* process the client’s request */ loop until done { receive/send } closesocket(newsocket) } Simple Server Pseudo-Code

7 socket connect /* process the client’s request */ loop until done { send/receive } closesocket(socket) Simple Client Pseudo-Code

8 socket bind listen loop "forever" { accept /* by creating new socket */ /* process the clients request */ loop until done { receive/send } closesocket(newsocket) } Proper Ordering of Send and Recv socket connect /* process the clients request */ loop until done { send/receive } closesocket(socket)

9 Test the TCP Client-Server Codes ServerWindows.c  Run ServerWindows.c ClientWindows.c  Compile ClientWindows.c, look for the executable. ClientWindows.c  Run ClientWindows.c from the command prompt to connect to the server:  ClientWindows localhost 1234  Alternatively, use IpConfig to find out what your IP address is: (e.g ), then connect to the server using: ClientWindows ClientWindows  Let’s see how to use the compiler’s debug mode to trace the exchange of messages.

10

11 FTP (Multiple Clients)  In TCP, the Server should be running already prior to a Client connecting to it S Server TCP Control Socket C ListeningSocket DIR TCP Active Data Socket Port 127,0,0,1,6,11 Quit After file transfer

12

13 FTP Operation Source: Computer Networking and the Internet (5/e) by Fred Halsall CLIENT SERVER Control connection Data connection Note that Ports 1216 & 1217 are ephemeral ports. Any port [1024, 65535] will work.

14 FTP Commands COMMANDDESCRIPTION USER usernameUser name on the FTP server PASS passwordUser’s password on the FTP server SYSTType of operating system requested TYPE typeFile type to be transferred: A (ASCII), I (Image/Binary) PORT n1,n2,n3,n4,n5,n6Client IP address (n1-n4) and port number (n5, n6) RETR filename.typeRetrieve (get) a file STOR filename.typeStore (put) a file LIST filelistList files or directories QUITLog off from server Source: Computer Networking and the Internet (5/e) by Fred Halsall

15 FTP Reply Codes REPLYDESCRIPTION 1 1yzPositive reply, wait for another reply before sending a new command 2 2yzPositive reply, a new command can be sent 3 3yzPositive reply, another command is awaited 4 4yzNegative reply, try again 5 5yzNegative reply, do not retry 0x0z0x0zSyntax 1x1z1x1zInformation 2x2z2x2zControl or data connection 3x3z3x3zAuthentication 4x4z4x4zUnspecified 5x5z5x5zFile status Source: Computer Networking and the Internet (5/e) by Fred Halsall

16 Active FTP (or Standard ) Standard (or PORT or Active) The Standard mode FTP client sends PORT commands to the FTP server. These commands are sent over the FTP command channel when establishing the FTP session.Operation Standard mode FTP clients first establish a connection to TCP port 21 on the FTP server. This connection establishes the FTP command channel. The client sends a PORT command over the FTP command channel when the FTP client needs to send or receive data, such as a folder list or file. The PORT command contains information about which port the FTP client receives the data connection on. In Standard mode, the FTP server always starts the data connection from TCP port 20. The FTP server must open a new connection to the client when it sends or receives data, and the FTP client requests this by using the PORT command again.

17 Passive FTP (or PASV) Passive (or PASV) The Passive mode client sends PASV commands to the FTP Server. Operation Passive mode FTP clients also start by establishing a connection to TCP port 21 on the FTP server to create the control channel. When the client sends a PASV command over the command channel, the FTP server opens an ephemeral port (between 1024 and 5000) and informs the FTP client to connect to that port before requesting data transfer. As in Standard mode, the FTP client must send a new PASV command prior to each new transfer, and the FTP server will await a connection at a new port for each transfer.

18 p. 50, RFC 959

19 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Port1120Port1121 Data connectioncontrol connection

20 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open Port1120Port1121 Data connectioncontrol connection

21 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established Port1120Port1121 Data connectioncontrol connection

22 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready Port1120Port1121 Data connectioncontrol connection

23 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER Port1120Port1121 Data connectioncontrol connection

24 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required Port1120Port1121 Data connectioncontrol connection

25 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS Port1120Port1121 Data connectioncontrol connection

26 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in Port1120Port1121 Data connectioncontrol connection

27 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in SYST Port1120Port1121 Data connectioncontrol connection

28 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in SYST 215 UNIX Type:X Version:Y Port1120Port1121 Data connectioncontrol connection

29 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in get Port1120Port1121 Data connectioncontrol connection

30 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 get Port1120Port1121 Data connectioncontrol connection

31 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get Port1120Port1121 Data connectioncontrol connection

32 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR Port1120Port1121 Data connectioncontrol connection

33 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR 150 opening ASCII mode data connection Port1120Port1121 Data connectioncontrol connection

34 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR 150 opening ASCII mode data connection Server does an active open to Port n5, n6 Port1120Port1121 Data connectioncontrol connection

35 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR 150 opening ASCII mode data connection Send file through data connection Server does an active open to Port n5, n6 Port1120Port1121 Data connectioncontrol connection

36 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR 150 opening ASCII mode data connection Send file through data connection Server does an active open to Port n5, n6 226 File transfer complete User prompted for a conmand Port1120Port1121 Data connectioncontrol connection

37 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR 150 opening ASCII mode data connection Send file through data connection Server does an active open to Port n5, n6 226 File transfer complete User prompted for a conmand QUIT Port1120Port1121 Data connectioncontrol connection

38 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR 150 opening ASCII mode data connection Send file through data connection Server does an active open to Port n5, n6 226 File transfer complete, User prompted for a conmand QUIT 221 Goodbye Port1120Port1121 Data connectioncontrol connection

39 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER Port20Port21 Data connection control connection Port1120Port1121 Data connectioncontrol connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PORT n1-n6 200 PORT command successful get RETR 150 opening ASCII mode data connection Send file through data connection Server does an active open to Port n5, n6 226 File transfer complete, User prompted for a conmand QUIT 221 Goodbye Server closes data connection first, then control connection

40

41 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Port1120Port1121 Data connection control connection

42 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open Port1120Port1121 Data connection control connection

43 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established Port1120Port1121 Data connection control connection

44 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready Port1120Port1121 Data connection control connection

45 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER Port1120Port1121 Data connection control connection

46 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection Data connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required Port1120Port1121 Data connection control connection

47 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS Port1120Port1121 Data connection control connection

48 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in Port1120Port1121 Data connection control connection

49 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection Port1120Port1121 time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in SYST Data connection control connection

50 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in SYST 215 UNIX Type:X Version:Y Port1120Port1121 Data connection control connection

51 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV Port1120Port1121 Data connection control connection

52 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port 2024 Port1120Port1121 Data connection control connection

53 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port 2024 dir Port1120Port1121 Data connection control connection

54 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port 2024 LIST dir Port1120Port1121 Data connection control connection

55 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port 2024 LIST dir 150 Opening ASCII mode data connection for file list Port1120Port1121 Data connection control connection

56 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port n5, n6 (or Port 2024 in this example) LIST dir 150 Opening ASCII mode data connection for file list Client does an active open to Port n5,n6 Port1120Port1121 Data connection control connection

57 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port n5, n6 (or Port 2024 in this example) LIST dir 150 Opening ASCII mode data connection for file list Client does an active open to Port n5,n6 Send file through data connection Port1120Port1121 Data connection control connection

58 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port n5, n6 (or Port 2024 in this example) LIST dir 150 Opening ASCII mode data connection for file list Client does an active open to Port n5,n6 Send file through data connection 226 File transfer complete User is prompted for a command Port1120Port1121 Data connection control connection

59 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port n5, n6 (or Port 2024 in this example) LIST dir 150 Opening ASCII mode data connection for file list Client does an active open to Port n5,n6 Send file through data connection 226 File transfer complete User is prompted for a command QUIT Port1120Port1121 Data connection control connection

60 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port n5, n6 (or Port 2024 in this example) LIST dir 150 Opening ASCII mode data connection for file list Client does an active open to Port n5,n6 Send file through data connection 226 File transfer complete User is prompted for a command QUIT 221 Goodbye Port1120Port1121 Data connection control connection

61 Source: Computer Networking and the Internet (5/e) by Fred Halsall PASSIVE FTP Operation CLIENTSERVER Port2024Port21 Data connection control connection time Passive open Active open TCP control connection to Port 21 established 220 FTP server ready USER 331 password required PASS 220 user logged in PASV 227 Entering PASV mode (192,168,150,90,195,149) Port n5, n6 (or Port 2024 in this example) LIST dir 150 Opening ASCII mode data connection for file list Client does an active open to Port n5,n6 Send file through data connection 226 File transfer complete User is prompted for a command QUIT 221 Goodbye Server closes data connection first, then control connection Port1120Port1121 Data connection control connection

62 Source: Computer Networking and the Internet (5/e) by Fred Halsall ACTIVE FTP Operation CLIENTSERVER

63 Security Issues Passive mode FTP servers Firewall administrators may not want to use Passive mode FTP servers because the FTP server can open any ephemeral port number. ephemeral port range Many FTP servers are configured with an ephemeral port range of 1024 through unsecured Firewall configurations that allow full access to all ephemeral ports for unsolicited connections may be considered unsecured.

64 Active Connections Proto Local Address Foreign Address State TCP IT027049:http IT massey.ac.nz:0 LISTENING TCP IT027049:epmap IT massey.ac.nz:0 LISTENING TCP IT027049:https IT massey.ac.nz:0 LISTENING TCP IT027049:microsoft-ds IT massey.ac.nz:0 LISTENING TCP IT027049:1025 IT massey.ac.nz:0 LISTENING TCP IT027049:1179 IT massey.ac.nz:0 LISTENING TCP IT027049:1181 IT massey.ac.nz:0 LISTENING TCP IT027049:1300 IT massey.ac.nz:0 LISTENING TCP IT027049:1318 IT massey.ac.nz:0 LISTENING TCP IT027049:1786 IT massey.ac.nz:0 LISTENING TCP IT027049:1787 IT massey.ac.nz:0 LISTENING TCP IT027049:1790 IT massey.ac.nz:0 LISTENING TCP IT027049:1791 IT massey.ac.nz:0 LISTENING TCP IT027049:5000 IT massey.ac.nz:0 LISTENING TCP IT027049:13450 IT massey.ac.nz:0 LISTENING TCP IT027049:netbios-ssn IT massey.ac.nz:0 LISTENING TCP IT027049:1082 IT massey.ac.nz:0 LISTENING TCP IT027049:1179 its-xchg4.massey.ac.nz:1165 ESTABLISHED TCP IT027049:1181 its-dc2.massey.ac.nz:1025 ESTABLISHED TCP IT027049:1318 hnt-up-dhcp-494.wharton.upenn.edu:62686 ESTABLISHED TCP IT027049:1456 IT massey.ac.nz:0 LISTENING TCP IT027049:1456 alb-file2.massey.ac.nz:netbios-ssn ESTABLISHED TCP IT027049:1467 IT massey.ac.nz:0 LISTENING TCP IT027049:1467 itsa-campus1.massey.ac.nz:netbios-ssn ESTABLISHED TCP IT027049:1786 d home.cgocable.net:7091 ESTABLISHED Some utility: Netstat COMMAND: Netstat -a Displays all active TCP connections and the TCP and UDP ports on which the computer is listening

65 TCP IT027049:1787 pcp pcs.detrtc01.mi.comcast.net:21848 ESTABLISHED TCP IT027049:1790 balticom balticom.lv:63567 ESTABLISHED TCP IT027049: nyc.rr.com:1236 ESTABLISHED TCP IT027049:8947 IT massey.ac.nz:0 LISTENING UDP IT027049:microsoft-ds *:* UDP IT027049:isakmp *:* UDP IT027049:1026 *:* UDP IT027049:1027 *:* UDP IT027049:1028 *:* UDP IT027049:1046 *:* UDP IT027049:1088 *:* UDP IT027049:1177 *:* UDP IT027049:13450 *:* UDP IT027049:38037 *:* UDP IT027049:ntp *:* UDP IT027049:1187 *:* UDP IT027049:1459 *:* UDP IT027049:1718 *:* UDP IT027049:1900 *:* UDP IT027049:ntp *:* UDP IT027049:netbios-ns *:* UDP IT027049:netbios-dgm *:* UDP IT027049:1900 *:* UDP IT027049:8760 *:* UDP IT027049:62493 *:*

66 How to change the Internet Explorer FTP Client mode  Start Internet Explorer.  On the Tools menu, click Internet Options.  Click the Advanced tab.  Under Browsing, click to clear the Enable folder view for FTP sites check box. Passive FTP  Click to select the Use Passive FTP (for firewall and DSL modem compatibility) check box. Internet Explorer behaves as a Standard mode FTP client if you select the Enable folder view for FTP sites check box, even if you also select the Use Passive FTP check box. If you clear the Enable folder view for FTP sites check box and then select the Use Passive FTP check box, Internet Explorer behaves as a Passive mode FTP client.

67 The End