Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 The TCP/IP Model. 2 An exchange using the TCP/IP model Datagram Frame Application.

Similar presentations

Presentation on theme: "1 The TCP/IP Model. 2 An exchange using the TCP/IP model Datagram Frame Application."— Presentation transcript:

1 1 The TCP/IP Model

2 2 An exchange using the TCP/IP model Datagram Frame Application

3 3 Type of Addresses in TCP/IP

4 4 Relationship of layers and addresses in TCP/IP MAC Address: 31:5C:BB:63:2A:D1 IP Address: Port number: Well-known port no.: 0 – 1023 Dynamic port no.: 1024 – 65535

5 Some well known port numbers 5

6 6 IP Packet (L3) and Ethernet Frame (L2)

7 7 Port numbers (L4), IP Packet (L3) and Ethernet Frame (L2)

8 8 Transport Layer Process-to-Process Delivery: UDP & TCP

9 9 Transport layer (TL) a)Transport layer: Process-to-Process delivery. (A process is an application/message program running on a host). b)Network layer: source-to-destination delivery (of individual packets to be treated independently). No relationship btw those packets. c)Transport layer ensures that packets belong to an application arrive intact and in order, overseeing both error control and flow control. d)A transport layer protocol can be either: Connectionless: treats each segment as independent packet and delivery to TL at destination host. (UDP) Connection-oriented: TL makes connection with destination host prior to packet delivery. (TCP, SCTP – not covered here) e)A message is usually divided into several segments. UDP treat each segment separately (non-related), while TCP creates a relationship between the segments using sequence numbers. f)Flow and error control in TL is performed end to end.

10 10 Process-to-process Communication

11 11 Position of UDP, TCP, and SCTP in TCP/IP suite

12 12 Transport Layer Addressing using Port Number a)Client/Server paradigm: A process from Client (local host) needs a service from a process running on Server (remote host). b)Since local or remote host can run several processes, need to define: Local host/Local process & Remote host/remote process c)TL addressing using Port number (16 bit: 0 to 65535) To choose among multiple processes running on destination host. destination port number – delivery / Source port number – for reply. d)Client port number can be randomly assigned (e.g. ephemarel port number = 52000), but Server port number must be fixed for a server process: (e.g. well-known port number = 13).

13 13 Multiplexing / Demutiplexing a)At sender site, there may be several processes that need to send packets, however, there is only one transport protocol at any time. (Many-to-1). b)Multiplexing at TL accepts packets from different processes, differentiated them by port numbers. After adding the header, TL passes the packet to NL. c)At the receiver site, the relationship is the opposite (1-to-many) that requires Demultiplexing process. d)After error checking and dropping of header, TL delivers each message to appropriate process based on port number.

14 14 Reliable service using Error control Reliability at the data link layer is between two nodes (pink links) Reliability at transport layer ensures end-to-end reliability. Network layer is unreliable (best effort delivery) because it only concerns about routing to appointed address.

15 15 User Datagram Protocol (UDP)

16 16 User Datagram Protocol (UDP) a)The User Datagram Protocol (UDP) is called a connectionless, unreliable transport protocol. It does not add anything to the services of IP except to provide process-to-process communication instead of host-to-host communication. Very limited error checking. b)Why needed UDP if so unreliable? It’s a simple protocol using minimum overhead, hence fast delivery. e.g. a process wants to send a small message & doesn’t care about it reliability. c)UDP packets have a fixed-size header of 8 bytes. UDP length = IP length – IP header’s length

17 17 Encapsulation and decapsulation

18 18 Multiplexing and demultiplexing

19 19 Transmission Control Protocol (TCP)

20 20 Transmission Control Protocol (TCP) a)The Transmission Control Protocol (TCP) is called a connection- oriented, reliable transport protocol. b)Like UDP it is a process-to-process protocol that uses port numbers. c)Unlike UDP, TCP creates a virtual connection between two TCPs to send data. In addition, it also uses flow and error control (Reliable). d)TCP is also reliable for stream-oriented protocol: allows sending and receiving streams of bytes that are related in a ‘virtual tube’. e)The segments of packet are related using a sequence number.

21 21 TCP a)TCP offers full duplex services, in which data can flow in both direction at the same time. b)Each TCP then has a sending and receiving buffer and segments move in both directions. (mostly for flow and congestion control) c)When site A wants to send and receive data from another site B: The two TCPs establish a connection between them Data are exchanged in both directions The connection is terminated when finish d)The connection is virtual, not physical. e)TCP keeps track of the segments by sequence and ACK numbers. f)Some TCP segments can carry a combination of data and control information (Piggy-backing), using a sequence number and ACK. g)These segments are used for connection establishment, termination or abortion.

22 22 The bytes of data being transferred in each connection are numbered by TCP to establish the relationship between data bytes/segments being sent. The numbering starts with a randomly generated number btw 0 to 2 32 -1. (not necessarily from zero). The value in the sequence number field of a segment defines the number of the first data byte contained in that segment. The byte numbering is also used for flow and error control. The sequence number is actually a range of bytes. Sequence Number

23 23 Suppose a TCP is transferring a file of 5000 bytes. The 1 st byes is 10,001. What are the sequence number for each segment if data are sent in 5 equal segments? Example The following shows the sequence number for each segment: Solution

24 24 Example 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 is sent in five segments with the first four segments carrying 1,000 bytes and the last segment carrying 2,000 bytes? Solution The following shows the sequence number for each segment: Segment 1  10,010 (10,010 to 11,009) Segment 2  11,010 (11,010 to 12,009) Segment 3  12,010 (12,010 to 13,009) Segment 4  13,010 (13,010 to 14,009) Segment 5  14,010 (14,010 to 16,009)

25 25 ACK Number a)TCP is full-duplex where two parties/sites can send and receive data at the same time. b)Each party/site numbers the bytes (usual with a different starting byte/sequence number). c)The sequence number in each direction shows the number of the 1 st byte carried by this segment. d)Each party also uses acknowledgement number defines the number to confirm the bytes it has received. e)The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receive. f)The acknowledgment number is cumulative, which means that the party takes the number of the last byte that it has received safely and adds ‘1’ to it and announces this sum as the ACK number.

26 26 TCP header format 20 (if no option) to 60 bytes header btw 5 & 15 (*4) 6 different Control fields (Receiving) For urgent data

27 27 Control field Description of flags in the control field

28 28 TCP Connection a)TCP is connection-oriented transport protocol that establishes a virtual path between source and destination. i.e. Using a single virtual pathway for entire message, facilitates the ACK process and retransmission of damaged or lost frames or frames arrive out of order. b)Although TCP uses service of IP (connectionless) to deliver individual segments, it has full control of the connection. IP is unaware of any lost or retransmission of packets but TCP does. TCP can holds it until the missing segments arrive. c)In TCP, connection-oriented transmission requires 3 phases: Connection Establishment Data Transfer Connection Termination d)Usually involves request and acknowledge procedures in all above phases.

29 29 TCP Flow Control a)Unlike UDP, TCP provides the flow control mechanism. b)The receiver controls the amount of data that are to be sent by the sender, to prevent overflowing at destination (by announcing the value of window size in the window size field of the TCP header). c)Similar to data link layer, TCP uses sliding window (SW) and numbering system to handle flow control to make transmission more efficient as well as to control the flow of data. d)However, this is done on end-to-end basis. The SW protocol is something btw Go-Back-N and Select Repeat. e)Two differences from the Data Link Layer: a)SW in TCP is byte oriented, but SW in DL is frame oriented b)TCP SW is variable size, but DL SW is fixed size.

30 30 Sliding window The 3 activities: opening, closing & shrinking are in the control of the receiver (depending on congestion in the network), not the sender. Sender must obey the commands of the receiver in this matter. Opening allows more new bytes in the buffer that are eligible for sending. Closing means some bytes have been acknowledged and the sender need not to worry about then anymore. Shrinking means shorten the size of window for congestion control purpose moving right wall to the right moving left wall to the right moving right wall to the left

31 31 TCP header format Window size field defines the size of the window in bytes, that the other party must maintain. 16 bits can allow upt0 65535 bytes. This is normally refer to the receiver window (rwnd) and is determined by the receiver. The sender must obey the dictation of the receiver in this matter

32 32 TCP Error Control Similar to UDP, TCP ensure reliable delivery using error control. This means that an application program that delivers a stream of data to TCP relies on TCP to deliver the entire stream to the other side, in orderly manner, without any error, lost or duplication. Error control includes mechanism for detecting corrupted segments, lost segments, out-of-order segments and duplicated segments. It also includes mechanism for correcting errors after they are detected, which is achieved through the use of: Checksum: to check for corrupted segment and discard it. Acknowledgement (ACK): to confirm the receipt of segments. Time-out (TO): Timer set for retransmission of segments. The heart of error control mechanism is Retransmission. The retransmission happens when the TO timer is expired: meaning no receipt of ACK segment from opposite party. No retransmission and timer set for an ACK segment.

33 33 TCP header format Error Control fields: Checksum, Acknowledgement number Lost and corrupted segments are treated the same way by the receiver. Both are treated as lost!!! (Lost segments discarded somewhere in network by some routers and corrupted segments discarder by receiver itself).

34 34 Congestion Control & Quality of Service

35 35 Congestion Control & QoS a)Congestion control & QoS are two issues that bound together closely; improving one means improving the other or ignoring one also ignoring the other. b)Not only related to just Transport layer but all 3 layers involved: a)Data Link layer b)Network layer c)Transport layer c)Need to think of them as co-operated property. d)Involve directly with managing data traffic

36 36 DATA TRAFFIC The main focus of congestion control and quality of service is data traffic. In congestion control we try to avoid traffic congestion. In quality of service, we try to create an appropriate environment for the traffic. So, before talking about congestion control and quality of service, we discuss the data traffic itself. Traffic Descriptor Traffic Profiles

37 37 Traffic descriptors

38 38 Three traffic profiles

39 39 CONGESTION Congestion in a network may occur if the load on the network—the number of packets sent to the network— is greater than the capacity of the network—the number of packets a network can handle. Congestion control refers to the mechanisms and techniques to control the congestion and keep the load below the capacity. Congestion happens in any system that involves waiting or queuing.

40 40 Queues in a router Two issues: If the rate of packet arrival is higher than the packet processing rate, the input queues become longer and longer If the packer departure rate is lesser than the packet processing, the output queues become longer and longer.

41 41 Packet performance: Packet delay and throughput as functions of load Congestion Control involves two factors that measure the performance of a network: Delay: queuing due to processing delay and propagation delay Throughput: number of packet passing thru in a unit of time

42 42 TCP assumes that the cause of a lost segment is due to congestion in the network. If the cause of the lost segment is congestion, retransmission of the segment not only does not remove the cause, it aggravates it.

43 43 CONGESTION CONTROL Congestion control refers to techniques and mechanisms that can either prevent congestion, before it happens, or remove congestion, after it has happened. In general, we can divide congestion control mechanisms into two broad categories: Open-loop congestion control (prevention) and Closed-loop congestion control (removal).

44 44 Congestion control categories

45 45 Open-Loop Congestion Control a)Retransmission: Sender resend packet that is lost or corrupted. b)Retransmission in general may increase congestion in the traffic, hence need a good retransmission policy/timers to optimise efficiency and prevent congestion build-up. c)Windowing: Types of window used – Selective Repeat window is better than Go-back-N window; to prevent duplication of good data. d)ACK: also affect congestion because it is part of the load: a receiver may send an ACK only if it has packet to be sent or special timer expires or may decide to ACK only N packets at a time. e)Discarding: need good discarding policy that do not harm the integrity of the transmission: e.g. audio packet: discard less sensitive packet, so that quality of the sound is still preserved. f)Admission: a QoS mechanism to avoid congestion in virtual circuit networks. Switches check the resource requirement of a flow before admitting it to the network. A router can deny establishing a virtual- circuit connection if there is severe congestion in the network.

46 46 Closed-Loop Congestion Control a)Backpressure: The technique of backpressure refers to congestion control mechanism in which a congested node stops receiving data from the immediate upstream node or nodes. This may cause the node or nodes to become congested and reject data from their upstreams. Backpressure is a node-to-node congestion control that starts with a node and propagates in the opposite direction of data flow. Can only applied to virtual-circuit networks. (each node knows upstream node). b)Choke: A choke packet is sent by a node to the source to inform of any congestions. The warning is directly sent to the source (rather than propagate backward from node to node), asking the source to slow down. Intermediate nodes are not warned and hence no action. c)Implicit signalling: No communication btw the congested node & source. The source guesses that there is a congestion somewhere from other symptoms: e.g. delay or no ACKs for a while. (TCP case) d)Explicit signalling: Unlike choke, signal is inserted in with the data packet to inform any congestion to the source. (Frame Relay case).

47 47 Backpressure method for alleviating congestion Node III has more input data than it can handle. It drops some packets in its input buffer and informs node II to slow down. Node II, in turn, may be congested because it is slowing down the output flow of data. If node II is congested, it informs node I to slow down, which may in turn create a temporally congestion. If so, node I informs the source of data to slow down. This in time alleviates the congestion. Pressure on node III is moved backward to the source to remove the congestion.

48 48 Choke packet

49 49 Congestion Control in TCP a)So far, we assume that it is only receiver can dictate to the sender the size of its window and network entity has been ignored. If the network cannot deliver the data as fast as they are created by the sender, it must tell the sender to slow down. b)In addition to the receiver, the network is a second entity that determines the size of the sender ’ s window. Hence, the sender ’ s window size is determined not only by the receiver but also by congestion in the network. Window size = min(rwnd,cwnd) c)TCP ’ s general policy for handling congestion is based on 3 phases: Slow start: Exponential Increase Congestion avoidance: Additive Increase Congestion detection: Multiplicative Decrease d)Sender starts with a slow rate but then increase the rate rapidly until a threshold, then reduce it to a linear rate to avoid congestion. Finally, if congestion is detected, the sender goes back to the slow-start phase.

50 50 1. Slow start, exponential increase In the slow-start algorithm, the size of the congestion window increases exponentially until it reaches a threshold.

51 51 2. Congestion avoidance, additive increase In the congestion avoidance algorithm, the size of the congestion window increases additively until congestion is detected.

52 52 Congestion example

53 53 QUALITY OF SERVICE (QoS) QoS is an internetworking issue that has been discussed more than defined. We can informally define quality of service as something a flow seeks to attain. Flow Characteristics Flow Classes The main focus of congestion control & QoS is traffic. In congestion control we try to avoid traffic congestion. In quality of service, we try to create an appropriate environment for the traffic.

54 54 Flow characteristics Reliability: vital characteristic that a flow needs. Losing reliability means losing a packet or ACK, which entails retransmission. Some application needs reliability more than others; e.g. email, file transfer and Internet access require reliable transmission more than audio conferencing. Delay: degree of tolerance for later packet. Audio conferencing needs minimum delay but delay in file transfer or email is less crucial. Jitter: variation in delay for packets belonging to the same flow. High jitter means the difference between delay is large. Low jitter means low variation of delay between packets. Bandwidth: Different application needs different bandwidth. Video transmission needs millions of bps to refresh the screen while email needs minimum bandwidth to send a file.

55 55 Techniques to improve QoS There are four common methods: 1.scheduling, 2.traffic shaping, 3.resource reservation 4.admission control

56 56 Methods to improve QoS 1.Scheduling: Packets from different flows arrive at a router for processing. A good scheduler treats different flows in a fair and appropriate manner to improve the QoS. These scheduling methods are: FIFO queuing, Priority queuing & Weighted fair queue 2.Traffic shaping: mechanism to control the amount and the rate of the traffic sent to the network. The traffic shaping techniques are: Leaky bucket & token bucket Both techniques can be combined to credit an idle host and regulate the traffic at the same time. 3.Resource reservation: QoS is improved if recourses such as buffer, bandwidth are reserved beforehand. – Integrated Services. 4.Admission Control: mechanism used by router/switch to accept or reject a flow based on flow specifications.

57 57 Scheduling: First In First Out - FIFO queuing In FIFO, packets wait in a buffer (queue) until the node is ready to process them. If the average arrival rate is higher than the average processing rate, the queue will fill up and new arriving packets will be discarded. (Just like queuing for bus scenario).

58 58 Scheduling: Priority queuing In Priority queue, packets are first assigned a priority class. Each priority class has its own queue. The packets in the highest priority queue are processed first, while packets in the lowest priority queue will be processed last. A switch over when queue empty. Priority queuing gives a better QoS because higher priority traffic such as multimedia can reach the destination with less delay. Potential drawback: starvation – continuous flow in high priority flow means packets in lower priority flow never get processed – less fair to lower priority traffic.

59 59 Scheduling: Weighted fair queuing In weighted fair queuing, packets are still assigned to different classes and queues but the queue are weighted based on priority; higher priority means higher weights. The system processes packets in each queue in a round-robin fashion with the number of packets selected from each queue based on corresponding weight. If the system does not impose priority, then all queue has equal weight. Much fairer queuing in QoS.

60 60 Bucket with a hole, leaking at constant rate as long as there are water in bucket. The input rate can varies but output rate remains constant. To smooth out bursty traffic in networking, bursty chunks are stored and send out at an average rate. Without leaking bucket, the starting burst may have hurt the network – congestion. In the example, the bursty data of 12Mbps, 2 sec and 2Mbps, 3 sec is average out to 3Mbps, 10sec. Traffic Shaping: Leaky bucket

61 61 Traffic Shaping: Token bucket Leaky bucket is very restric- tive. It does not credit a idle host. e.g. if a host is not sending for a while & the bucket becomes empty. Now, if the host has bursty data, the leaky bucket allows only an average rate. The time when the host was idle is not taken into account. Token bucket allows idle hosts to accumulate credit for the future in the forms of token. The token bucket allows bursty traffic at a regulated maximum rate. Token to be collected based on idle time and can be used later to sends bursty packets as long as it is allowed by the bucket.

62 62 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. The token bucket allows bursty traffic at a regulated maximum rate.

Download ppt "1 The TCP/IP Model. 2 An exchange using the TCP/IP model Datagram Frame Application."

Similar presentations

Ads by Google