1 Introduction to TCPIP Yusuke Matsuoka Herwin Chan

  • Slides: 16
Download presentation
1 Introduction to TCP/IP Yusuke Matsuoka / Herwin Chan EE 201 A Spring/2003 UCLA

1 Introduction to TCP/IP Yusuke Matsuoka / Herwin Chan EE 201 A Spring/2003 UCLA

OSI and Protocol Stack OSI Model TCP/IP Hierarchy 2 OSI: Open Systems Interconnect Protocols

OSI and Protocol Stack OSI Model TCP/IP Hierarchy 2 OSI: Open Systems Interconnect Protocols 7 th Application Layer 6 th Presentation Layer Application Layer 5 th Session Layer 4 th Transport Layer 3 rd Network Layer 2 nd Link Layer 1 st Physical Layer Link Layer Network Layer Transport Layer Application Layer Link Layer : includes device driver and network interface card : handles the movement of packets, i. e. Routing : provides a reliable flow of data between two hosts : handles the details of the particular application

3 Packet Encapsulation n The data is sent down the protocol stack n Each

3 Packet Encapsulation n The data is sent down the protocol stack n Each layer adds to the data by prepending headers 22 Bytes 20 Bytes 64 to 1500 Bytes 4 Bytes

4 Ethernet n Computer <-> Computer communication on same network n Each device has

4 Ethernet n Computer <-> Computer communication on same network n Each device has unique MAC address (48 -bit) example: 00 -C 0 -4 F-48 -47 -93 Ethernet Packet: Preamble Dest. address Source address Type Data 8 bytes 6 bytes 2 bytes 64 - 1500 bytes CRC 4 bytes MAC: Media Access Control

ARP : Address Resolution Protocol n ARP provides mapping 32 bit IP address <->

ARP : Address Resolution Protocol n ARP provides mapping 32 bit IP address <-> 48 bit MAC address 128. 97. 89. 153 <-> 00 -C 0 -4 F-48 -47 -93 n ARP cache maintains the recent mappings from IP addresses to MAC addresses Protocol 1. ARP request broadcast on Ethernet 2. Destination host ARP layer responds 5

6 IP: Internet Protocol n Unreliable … connectionless datagram delivery service n Responsible for

6 IP: Internet Protocol n Unreliable … connectionless datagram delivery service n Responsible for routing of data through intermediate networks and computers IP header: 1 : ICMP 6 : TCP 17 : UDP 0123 4567 11 8901 1111 2345 1111 6789 2222 0123 2222 4567 2233 8901

7 IP Routing Source Destination Application Transport Router Transport Network Link n Routing Table

7 IP Routing Source Destination Application Transport Router Transport Network Link n Routing Table Destination IP address of a next-hop router Flags Network interface specification

ICMP : Internet Control Message Protocol 8 n Used to report problems with delivery

ICMP : Internet Control Message Protocol 8 n Used to report problems with delivery of IP Datagrams within an IP network n Used by Ping, Tracerout commands ICMP Message 20 bytes IP Header 4 bytes ICMP Header ICMP Data Types and Codes Type Code Checksum n Echo Request (type=8, code=0) 1 byte 2 bytes n Echo Reply(type=0, code=0) n Destination Unreachable(type=3, code=0) n Time Exceeded(type=11, code=0) : Time-to-Live =0

9 TCP : Transmission Control Protocol n Connection-Oriented, Reliable, Byte Stream Service Protocol 1.

9 TCP : Transmission Control Protocol n Connection-Oriented, Reliable, Byte Stream Service Protocol 1. Set up connection 2. Transfer data 3. Close connection TCP Header Format 0 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 2 0 Source Port 2 1 2 2 2 3 2 4 2 5 Destination Port Sequence Number Acknowledgement Number Data Offset - - Window Checksum Urgent Pointer Options (0 to 10 Words of 32 Bits) TCP Payload 2 6 2 7 2 8 2 9 3 0 3 1

TCP : State Diagram 10

TCP : State Diagram 10

11 TCP : Connection Client Host Send SYN seq=x Receive SYN +ACK segment Client

11 TCP : Connection Client Host Send SYN seq=x Receive SYN +ACK segment Client Host Send FIN seq=x Receive SYN segment Send SYN seq=y, ACK x+1 Send ACK y+1 Receive ACK segment Establishing a TCP Connection Receive ACK segment Receive FIN + ACK segment Send ACK y+1 Receive FIN segment Send ACK x+1 Send FIN seq=y, ACK x+1 Receive ACK segment Closing a TCP Connection

12 TCP : Data transfer Client Timer Send Packet 1 Start Timer ACK would

12 TCP : Data transfer Client Timer Send Packet 1 Start Timer ACK would normally Arrive at this time Host Packet Lost Packet should arrive ACK should be sent Time Expires Timer Retransmit Packet 1 Start Timer Receive ACK 1 Cancel Timer Receive Packet 1 Send AXK 1

HTTP : Hyper Text Transfer Protocol n Stateless Transaction Protocol Each transaction creates a

HTTP : Hyper Text Transfer Protocol n Stateless Transaction Protocol Each transaction creates a new connection Steps in Transaction 1. Establish connection 2. Request Method <URL> <CR> 3. Response Code <Data> <CR> 4. Close connection 13

HTTP n Common Request Methods GET, PUT, POST n Response Categories Informational : 100

HTTP n Common Request Methods GET, PUT, POST n Response Categories Informational : 100 Successful : 200 Redirection : 300 Client Error : 400 (eg. 404 Not found) Server Error : 500 14

15 Example: Access www. ee. ucla. edu Server Client Appl HTTP Transp TCP Net

15 Example: Access www. ee. ucla. edu Server Client Appl HTTP Transp TCP Net IP Link ethernet Http request GET “http: //www. ee. ucla. edu”<CR> Http response 200 “” <CR> <html file in MIME format> Initiate connection (hdshk) Package data (add TCP header) send http request packet Assemble response (break into several packets) Send http response packets Close connection (hdshk) send data to next hop ARP to provide IP/MAC translation Relay data Net IP Link ethernet Router(s) Appl HTTP Transp TCP Net IP Link ethernet

References n “TCP/IP Illustrated, Volume 1 The Protocols “ by W. Richard Stevens (http:

References n “TCP/IP Illustrated, Volume 1 The Protocols “ by W. Richard Stevens (http: //yenigul. net/tcpip) n “Internet Working with TCP/IP Volume 1” by Douglas E. Comer n “Sams Teach Yourself TCP/IP in 24 Hours” by Joe Casad. Published by Sams. (http: //www. informit. com) 16