• No results found

udp

N/A
N/A
Protected

Academic year: 2020

Share "udp"

Copied!
46
0
0

Loading.... (view fulltext now)

Full text

(1)

Chapter 11

User Datagram

Protocol

(2)

CONTENTS

CONTENTS

PROCESS-TO-PROCESS COMMUNICATION USER DATAGRAM

CHECKSUM

UDP OPERATION USE OF UDP

(3)

Figure 11-1

(4)

PROCESS

TO

PROCESS

COMMUNICATION

(5)

Process to Process

Communication

• UDP is responsible for delivery of the message to the appropriate process

Port Numbers

• Process to Process Communication is achieved through the client server

• Process on local host called client, needs services from the remote host is called

(6)

Figure 11-2

(7)

Process to Process

Communication

For communication we must define • Local host

• Local Process • Remote Host

• Remote Process

• Local and Remote process are identified using port numbers

(8)

Port Numbers

• Client program defines itself with a port number called the ephemeral port number

• Recommended to be greater than 1023 for some client server programs to work properly

(9)

Figure 11-3

(10)

Figure 11-4

(11)

Figure 11-5

(12)

Well known ports: Controlled by ICANN. Well know port numbers are less than 1024

Registered Ports: Not Controlled by

ICANN but they can only register with ICANN to prevent duplication

Dynamic Ports: Used Temporary or

(13)

Well Known Ports

• Port Protocol 7 Echo

9 Discard 13 DayTime 67 Bootps 68 Bootpc 60 TFTP .

(14)

Figure 11-6

(15)

Socket Addresses

• UDP needs two identifiers IP address and port number at each end to make a connection

• Combination of IP address and a port number is called a socket address

• Client socket address defines the client process uniquely just as the server socket address defines the server process uniquely

(16)

USER

DATAGRAM

(17)

Figure 11-7

(18)

User Datagram

Source Port Number: Port number used by the process running on the source host.

• 16 bits long, source port number ranges from 0 to 65,535 • Source host is the client- ephemeral port number

Source host is the server-Well known port number

Destination Port Number : Port number used by the process running on the destination host

• 16 bits long ,Destination host is the client – Ephemeral port number

Destination host is the server-Well known port number

Length – 16 bit field that defines the total length of the user datagram plus data. 16 bits can define a total length of 0 to 65,535 bytes

(19)

UDP length

UDP length 

IP length

(20)

CHECKSUM

(21)

• Checksum includes three secttions: pseudoheader, UDP header and the data coming from the application layer

Pseudoheader is the part of the header of the IP packet in which the user datagram is encapsulated with some fields filled with 0s • Protocol field is added to ensure that the

(22)

Checksum

Sender:

1. Add the pseudo header to the UDP user datagram 2. Fill the checksum field with 0’s

3. Divide the total bits into 16 bit words

4. If the total number of bytes is not even add 1 byte of padding(all 0’s)

5. Add all 16 bit sections using 1’s complement arithmetic 6. Complement the result and insert it in the checksum

field

7. Drop the pseudo header and any padding

(23)

Checksum

• Receiver:

1. Add the pseudo header to the UDP user datagram

2. Add padding if needed

3. Divide the total bits into 16 bit sections

4. Add all 16 bit sections using one’s complement arithmetic

5. Complement the result

(24)

Figure 11-8

(25)

Figure 11-9

(26)

UDP

OPERATION

(27)

UDP OPERATION

• Connectionless Services

• Each user datagram sent by UDP will be an independent Datagram

• User datagrams are not numbered

• No Connection Establishment and Connection Termination

• Each user datagram can travel on a different path

(28)

Flow and Error Control

• UDP is a simple, unreliable transport protocol

• No Flow control and no window mechanism. Receiver may overflow with incoming messages

• No error control mechanism in UDP except checksum

(29)

Figure 11-10

(30)

Figure 11-11

(31)

Queues in UDP

• If a process wants to communicate with multiple processes it obtains only one port number one outgoing queue and one incoming queue

• Queues opened by the client can be identified by ephemeral port numbers

• Client process can send messages to the outgoing queue by using the source port number specified in the request

• UDP removes messages one by one and after adding UDP header delivers them to IP

(32)

Queues in UDP

• Server asks for incoming and outgoing queue using well known port when it starts running

• When a message arrives for server UDP checks to see if an incoming queue has been created for the port number specified in the destination port field

(33)

Figure 11-12

(34)

Multiplexing :

• UDP accepts messages from different processes differentiated by their assigned port numbers

Demultiplexing:

(35)

USE

OF UDP

(36)

USE of UDP

• Suitable for a process that requires simple request response communication

• Suitable for a process with internal flow and error control mechanisms

• Suitable transport protocol for multicasting

• Used for management processes such as SNMP

(37)

UDP

PACKAGE

(38)

Figure 11-13

(39)

State

State Process IDProcess ID Port NumberPort Number Queue NumberQueue Number

--- ------ ------ ---

---IN-USE 2,345 52,010 34

IN-USE 3,422 52,011 FREE

IN-USE 4,652 52,012 38

FREE

(40)

Example 1

Example 1

(41)

Example 2

Example 2

(42)

State

State Process IDProcess ID Port NumberPort Number Queue NumberQueue Number

--- ------ ------ ---

---IN-USE 2,345 52,010 34

IN-USE 3,422 52,011

IN-USE 4,978 52,014

IN-USE 4,652 52,012 38

FREE

(43)

Example 3

Example 3

(44)

State

State Process IDProcess ID Port NumberPort Number Queue NumberQueue Number

--- ------ ------ ---

---IN-USE 2,345 52,010 34

IN-USE 3,422 52,011 43

IN-USE 4,978 52,014

IN-USE 4,652 52,012 38

FREE

(45)

Example 4

Example 4

(46)

Example 5

Example 5

References

Related documents

(ICMP Type 3) Port is filtered comes from firewall type devices – this packet UDP Packet returns from target port Port is open. Nothing returns Port is Open/Filtered -

• outgoing, incoming messages stored on server user mailbox outgoing message queue mail server user agent user agent user agent mail server user agent user agent mail server

DNS (Domain Name Server) client to server lookup 53 TCP/UDP DHCP Client (Dynamic Host Configuration Protocol) 67 TCP DHCP Server (Dynamic Host Configuration Protocol) 68 TCP

To identify the UDP port number to which the SNMP agent listens, use the snmp-server udp-port command. See snmp-server udp-port, page 7-7, for

iPhone mail client outgoing, incoming user mailbox outgoing message queue mail server mail server mail server SMTP SMTP SMTP user agent user agent user agent user

v  example 1: block incoming and outgoing datagrams with IP protocol field = 17 and with either source or dest port = 23. §  result: all incoming, outgoing UDP flows and telnet

Characters may be received is protocol connections are not guarantee the network layer protocol that chooses which data arrives then secured using a subnetwork connected with udp

pass in on $ext proto tcp from any to $server port 22 queue (other, high) pass in on $int proto tcp from any to any port 22 queue (other, high) # allow other incoming services. pass