1 introduction to tcp/ip. 2 osi and protocol stack osi: open systems interconnect osi modeltcp/ip...

16
1 Introduction to TCP/IP

Upload: solomon-bishop

Post on 14-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

1

Introduction to TCP/IP

Page 2: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

2OSI and Protocol StackOSI: Open Systems Interconnect

OSI Model TCP/IP Hierarchy Protocols

7th

Application Layer

6th

Presentation Layer

5th

Session Layer

4th

Transport Layer

3rd

Network Layer

2nd

Link Layer

1st

Physical Layer

Application Layer

Transport Layer

Network Layer

Link Layer

Link Layer : includes device driver and network interface cardNetwork Layer : handles the movement of packets, i.e. RoutingTransport Layer : provides a reliable flow of data between two hostsApplication Layer : handles the details of the particular application

Page 3: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

3Packet Encapsulation

The data is sent down the protocol stack Each layer adds to the data by prepending headers

22Bytes20Bytes20Bytes 4Bytes

64 to 1500 Bytes

Page 4: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

4Ethernet

Computer <-> Computer communication on same network

Each device has unique MAC address (48-bit)example: 00-C0-4F-48-47-93

Ethernet Packet:Dest.

addressData CRCSource

addressType

MAC: Media Access Control

6bytes 6bytes 2bytes

Preamble

8bytes 64 - 1500bytes 4bytes

Page 5: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

5ARP : Address Resolution Protocol

ARP provides mapping32bit IP address <-> 48bit MAC address128.97.89.153 <-> 00-C0-4F-48-47-93

ARP cache maintains the recent mappings from IP addresses to MAC addresses

Protocol1. ARP request broadcast on Ethernet2. Destination host ARP layer responds

Page 6: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

6IP: Internet Protocol

Unreliable … connectionless datagram delivery service Responsible for routing of data through intermediate

networks and computers

IP header:

1 :ICMP6 :TCP17 :UDP

Page 7: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

7IP Routing

Routing TableDestination IP address IP address of a next-hop router Flags Network interface specification

Application

Transport

Network

Link

Application

Transport

Network

Link

Network

Link

Source Destination

Router

Page 8: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

8ICMP : Internet Control Message Protocol

Used to report problems with delivery of IP Datagrams within an IP network

Used by Ping, Tracerout commands

Types and Codes Echo Request (type=8, code=0) Echo Reply(type=0, code=0) Destination Unreachable(type=3, code=0) Time Exceeded(type=11, code=0) : Time-to-Live =0

ICMP Message

ICMP Data

ICMP Header

IP Header

4bytes20bytes

Type Code Checksum

1byte 1byte 2bytes

Page 9: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

9TCP : Transmission Control Protocol

Connection-Oriented, Reliable, Byte Stream ServiceProtocol

1. Set up connection

2. Transfer data

3. Close connection

0 1 2 3 4 5 6 7 8 9 10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

Source Port Destination Port

Sequence Number

Acknowledgement Number

DataOffset

- - - -

        

        

        

        

        

        

        

        

Window

Checksum Urgent Pointer

Options (0 to 10 Words of 32 Bits)

TCP Payload

 

TCP Header Format

Page 10: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

10TCP : State Diagram

Page 11: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

11TCP : Connection

HostClient

Send SYN seq=x

Receive SYN+ACK segment

Send ACK y+1

Receive SYN segmentSend SYN seq=y, ACK x+1

Receive ACK segment

HostClient

Send FIN seq=x

Receive FIN + ACK segmentSend ACK y+1

Receive FIN segmentSend ACK x+1

Receive ACK segment

Establishing a TCP Connection Closing a TCP Connection

Receive ACK segment

Send FIN seq=y, ACK x+1

Page 12: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

12TCP : Data transfer

HostClient

Send Packet 1Start Timer

Retransmit Packet1Start Timer

Packet should arrive ACK should be sent

ACK would normallyArrive at this time

Receive Packet 1Send AXK 1

Time Expires

Receive ACK 1Cancel Timer

Packet LostTimer

Timer

Page 13: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

13HTTP : Hyper Text Transfer Protocol

Stateless Transaction ProtocolEach transaction creates a new connection

Steps in Transaction1. Establish connection2. Request

Method <URL> <CR>3. Response

Response Code <Data> <CR>4. Close connection

Page 14: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

14HTTP

Common Request MethodsGET, PUT, POST

Response CategoriesInformational :100Successful :200Redirection :300Client Error :400 (eg. 404 Not found)Server Error :500

Page 15: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

15Example: Access www.ee.ucla.edu

Http requestGET “http://www.ee.ucla.edu”<CR>

Http response200 “” <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

send data to next hop

Appl

HTTP

Transp

TCP

NetIP

Linkethernet

Close connection (hdshk)

Relay data

Client Server

Router(s)

NetIP

Linkethernet

Appl

HTTP

Transp

TCP

NetIP

Linkethernet

ARP to provide IP/MAC translation

Page 16: 1 Introduction to TCP/IP. 2 OSI and Protocol Stack OSI: Open Systems Interconnect OSI ModelTCP/IP HierarchyProtocols 7 th Application Layer 6 th Presentation

16References

“TCP/IP Illustrated, Volume 1 The Protocols “by W. Richard Stevens (http://yenigul.net/tcpip)

“Internet Working with TCP/IP Volume 1” by Douglas E. Comer

“Sams Teach Yourself TCP/IP in 24 Hours”by Joe Casad. Published by Sams. (http://www.informit.com)