Chapter 11 User Datagram Protocol Objectives Upon completion
Chapter 11 User Datagram Protocol Objectives Upon completion you will be able to: • 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 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 1
CONTENTS • • • PROCESS-TO-PROCESS COMMUNICATION USER DATAGRAM CHECKSUM UDP OPERATION USE OF UDP PACKAGE Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 2
TCP/IP 프로토콜에서 UDP의 위치 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 3
11. 1 PROCESS-TO-PROCESS COMMUNICATION Before we examine UDP, we must first understand host-to-host communication and process-to-process communication and the difference between them. The topics discussed in this section include: Port Numbers Socket Addresses Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 5
11. 1 프로세스-대-프로세스 통신 <UDP 대 IP Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 6
11. 1 프로세스-대-프로세스 통신 < 포트 번호 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 10
11. 1 프로세스-대-프로세스 통신 < IP 주소 대 포트 번호 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 11
11. 1 프로세스-대-프로세스 통신 < IANA(Internet Assigned Numbers Authority) 범위 Ü 잘 알려진 포트 : 0 ~ 1, 023 Ü 등록된 포트(registered port) : 1, 024 ~ 49, 151 Ü 동적 포트(dynamic port) : 49, 152 ~ 65, 535 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 12
11. 1 프로세스-대-프로세스 통신 Note: The well-known port numbers are less than 1024. Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 13
Example 1 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. $ grep tftp /etc/services tftp 69/tcp tftp 69/udp Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 15
Example 1 SNMP uses two port numbers (161 and 162), each for a different purpose, as we will see in Chapter 21. $ grep snmp /etc/services snmp 161/tcp snmp 161/udp snmptrap 162/udp Http: //netwk. hannam. ac. kr #Simple Net Mgmt Proto #Traps for SNMP HANNAM UNIVERSITY 16
11. 2 USER DATAGRAM UDP packets are called user datagrams and have a fixed-size header of 8 bytes. Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 18
11. 2 사용자 데이터그램 Note: UDP length = IP length − IP header’s length Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 20
11. 3 CHECKSUM UDP checksum calculation is different from the one for IP and ICMP. Here the checksum includes three sections: a pseudoheader, the UDP header, and the data coming from the application layer. The topics discussed in this section include: Checksum Calculation at Sender Checksum Calculation at Receiver Optional Use of the Checksum Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 21
11. 3 검사합 <UDP 헤더에 첨부된 의사 헤더 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 23
11. 3 검사합 < UDP 사용자 데이터그램 검사합 계산 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 25
11. 4 UDP OPERATION UDP uses concepts common to the transport layer. These concepts will be discussed here briefly, and then expanded in the next chapter on the TCP protocol. The topics discussed in this section include: Connectionless Services Flow and Error Control Encapsulation and Decapsulation Queuing Multiplexing and Demultiplexing Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 26
11. 4 UDP 동작 < 캡슐화와 역 캡슐화 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 28
11. 4 UDP 동작 < UDP에서 사용되는 큐(Queue) Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 29
11. 4 UDP 동작 < 다중화와 역 다중화 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 31
11. 5 USE OF UDP We discuss some uses of the UDP protocol in this section. Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 32
11. 6 UDP PACKAGE To show UDP handles the sending and receiving of UDP packets, we present a simple version of the UDP package. The UDP package involves five components: a control-block table, input queues, a controlblock module, an input module, and an output module. The topics discussed in this section include: Control-Block Table Input Queues Control-Block Module Input Module Output Module Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 34
11. 6 UDP 설계 < UDP 설계 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 36
11. 6 UDP 설계 <제어 블록 번호 알고리즘 Receive: a process ID and a port number. 1. Search the control block table for a FREE entry. 1. If(not found) 1. Delete an entry using a predefined strategy. 2. Create a new entry with the state IN-USE. 3. Enter the process ID and the port number. 2. Return Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 39
11. 6 UDP 설계 < 입력 모듈 알고리즘 Receive: a user datagram from IP 1. Look for the corresponding entry in the control-block table. 1. If(found) 1. Check the queue field to see if a queue is allocated. 1. If(no) 1. Allocate a queue. 2. Enqueue the data in the corresponding queue. 2. If(not found) 1. Ask the ICMP module to send an “unreachable port” message. 2. Discard the user datagram. 2. Return Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 41
11. 6 UDP 설계 < 출력 모듈(output module) Ü 데이터그램을 생성하여 보내는 책임을 가짐 Receive: data and information from a process 1. Create a UDP user datagram. 2. Send the user datagram. 3. Return. Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 42
11. 6 UDP 설계 < 제어 블록 데이터의 초기값 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 43
Example 2 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. Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 44
Example 3 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). Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 45
11. 6 UDP 설계 < 예제 2후에 수정된 테이블 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 46
Example 4 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. Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 47
11. 6 UDP 설계 < 예제 3후에 수정된 테이블 Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 48
Example 5 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. Http: //netwk. hannam. ac. kr HANNAM UNIVERSITY 49
- Slides: 50