TCP/IP – Part Iisg/INTERNET/SLIDES/Lect… ·  · 2010-08-23TCP/IP – Part I Prof Indranil...

21
1 TCP/IP – Part I Prof Indranil Sengupta Computer Science and Engineering Indian Institute of Technology Kharagpur Indian Institute of Technology Kharagpur Lecture 3 : TCP/IP – Part I On completion, the student will be able to: 1. Explain how the TCP/IP protocol stack functions. 2. Define the basic functionalities of the transport layer protocols TCP and UDP. 3. Define the basic functionalities of the network layer protocol IP. 4. Explain the various header fields in IP packets, and their functions.

Transcript of TCP/IP – Part Iisg/INTERNET/SLIDES/Lect… ·  · 2010-08-23TCP/IP – Part I Prof Indranil...

1

TCP/IP – Part I

Prof Indranil SenguptaComputer Science and Engineering

Indian Institute of TechnologyKharagpur

Indian Institute of Technology Kharagpur

• Lecture 3: TCP/IP – Part IOn completion, the student will be able to:

1. Explain how the TCP/IP protocol stack functions.2. Define the basic functionalities of the transport layer protocols TCP and UDP.3. Define the basic functionalities of the network layer protocol IP.4. Explain the various header fields in IP packets, and their functions.

2

Introduction

• TCP/IP is the first set of protocols used in Internet.

• Allows computers to communicate / share resources across a network.

• Work on TCP/IP started in the 1970s.Funded by US Military.Advanced Research Project Agency (ARPA).Network protocols of ARPANET were upgraded.

TCP/IP and the Internet

• The modern Internet sits on top of the TCP/IP technology.

Used as a standard.To bridge the gap between non-compatible platforms.All computers connected to the Internet understands TCP/IP.

3

Network Layering in TCP/IP

• In 1978, International Standards Organization (ISO) proposed a 7-layer reference model for network services and protocols.

Known as the OSI model.TCP/IP does not strictly follow this 7-layer model.TCP/IP follows a simplified 4-layer model.

Why Layering ?

• To provide well-defined interfaces between adjacent layers.

A change in one layer does not affect the other layers.Interface must remain the same.

• Allows a structured development of network software.

4

The 7-layer OSI Model

Application

Presentation

Session

Transport

Network

Datalink

Physical

Host-to-host

Point-to-point

The Simplified 4-layer Model

Application

Transport

Network

Datalink Frame transmission over link

Packet delivery across Internet

End-to-end message transfer

Runs on top of layers 1,2 and 3

5

Data Flow in 4-layer Model

Application

Transport

Network

Datalink

Application

Transport

Network

Datalink

Network

Datalink

A B C

TCP/IP Protocol Suite

• Refers to a family of protocols.• The protocols are built on top of

connectionless technology.Data sent from one node to another as a sequence of datagrams.Each datagram sent independently.The datagrams corresponding to the same message may follow different routes.

Variable delay, arrival order at destination.

6

TCP/IP Family Members

Datalink and Hardware Layer(e.g., Ethernet)

Internet Protocol (IP) ICMP IGMP ARP RARP

Transmission ControlProtocol (TCP)

User DatagramProtocol (UDP)

FTP TFTP SMTP SNMP DNSUser

Process

Typical Scenario

Datalink and Hardware Layer(e.g., Ethernet)

IP

TCP UDP

UserProcess

UserProcess

7

What does IP do?

• IP transports datagrams (packets) from the source node to the destination node.

Responsible for routing the packets.Breaks a packet into smaller packets, if required.Unreliable service.

A packet may be lost in transit.Packets may arrive out of order.Duplicate packets may be generated.

What does TCP do?

• TCP provides a connection-oriented, reliable service for sending messages.

Split a message into packets.Reassemble packets at destination.Resend packets that were lost in transit.

• Interface with IP:Each packet forwarded to IP for delivery.Error control is done by TCP.

8

What does UDP do?

• UDP provides a connectionless, unreliable service for sending datagrams (packets).

Messages small enough to fit in a packet (e.g., DNS query).Simpler (and faster) than TCP.Never split data into multiple packets.Does not care about error control.

• Interface with IP:Each UDP packet sent to IP for delivery.

Addresses in TCP/IP

Ethernet Layer

IP

TCP UDP

UserProcess

UserProcess

Physical Address (48 bits)

Internet Address (32 bits)

Port Address (16 bits)

9

Encapsulation

• Basic concept:As data flows down the protocol hierarchy, headers (and trailers) get appended to it.As data moves up the hierarchy, headers (and trailers) get stripped off.

• An example to illustrate:Trivial file transfer protocol (TFTP).TFTP client transfers 200 bytes of data.4 bytes of TFTP header gets added.

TFTP over Ethernet

TFTP client

UDP

IP

Ethernet

TFTP server

UDP

IP

Ethernet

10

Encapsulation in TFTP

Data

Data

Data

Data

Data

H-TFTP

H-TFTP

H-TFTP

H-TFTP

H-UDP

H-UDP

H-UDP

H-IP

H-IPH-Eth T-Eth

14 20 8 4 200 4

TFTP message

UDP packet

IP packet

Ethernet frame

IP Datagrams

11

The IP Layer

• IP layer provides a connectionless, unreliable delivery system for packets.

Mentioned before.• Each packet is independent of one

another.IP layer need not maintain any history.Each IP packet must contain the source and destination addresses.

The IP Layer (contd.)

IP layer does not guarantee delivery of packets.

• IP layer encapsulationReceives a data chunk from the higher layer (TCP or UDP).Prepends a header of minimum 20 bytes.

Containing relevant information for handling routing and flow control.

12

Illustration

Data

Data20 bytes IP header

Format of IP Datagram

Total Length

Identification

Service typeVER HLEN

Fragment Offset

Time to Live Protocol

Flags

Header Checksum

Source IP Address

Destination IP Address

Options

DATA

-------HEA

DER

--------

0 4 8 15 16 31

13

IP Header Fields

• VER (4 bits)Version of the IP protocol in use (typically 4).

• HLEN (4 bits)Length of the header, expressed as the number of 32-bit words.Minimum size is 5, and maximum 15.

• Total Length (16 bits)Length in bytes of the datagram, including headers.Maximum datagram size :: 216 = 65536 bytes.

IP Header Fields (contd.)

• Service Type (8 bits)Allows packet to be assigned a priority.Router can use this field to route packets.Not universally used.

• Time to Live (8 bits)Prevents a packet from traveling in a loop.Senders sets a value, that is decremented at each hop. If it reaches zero, packet is discarded.

• Protocol (8 bits)Identifies the higher layer protocol being used.

14

IP Header Fields (contd.)

• Source IP address (32 bits)Internet address of the sender.

• Destination IP address (32 bits)Internet address of the destination.

• Identification, Flags, Fragment OffsetUsed for handling fragmentation.To be discussed later.

• Options (variable width)Can be given provided router supports.Source routing, for example.

IP Header Fields (contd.)

• Header Checksum (16 bits)Covers only the IP header.How computed?

Header treated as a sequence of 16-bit integers.The integers are all added using ones complement arithmetic.Ones complement of the final sum is taken as the checksum.

A mismatch in checksum causes the datagram to be discarded.

15

SOLUTIONS TO QUIZ QUESTIONS ON

LECTURE 2

16

Quiz Solutions on Lecture 2

1. With respect to speed of data transfer, which of LAN or WAN is faster?

LAN

2. What is the typical speed of a modern Ethernet backbone LAN?

1 to 10 Gbps

Quiz Solutions on Lecture 2

3. Why is circuit switching not suitable for computer-to-computer traffic?

Because computer traffic is bursty in nature. Link utilization is poor.

4. What are the three steps that are required for data communication using circuit switching?

Connection establishment, data transfer, and connection termination.

17

Quiz Solutions on Lecture 2

5. With respect to sharing of links, which of circuit switching or packet switching is more suitable?

Packet switching.

6. Among virtual circuit and datagram, which approach requires less information in the packet header?

Virtual circuit.

Quiz Solutions on Lecture 2

7. Which of virtual circuit and datagram makes better utilization of the links?

Datagram.

8. Which of virtual circuit and datagram will guarantee ordered delivery of packets in the absence of any errors?

Virtual circuit.

18

Quiz Solutions on Lecture 2

9. Under what circumstances will the datagram method of packet delivery prove useful?

Small messages, reliable network.

10. Five packets need to be sent from a host A to another host B. Which of virtual circuit or datagram would be faster?

Datagram.

Quiz Solutions on Lecture 2

11. For a 5 Kbytes packets sent over a 10 Mbps transmission link, what is the transmission time of the packet?

(5K x 8) / 10M = 4 msec

12. A 600-byte packet is sent over a 20 Kbps point-to-point link whose propagation delay is 10 msec. After how much delay will the packet reach the destination?

10 msec + (600 x 8) / 20K = 250 msec

19

Quiz Solutions on Lecture 2

13. Which layers in the OSI model are host-to-host layers?

Transport, Session, Presentation, Application

14. What is the responsibility of the network layer in the OSI model?

To route packets from one node to another on its way to the final destination.

Quiz Solutions on Lecture 2

15. What is the responsibility of the data link layer in the OSI model?

To ensure reliable data transmission over point-to-point links in units of frames.

16. What is the basic difference between a bridge and a router?

Bridge connects LANs, while router connects WANs (with LANs or WANs). Bridge works at datalink layer level, while router works at network layer level.

20

Quiz Questions on Lecture 3

1. How many bits are there in the IP address?

2. How many bits are there in the Ethernet address?

3. What does the Ethernet address signify?4. What does the IP address signify?5. What does the port number signify?6. What does the various layers in the

simplified TCP/IP protocol stack correspond to with respect to the OSI seven-layer model?

Quiz Questions on Lecture 3

7. Why is the transport layer called end-to-end or host-to-host layer?

8. IP is unreliable, and TCP uses IP. How does TCP provide reliable service to the application layer?

9. List two common applications that use UDP.

10. Why is the IP protocol considered unreliable?

11. What does TCP do if the message to be sent is larger that what a single datagram can handle?

21

Quiz Questions on Lecture 3

12. If a 1000 byte data message is sent using TFTP, what will be the size in bytes of the corresponding Ethernet packet?

13. What are the minimum and maximum header sizes of an IP packet?

14. What is the purpose of the “Time to live”field in the IP header?

15. If the IP header is 192 bytes long, what will be the value of the “HLEN” field?

16. What is the maximum size of data that can be accommodated in an IP datagram?

Indian Institute of Technology Kharagpur