Вы находитесь на странице: 1из 21

Indian Institute of Technology Kharagpur

TCP/IP – Part I
Prof Indranil Sengupta
Computer Science and Engineering
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.

1
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.

2
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.

3
The 7-layer OSI Model

Application

Presentation
Host-to-host
Session

Transport

Network

Datalink Point-to-point
Physical

The Simplified 4-layer Model

Application Runs on top of layers 1,2 and 3

Transport End-to-end message transfer

Network Packet delivery across Internet

Datalink Frame transmission over link

4
Data Flow in 4-layer Model

Application Application

Transport Transport

Network Network Network

Datalink Datalink 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.

5
TCP/IP Family Members

User
FTP TFTP SMTP SNMP DNS Process

Transmission Control User Datagram


Protocol (TCP) Protocol (UDP)

Internet Protocol (IP) ICMP IGMP ARP RARP

Datalink and Hardware Layer


(e.g., Ethernet)

Typical Scenario
User User
Process Process

TCP UDP

IP

Datalink and Hardware Layer


(e.g., Ethernet)

6
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.

7
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
User User
Process Process

Port Address
TCP UDP (16 bits)

IP Internet Address
(32 bits)

Physical Address
Ethernet Layer
(48 bits)

8
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 TFTP server

UDP UDP

IP IP

Ethernet Ethernet

9
Encapsulation in TFTP

Data

H-TFTP Data TFTP message

H-UDP H-TFTP Data UDP packet

H-IP H-UDP H-TFTP Data IP packet

H-Eth H-IP H-UDP H-TFTP Data T-Eth Ethernet


frame
14 20 8 4 200 4

IP Datagrams

10
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 encapsulation
¾Receives 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.

11
Illustration

Data

20 bytes IP header Data

Format of IP Datagram
0 4 8 15 16 31
VER HLEN Service type Total Length
-------HEADER--------

Identification Flags Fragment Offset


Time to Live Protocol Header Checksum
Source IP Address
Destination IP Address

Options

DATA

12
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.

13
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 Offset
¾Used 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.

14
SOLUTIONS TO QUIZ
QUESTIONS ON
LECTURE 2

15
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.

16
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.

17
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

18
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.

19
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?

20
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

21

Вам также может понравиться