Chap 11 udp

32
TCP/IP Protocol Suite 1 Chapter 11 Chapter 11 Upon completion you will be able to: User Datagram User Datagram Protocol Protocol Be able to explain process-to-process communication Know the format of a UDP user datagram Be able to calculate a UDP checksum Understand the operation of UDP Know when it is appropriate to use UDP Understand the modules in a UDP package Objectives

description

TCP-IP BY FOROUZAN

Transcript of Chap 11 udp

Page 1: Chap 11 udp

TCP/IP Protocol Suite 1

Chapter 11Chapter 11

Upon completion you will be able to:

User DatagramUser DatagramProtocolProtocol

• Be able to explain process-to-process communication• Know the format of a UDP user datagram• Be able to calculate a UDP checksum• Understand the operation of UDP• Know when it is appropriate to use UDP • Understand the modules in a UDP package

Objectives

Page 2: Chap 11 udp

TCP/IP Protocol Suite 2

Figure 11.1 Position of UDP in the TCP/IP protocol suite

Page 3: Chap 11 udp

TCP/IP Protocol Suite 3

11.1 PROCESS-TO-PROCESS COMMUNICATION

Before we examine UDP, we must first understand host-to-host Before we examine UDP, we must first understand host-to-host communication and process-to-process communication and the communication and process-to-process communication and the difference between them.difference between them.

The topics discussed in this section include:The topics discussed in this section include:

Port NumbersPort NumbersSocket AddressesSocket Addresses

Page 4: Chap 11 udp

TCP/IP Protocol Suite 4

Figure 11.2 UDP versus IP

Page 5: Chap 11 udp

TCP/IP Protocol Suite 5

Figure 11.3 Port numbers

Page 6: Chap 11 udp

TCP/IP Protocol Suite 6

Figure 11.4 IP addresses versus port numbers

Page 7: Chap 11 udp

TCP/IP Protocol Suite 7

Figure 11.5 ICANN ranges

Page 8: Chap 11 udp

TCP/IP Protocol Suite 8

The well-known port numbers are less than 1024.

Note:Note:

Page 9: Chap 11 udp

TCP/IP Protocol Suite 9

Table 11.1 Table 11.1 Well-known ports used with UDPWell-known ports used with UDP

Page 10: Chap 11 udp

TCP/IP Protocol Suite 10

In UNIX, the well-known ports are stored in a file called /etc/services. Each line in this file gives the name of the server and the well-known port number. We can use the grep utility to extract the line corresponding to the desired application. The following shows the port for TFTP. Note TFTP can use port 69 on either UDP or TCP.

Example 1

See Next Slide

$ grep tftp /etc/services tftp 69/tcp tftp 69/udp

Page 11: Chap 11 udp

TCP/IP Protocol Suite 11

SNMP uses two port numbers (161 and 162), each for a different purpose, as we will see in Chapter 21.

Example 1 (Continued)

$ grep snmp /etc/services snmp 161/tcp #Simple Net Mgmt Proto snmp 161/udp #Simple Net Mgmt Proto snmptrap 162/udp #Traps for SNMP

Page 12: Chap 11 udp

TCP/IP Protocol Suite 12

Figure 11.6 Socket address

Page 13: Chap 11 udp

TCP/IP Protocol Suite 13

11.2 USER DATAGRAM

UDP packets are called user datagrams and have a fixed-size header of 8 UDP packets are called user datagrams and have a fixed-size header of 8 bytes.bytes.

Page 14: Chap 11 udp

TCP/IP Protocol Suite 14

Figure 11.7 User datagram format

Page 15: Chap 11 udp

TCP/IP Protocol Suite 15

UDP length = IP length − IP header’s length

Note:Note:

Page 16: Chap 11 udp

TCP/IP Protocol Suite 16

11.3 CHECKSUM

UDP checksum calculation is different from the one for IP and ICMP. UDP checksum calculation is different from the one for IP and ICMP. Here the checksum includes three sections: a pseudoheader, the UDP Here the checksum includes three sections: a pseudoheader, the UDP header, and the data coming from the application layer.header, and the data coming from the application layer.

The topics discussed in this section include:The topics discussed in this section include:

Checksum Calculation at SenderChecksum Calculation at SenderChecksum Calculation at ReceiverChecksum Calculation at ReceiverOptional Use of the ChecksumOptional Use of the Checksum

Page 17: Chap 11 udp

TCP/IP Protocol Suite 17

Figure 11.8 Pseudoheader for checksum calculation

Page 18: Chap 11 udp

TCP/IP Protocol Suite 18

Figure 11.9 Checksum calculation of a simple UDP user datagram

Page 19: Chap 11 udp

TCP/IP Protocol Suite 19

11.4 UDP OPERATION

UDP uses concepts common to the transport layer. These concepts will UDP uses concepts common to the transport layer. These concepts will be discussed here briefly, and then expanded in the next chapter on the be discussed here briefly, and then expanded in the next chapter on the TCP protocol.TCP protocol.

The topics discussed in this section include:The topics discussed in this section include:

Connectionless ServicesConnectionless ServicesFlow and Error ControlFlow and Error ControlEncapsulation and DecapsulationEncapsulation and DecapsulationQueuingQueuingMultiplexing and DemultiplexingMultiplexing and Demultiplexing

Page 20: Chap 11 udp

TCP/IP Protocol Suite 20

Figure 11.10 Encapsulation and decapsulation

Page 21: Chap 11 udp

TCP/IP Protocol Suite 21

Figure 11.11 Queues in UDP

Page 22: Chap 11 udp

TCP/IP Protocol Suite 22

Figure 11.12 Multiplexing and demultiplexing

Page 23: Chap 11 udp

TCP/IP Protocol Suite 23

11.5 USE OF UDP

We discuss some uses of the UDP protocol in this section.We discuss some uses of the UDP protocol in this section.

Page 24: Chap 11 udp

TCP/IP Protocol Suite 24

11.6 UDP PACKAGE

To show how UDP handles the sending and receiving of UDP packets, To show how UDP handles the sending and receiving of UDP packets, we present a simple version of the UDP package. The UDP package we present a simple version of the UDP package. The UDP package involves five components: a control-block table, input queues, a involves five components: a control-block table, input queues, a control-block module, an input module, and an output module. control-block module, an input module, and an output module.

The topics discussed in this section include:The topics discussed in this section include:

Control-Block TableControl-Block TableInput QueuesInput QueuesControl-Block ModuleControl-Block ModuleInput ModuleInput ModuleOutput ModuleOutput Module

Page 25: Chap 11 udp

TCP/IP Protocol Suite 25

Figure 11.13 UDP design

Page 26: Chap 11 udp

TCP/IP Protocol Suite 26

Table 11.2 Table 11.2 The control-block table at the beginning of examplesThe control-block table at the beginning of examples

Page 27: Chap 11 udp

TCP/IP Protocol Suite 27

The first activity is the arrival of a user datagram with destination port number 52,012. The input module searches for this port number and finds it. Queue number 38 has been assigned to this port, which means that the port has been previously used. The input module sends the data to queue 38. The control-block table does not change.

Example 2

Page 28: Chap 11 udp

TCP/IP Protocol Suite 28

After a few seconds, a process starts. It asks the operating system for a port number and is granted port number 52,014. Now the process sends its ID (4,978) and the port number to the control-block module to create an entry in the table. The module takes the first FREE entry and inserts the information received. The module does not allocate a queue at this moment because no user datagrams have arrived for this destination (see Table 11.3).

Example 3

See Next Slide

Page 29: Chap 11 udp

TCP/IP Protocol Suite 29

Table 11.3 Table 11.3 Control-block table after Example 3Control-block table after Example 3

Page 30: Chap 11 udp

TCP/IP Protocol Suite 30

A user datagram now arrives for port 52,011. The input module checks the table and finds that no queue has been allocated for this destination since this is the first time a user datagram has arrived for this destination. The module creates a queue and gives it a number (43). See Table 11.4.

Example 4

See Next Slide

Page 31: Chap 11 udp

TCP/IP Protocol Suite 31

Table 11.4 Table 11.4 Control-block after Example 4Control-block after Example 4

Page 32: Chap 11 udp

TCP/IP Protocol Suite 32

After a few seconds, a user datagram arrives for port 52,222. The input module checks the table and cannot find an entry for this destination. The user datagram is dropped and a request is made to ICMP to send an “unreachable port” message to the source.

Example 5