136
Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS översiktligt.)

Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Embed Size (px)

Citation preview

Page 1: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Datornätverk A – lektion 13

Kapitel 19: Routing.

Kapitel 21: Routing Protocols

Forts. kapitel 22: UDP och TCP.

(Kapitel 23: Congestion control and QoS översiktligt.)

Page 2: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Hosts and Routers• The computers in Internet terminology are called hosts. They usually have one

NIC (network interface card = network adapter = nätverkskort)

• Routers are special purpose computers and they have more than one NIC○ An old name for routers is gateways

○ Forward packets between networks (route and switch)

○ Transform packets as necessary to meet standards for each network

○ A Windows PC can act as a router if it has more than one NIC, and IP forwarding is enabled in the networking settings.

Page 3: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

What Does a Router Do?

• Accepts incoming packets• Checks the destination address in the IP header• Look up for destination in the forwarding table• Sends packet to the appropriate next hop• The packet may be dropped if

○ There is no space in the router’s buffers○ The TTL=0○ There is no matching row in the routing table

Page 4: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Forwarding (Routing) Table

• The forwarding table consists of two columns: “Destination network” and “Next hop”.

• Destination network is some network address and the next hop is the address of the next router.

• When the router is connected directly to a network, the “Next hop” is labeled as “Direct” meaning “Directly connected”

Page 5: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 19.29 Network-specific routing

Page 6: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 19.31 Default routing

Page 7: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Default Route

• In order to make the forwarding table shorter (smaller number of rows) the default route is introduced

• “Default” or “Else” is a row that points to some “Next hop” and is used whenever a destination is not found in the forwarding table.

• Hosts send all packets out of their network to the default router (or gateway)

Page 8: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 19.32 Example: Subnet mask based routing table

Page 9: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example 10Example 10

Using the table in Figure 19.32, the router receives a packet for destination 192.16.7.1. For each row, the mask is applied to the destination address until a match with the destination address is found. In this example, the router sends the packet through interface m0 (host specific).

Page 10: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example 11Example 11

Using the table in Figure 19.32, the router receives a packet for destination 193.14.5.22. For each row, the mask is applied to the destination address until a match with the next-hop address is found. In this example, the router sends the packet through interface m2 (network specific).

Page 11: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example 12Example 12

Using the table in Figure 19.32, the router receives a packet for destination 200.34.12.34. For each row, the mask is applied to the destination address, but no match is found. In this example, the router sends the packet through the default interface m0.

Page 12: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example: Unicast Routing

netid port128.47.92 /24 1128.47.23 /24 2128.47.36 /24 3

13

2

netid port128.47.92 /24 2128.47.23 /24 1128.47.36 /24 2

1

2

Host with IP address 128.47.92.67 sends a packet to host 128.47.23.10

Router R1 checks its table and sends it to R2 through its interface 2.

Router R2 checks its table and sends it to its interface 1

128.47.23.10

128.47.23.00 /24

128.47.36.00 /24

128.47.36.97

128.47.92.67

R2

R1

R3

Page 13: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The Forwarding Table

• Necessary in every host and the router○ On Windows OS it can be seen using the command netstat –rn at

the command prompt○ Entries in the destination column are networks, not hosts○ Once the interface on the router through which the packet is to be

delivered is known, the physical address is used for delivery

• Contains the columns: Destination (Network destination), Mask (Netmask), Next hop (Gateway), Interface and Metric

Page 14: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example

Page 15: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

How Routers Build the Routing Tables

• Preprogrammed or Static Routes○ The table is manually configured by a human

○ The routes cannot be dynamically changed if something fails

• Dynamically calculated routes○ Calculated by the software built in the routers that provide

communication among routers

○ Algorithms that calculate shortest path are used

○ Complexity is increased, but the routes change automatically if some part of the network fails

Page 16: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Metric

• A metric is a cost assigned for passing through a network

• The total cost of the path is the sum of the metrics for the networks that are on the path

• Metrics are assigned in such a way that the “best pat” is the path with the minimum total cost

Page 17: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The “Best Path”

• Factors determining the best path○ Bandwidth

○ Delay

○ Hop-count

○ Load

○ Money

○ Reliability

• The cost or the metric can involve a single or several of these factors

S D4

2 1

A B

C

The “best path” from S to D is

A C B

Page 18: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Interior vs. Exterior Protocols• The worldwide Internet is a very large network

○ It needs to be segmented in areas based upon the entity that administrates the networks and routers in the area

○ Autonomous System (AS) is a collection of networks and routers under single administration authority

• Interior protocols or IGP (Interior Gateway Protocols)○ Used for routing inside AS

• Exterior protocols or EGP (Exterior Gateway Protocols)○ Used for routing between ASs

Page 19: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 21.3 Autonomous systems

Page 20: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 21.5 Initial routing tables in a small autonomous system

Page 21: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 21.6 Final routing tables for Figure 21.5

Page 22: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Interior Routing Protocols

• The goal: To choose the best path, among a set of alternatives based on some or a combination of criteria (e. g. minimum delay, maximum throughput etc.)

• The objectives are to use the network resources (bandwidth and the router’s buffers and processing power) in the best way

• Two groups of interior protocols○ Distance Vector protocols○ Link State protocols

Page 23: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 21.2 Popular routing protocols

RIP = Routing Information ProtocolOSPF = Open Shortest Path FirstBGP = Boarder Gateway Protocol

Page 24: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Unicast vs. Multicast

• Unicast: ○ One source to one destination

• Multicast: ○ One source to many destinations

○ Many sources to many destinations

○ Many sources to one destination

• Motivation for multicast routing○ Growing demand (vide/audio conferences, vide streaming etc)

○ Bandwidth need to be saved

Page 25: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example

• If unicast routing is used, the links between the sender and the Router 1 will be overloaded (bandwidth required will depend on the number of receivers)

Sender

Router 2

Receiver 1

Receiver 2

Receiver 3

Router 1

Router 3

Page 26: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 21.23 Multicasting

Page 27: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Group Membership vs. Multicast Routing

• IGMP (Internet Group Management Protocol)○ Keeps router up-to-date with group membership of entire LAN○ A device can join or leave a group at any moment

• Multicast Routing Protocols○ MBone – A set of routers on the Internet that are running multicast

routing protocols○ Tunneling (encapsulation of multicast packets into unicast packets)

is used in the rest of the network

Page 28: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

In multicast routing, the router may forward the received packet through

several of its ports.

NoteNote::

Page 29: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

IGMP is a group management protocol. It helps a multicast router

create and update a list of loyal members related to each router

interface.

NoteNote::

Page 30: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 21.32 MBONE

Page 31: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Transport LayerTransport Layer

PART VPART V

Page 32: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Position of transport layer

Page 33: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Transport layer duties

Page 34: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Chapters

Chapter 22 Process-to-Process Delivery

Chapter 23 Congestion Control and QoS

Page 35: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Chapter 22

Process-to-ProcessDelivery:

UDP and TCP

Page 36: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The transport layer is responsible for process-to-process delivery.

NoteNote::

Page 37: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.1 Types of data deliveries

Page 38: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Virtual Connection at the Transport Layer

TCP, UDP

IP

Application

Physical

IP

Physical

IP

Physical

Router RouterHost Host

TCP, UDP

IP

Application

Physical

Protocol stack in the host

Protocol stack in the host

Protocol stack in the router

Page 39: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.5 Socket address

A socket is a data flow between two processes that is identified by its socket address pair, i.e. a unique combination of:- Transport protocol (UDP or TCP).- Source IP address and port number.- Destination IP address and port number.

Page 40: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.7 Connection establishment

Page 41: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.8 Connection termination

Page 42: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Client-Server Paradigm

• Used most often in Internet process-to-process communication, for example, email, web, file transfer, etc.

• The client process initiates the communication.

• The server process waits for the client to initiate communication, and responds by sending the information required. Example: Web server, email server, ftp server, etc.

• A firewall often stops external clients from accessing internal servers, except certain web

• Opposite: Peer-to-peer communication, where a program can act both as client (taking initiative) and server (responding to other).

Page 43: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Multiplexing and Demultiplexing

Web Email MP3

TCP UDP

IP

Web Email MP3

TCP UDP

IP

IP datagrams IP datagrams

Sender processes Receiver processes

Page 44: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Connection-oriented vs. Conectionless

• A connection-oriented service requires both sender and receiver to create a connection before any data is transferred○ TCP provides connection oriented service to the applications

• A connectionless service does not create a connection first but simply sends the data○ UDP provides connectionless service to the applications

Page 45: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example: Connection-oriented Service

• An analogy to the connection-oriented service is telephone conversation

Page 46: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example: Connectionless Service

• An analogy to connectionless service is the delivery of the mail

Page 47: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Data-link vs. Transport Layer

• Data link layer○ Responsibile for reliability between two directly connected points

• Transport layer○ Resposibe for reliability over the internetwork

Network 1

Network 2

Network 3

Internetwork

Duties of the transport layerDuties of the data-link layer Duties of the data-link layer

Duties of the data-link layer

Page 48: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Reliable vs. Unreliable

• Transport layer can offer○ Unreliable service (UDP)

• No guarantee that the packet will be delivered to the destination

• Useful especially for transmitting audio and video files where waiting for acknowledgement can be annoying for the user

○ Reliable service (TCP)

• Connection establishment

• Connection maintenance

• Connection termination

Page 49: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

User Datagram Protocol (UDP)

• No reliability or connection management!

• Serves solely as a labeling mechanism for demultiplexing at the receiver end

• Use predominantly by protocols that do no require the strict service guarantees offered by TCP (e.g. real-time multimedia protocols)

• Additional intelligence built at the application layer if needed

Page 50: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Transmission Control protocol (TCP)

• Provides a connection-oriented end-to-end (user-to-user) reliable byte stream service in both directions (full duplex)

• Divides a byte stream into a sequence of segments and sends them to the destination via IP

• Uses the destination port, source port to identify the application to which the segment is sent (multiplexing the sessions)

• Uses sliding window like scheme for flow control and congestion control

Page 51: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Connection Management

• Two way handshake protocol is not enough because of potential delays in either A’s request or B’s responce, as shown below. Possibility of confusion exists.

time time

t1A sends a connection request

t2

t5

t4

t3

A sends connection request again

B receives connection request B establishes a connection and sends an acknowledgement

A B

A receives the acknowledgement and establishes a connection

A and B exchange data and eventually disconnect

B receives connection request B establishes a connection and sends an acknowledgement

Page 52: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Three-way Handshake Protocol for Connection Establishment

time time

t1

A sends a connection request with seq. no. x

t2

t5

t4

t3

A sends connection request again with seq. no. y

B sends acknowledgement y+1 and seq. no. z

A B

A receives the acknowledgement y+1 and sends acknowledgement z+1

B sends acknowledgement x+1 and seq. no. w

A does not send an acknowledgement and no connection is established

t6

The connection is established

Page 53: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Connection Establishment and Termination

• 3-way handshake used for connection establishment

• Randomly chosen sequence number is conveyed to the other end

• Similar FIN, FIN+ACK exchange used for connection termination

SYN

SYN+ACK

ACK

DATA

Server does passive open

Accept connection requestSend acceptance

Start connection

Active openSend connectionrequest

The three-way handshake TCP segments are labeled with SYN. The length of data in the first two is 0

Page 54: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

TCP’s Segments• TCP treats data as a sequence of bytes to be divided and sent in

segments. • The size of the segment depends on the underlying physical network

and on the number of bytes the sender is allowed to send (window size)

• Rather than numbering each segment, TCP stores the sequence number of the data byte in the segment

• The source and the destination each have separate sequence numbers• The acknowledgement numbers are equal to the next expected

sequence number

Page 55: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Window Management in TCP

• Sliding window scheme is used with variable window○ The window can change depending on the traffic in the network

(TCP provides congestion control)

• The size of the window is expressed in bytes instead of packets

• The window size depends on the receiver’s capabilites and the congestion in the network

Page 56: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

TCP Sliding Window

segment 1

100 bytes of data numbered from 1 to 100

100 bytes of data numbered from 101 to 200, ack 801

acknowledge 801

segment 2

acknowledge 901

segment 3acknowledge 201

segment 2

acknowledge 101

segment 1

100 bytes of data numbered from 701 to 800, ack 101

100 bytes of data numbered from 801 to 900, ack 201

Page 57: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

TCP/IP Client-Server Model

• The clent request an unassigned port number from TCP for its own connection.

• It incorrporates randomly chosen port number in the TCP header and the well known port for the particular application. Then it passes the packet to IP

• IP handels the routing of the datagram using source/destination address and delivers the datagram to the destination network and then to the destination host

Page 58: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

TCP/IP Client-Server Model (cont.)

• The datagram is processed and delivered to the TCP layer. TCP processes the segment and delivers the data to the server through its port number

• The server now knows the port number of the client (as it was contained in the TCP header) enabling bidirectional communication

Page 59: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

22.2 22.2 UDPUDP

Port Numbers

User Datagram

Applications

Page 60: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

UDP is a connectionless, unreliable protocol that has no flow and error

control. It uses port numbers to multiplex data from the application

layer.

NoteNote::

Page 61: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Table 22.1 Table 22.1 Well-known ports used by UDPWell-known ports used by UDP

Port Protocol Description

    7 Echo Echoes a received datagram back to the sender

    9 Discard Discards any datagram that is received

  11 Users Active users

  13 Daytime Returns the date and the time

  17 Quote Returns a quote of the day

  19 Chargen Returns a string of characters

  53 Nameserver Domain Name Service

  67 Bootps Server port to download bootstrap information

  68 Bootpc Client port to download bootstrap information

  69 TFTP Trivial File Transfer Protocol

111 RPC Remote Procedure Call

123 NTP Network Time Protocol

161 SNMP Simple Network Management Protocol

162 SNMP Simple Network Management Protocol (trap)

Page 62: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.10 User datagram format

Page 63: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The calculation of checksum and its inclusion in the user datagram are

optional.

NoteNote::

Page 64: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

UDP is a convenient transport-layer protocol for applications that provide flow and error control. It is also used

by multimedia applications.

NoteNote::

Page 65: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

22.3 22.3 TCPTCP

Port Numbers

Services

Sequence Numbers

Segments

Connection

Transition Diagram

Flow and Error Control

Silly Window Syndrome

Page 66: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Table 22.2 Table 22.2 Well-known ports used by TCPWell-known ports used by TCPPort Protocol Description

   7 Echo Echoes a received datagram back to the sender

    9 Discard Discards any datagram that is received

  11 Users Active users

  13 Daytime Returns the date and the time

  17 Quote Returns a quote of the day

  19 Chargen Returns a string of characters

  20 FTP, Data File Transfer Protocol (data connection)

  21 FTP, Control File Transfer Protocol (control connection)

  23 TELNET Terminal Network

  25 SMTP Simple Mail Transfer Protocol

  53 DNS Domain Name Server

  67 BOOTP Bootstrap Protocol

  79 Finger Finger

  80 HTTP Hypertext Transfer Protocol

111 RPC Remote Procedure Call

Page 67: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.11 Stream delivery

Page 68: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.12 Sending and receiving buffers

Page 69: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.13 TCP segments

Page 70: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Example 1Example 1

Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010. What are the sequence numbers for each segment if data are sent in five segments with the first four segments carrying 1000 bytes and the last segment carrying 2000 bytes?

SolutionSolution

The following shows the sequence number for each segment: Segment 1 ==> sequence number: 10,010 (range: 10,010 to 11,009) Segment 2 ==> sequence number: 11,010 (range: 11,010 to 12,009) Segment 3 ==> sequence number: 12,010 (range: 12,010 to 13,009) Segment 4 ==> sequence number: 13,010 (range: 13,010 to 14,009) Segment 5 ==> sequence number: 14,010 (range: 14,010 to 16,009)

Page 71: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a

randomly generated number.

NoteNote::

Page 72: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The value of the sequence number field in a segment defines the number of the first data byte contained in that

segment.

NoteNote::

Page 73: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The value of the acknowledgment field in a segment defines the number of the

next byte a party expects to receive. The acknowledgment number is

cumulative.

NoteNote::

Page 74: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.14 TCP segment format

Page 75: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.15 Control field

Page 76: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Table 22.3 Table 22.3 Description of flags in the control fieldDescription of flags in the control field

Flag Description

URG The value of the urgent pointer field is valid.

ACK The value of the acknowledgment field is valid.

PSH Push the data.

RST The connection must be reset.

SYN Synchronize sequence numbers during connection.

FIN Terminate the connection.

Page 77: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.16 Three-step connection establishment

Page 78: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.17 Four-step connection termination

Page 79: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Table 22.4 Table 22.4 States for TCPStates for TCP

State Description

CLOSED There is no connection.

LISTEN The server is waiting for calls from the client.

SYN-SENT A connection request is sent; waiting for acknowledgment.

SYN-RCVD A connection request is received.

ESTABLISHED Connection is established.

FIN-WAIT-1 The application has requested the closing of the connection.

FIN-WAIT-2 The other side has accepted the closing of the connection.

TIME-WAIT Waiting for retransmitted segments to die.

CLOSE-WAIT The server is waiting for the application to close.

LAST-ACK The server is waiting for the last acknowledgment.

Page 80: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.18 State transition diagram

Page 81: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

A sliding window is used to make transmission more efficient as well as to control the flow of data so that the

destination does not become overwhelmed with data. TCP’s sliding

windows are byte-oriented.

NoteNote::

Page 82: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.19 Sender buffer

Page 83: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.20 Receiver window

Page 84: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.21 Sender buffer and sender window

Page 85: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.22 Sliding the sender window

Page 86: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.23 Expanding the sender window

Page 87: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.24 Shrinking the sender window

Page 88: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

In TCP, the sender window size is totally controlled by the receiver

window value (the number of empty locations in the receiver buffer).

However, the actual window size can be smaller if there is congestion in the

network.

NoteNote::

Page 89: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Some points about TCP’s sliding windows:

NoteNote::

The source does not have to send a full The source does not have to send a full window’s worth of data.window’s worth of data.

The size of the window can be increased or The size of the window can be increased or decreased by the destination.decreased by the destination.

The destination can send an acknowledgment at any time.

Page 90: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.25 Lost segment

Page 91: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.26 Lost acknowledgment

Page 92: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 22.27 TCP timers

Page 93: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Chapter 23

Congestion Controland

Quality of Service

Page 94: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.1 Data Traffic23.1 Data Traffic

Traffic Descriptor

Traffic Profiles

Page 95: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.1 Traffic descriptors

Page 96: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.2 Constant-bit-rate traffic

Page 97: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.3 Variable-bit-rate traffic

Page 98: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.4 Bursty traffic

Page 99: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.2 Congestion23.2 Congestion

Network Performance

Page 100: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.5 Incoming packet

Page 101: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.6 Packet delay and network load

Page 102: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.7 Throughput versus network load

Page 103: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.3 Congestion Control23.3 Congestion Control

Open LoopOpen Loop

Closed Loop

Page 104: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.4 Two Examples23.4 Two Examples

Congestion Control in TCP

Congestion Control in Frame Relay

Page 105: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

TCP assumes that the cause of a lost segment is due to congestion

in the network.

NoteNote::

Page 106: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

If the cause of the lost segment is congestion, retransmission of the

segment does not remove the cause—it aggravates it.

NoteNote::

Page 107: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.8 Multiplicative decrease

Page 108: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.9 BECN

Page 109: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.10 FECN

Page 110: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.11 Four cases of congestion

Page 111: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.5 Quality of Service23.5 Quality of Service

Flow Characteristics

Flow Classes

Page 112: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.6 Techniques to Improve QoS23.6 Techniques to Improve QoS

Scheduling

Traffic Shaping

Resource Reservation

Admission Control

Page 113: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.12 Flow characteristics

Page 114: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.13 FIFO queue

Page 115: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.14 Priority queuing

Page 116: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.15 Weighted fair queuing

Page 117: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.16 Leaky bucket

Page 118: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.17 Leaky bucket implementation

Page 119: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

A leaky bucket algorithm shapes bursty traffic into fixed-rate traffic by averaging the data rate. It may drop

the packets if the bucket is full.

NoteNote::

Page 120: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.18 Token bucket

Page 121: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

The token bucket allows bursty traffic at a regulated maximum rate.

NoteNote::

Page 122: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.7 Integrated Services23.7 Integrated Services

Signaling

Flow Specification

Admission

Service Classes

RSVP

Page 123: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Integrated Services is a flow-based QoS model designed for IP.

NoteNote::

Page 124: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.19 Path messages

Page 125: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.20 Resv messages

Page 126: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.21 Reservation merging

Page 127: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.22 Reservation styles

Page 128: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.8 Differentiated Services23.8 Differentiated Services

An Alternative to An Alternative to Integrated ServicesIntegrated Services

Page 129: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Differentiated Services is a class-based QoS model designed for IP.

NoteNote::

Page 130: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.23 DS field

Page 131: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.24 Traffic conditioner

Page 132: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

23.9 QoS in Switched Networks23.9 QoS in Switched Networks

QoS in Frame Relay

QoS in ATM

Page 133: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.25 Relationship between traffic control attributes

Page 134: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.26 User rate in relation to Bc and Bc + Be

Page 135: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.27 Service classes

Page 136: Datornätverk A – lektion 13 Kapitel 19: Routing. Kapitel 21: Routing Protocols Forts. kapitel 22: UDP och TCP. (Kapitel 23: Congestion control and QoS

Figure 23.28 Relationship of service classes to the total capacity