Chabot College ELEC 99.08 Ports (Layer 4) CISCO NETWORKING ACADEMY TCP/IP Protocol Suite (simplified) Layer 7 Layer 4 FTP HTTP DNS TFTP :21 :80 :53 :69 TCP UDP (connection-oriented) (connectionless) ICMP Layer 3 Layer 1 & 2 CISCO NETWORKING ACADEMY ARP Token Ring IP Ethernet (includes Ping & Traceroute) FDDI Layer 3 - Network Layer • In Chapters 10 & 11, we covered Layer 3 protocols: – Internet Protocol (IP) • Used for addressing – Address Resolution Protocol (ARP) • Used to relate IP and MAC addresses – Internet Control Message Protocol (ICMP) • Used for ping and traceroute commands CISCO NETWORKING ACADEMY Layer 3 - IP, ARP, ICMP Layer 7 Layer 4 FTP HTTP DNS TFTP :21 :80 :53 :69 TCP UDP (connection-oriented) (connectionless) ICMP Layer 3 Layer 1 & 2 CISCO NETWORKING ACADEMY ARP Token Ring IP Ethernet (includes Ping & Traceroute) FDDI A Key Limitation of Layer 3 • No way to keep track of multiple conversations between between pairs of hosts running multiple applications. (e.g. mail & web) CISCO NETWORKING ACADEMY Layer 4 - Transport Layer • Layer 4 uses port numbers to address this limitation. 4 CISCO NETWORKING ACADEMY Port Numbers • Layer 4 uses port numbers to direct data to/from correct upper layer application. CISCO NETWORKING ACADEMY Port Numbers • Used to identify the application that Layer 4 should “hand off to.” • Like a “hole in the ceiling” that Layer 4 “throws” the data up into… • Applications “listen” on a particular port number. • IP address + port number = socket Each socket must be unique, and is another type of address. CISCO NETWORKING ACADEMY TCP & UDP port numbers • TCP/UDP use 16 bits to represent a port number (65,536 possibilities). 1 - 255 Used for standard public applications 256 - 1023 Used by companies for specific apps 1024 & up Unregulated, but many have been “registered” by companies for specific uses. Also, this range is used as dynamically assigned “source port” numbers by TCP. CISCO NETWORKING ACADEMY Well-Known Port Numbers • Well-known port numbers are defined in RFC 1700. Port 80 is web/ www (TCP). CISCO NETWORKING ACADEMY Non-Standard Port Numbers • A host can run its services on any port, not just on the well-known ones. • To direct traffic to a non-standard port, specify the port number after the IP address: http://banner-web.clpccd.cc.ca.us:7000 CISCO NETWORKING ACADEMY Port Numbers in Action Client port Service (listening) LAYER 4 80 Web server 21 File server (FTP) 25 E-mail (SMTP) I want 207.35.52.4, but which service do I want? LAYER 3 207.35.52.4 LAYER 2 00-0c-4f-32-ab-41 CISCO NETWORKING ACADEMY Port Numbers in Action Client TCP port 80 207.35.52.4 00-0c-4f-32-ab-41 The client addresses the message with the port # of the service it wants. CISCO NETWORKING ACADEMY Destination Port 80 - HTTP FTP HTTP DNS TFTP :21 :80 :53 :69 TCP UDP (connection-oriented) (connectionless) IP Ethernet CISCO NETWORKING ACADEMY Port Numbers in Action Client TCP port 80 207.35.52.4 00-0c-4f-32-ab-41 TCP port 25 207.35.52.4 00-0c-4f-32-ab-41 TCP port 21 The client can maintain multiple conversations with the same host, but using different applications. CISCO NETWORKING ACADEMY 207.35.52.4 00-0c-4f-32-ab-41 Port Numbers in Action Client TCP port 1250 TCP port 80 24.1.103.109 207.35.52.4 00-4b-08-57-c6-9f 00-0c-4f-32-ab-41 DESTINATION SOURCE Note that client applications, like web browsers, dynamically “grab” a source port number above 1023 when needed. CISCO NETWORKING ACADEMY Web Server Port Numbers in Action Web Server Client TCP port 80 TCP port 1250 207.35.52.4 24.1.103.109 00-0c-4f-32-ab-41 SOURCE CISCO NETWORKING ACADEMY 00-4b-08-57-c6-9f DESTINATION An Example TCP Header : Sync Request TCP - Transport Control Protocol Source Port: 2352 Destination Port: 80 World Wide Web HTTP Sequence Number: 102274726 Ack Number: 0 Offset: 7 Reserved: %000000 Code: %000010 Sync Sequence Window: 8192 Checksum: 0x6711 Urgent Pointer: 0 TCP Options: CISCO NETWORKING ACADEMY An Example TCP Header: Acknowlegement TCP - Transport Control Protocol Source Port: 80 World Wide Web HTTP Destination Port: 2352 Sequence Number: 2913145779 Ack Number: 102274727 Offset: 6 Reserved: %000000 Code: %010010 Ack is valid Sync Sequence Window: 17520 Checksum: 0x9640 Urgent Pointer: 0 TCP Options: CISCO NETWORKING ACADEMY