Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Networks TCP/IP Dr. Miled Tezeghdanti. Computer Networks 2 Outline vTCP/IP ðIP ðARP ðICMP ðTCP/UDP ðRouting Protocols.

Similar presentations


Presentation on theme: "Computer Networks TCP/IP Dr. Miled Tezeghdanti. Computer Networks 2 Outline vTCP/IP ðIP ðARP ðICMP ðTCP/UDP ðRouting Protocols."— Presentation transcript:

1 Computer Networks TCP/IP Dr. Miled Tezeghdanti

2 Computer Networks 2 Outline vTCP/IP ðIP ðARP ðICMP ðTCP/UDP ðRouting Protocols

3 Computer Networks 3 History vARPANET ð1969: 4 workstations, Backbone (50 Kbps) ðARPA “Advanced Research Project Agency ”, DoD (1957) ðDARPA “The Defense Advanced Research Project Agency” (1973) ðNCP “Network Control Protocol” vTCP/IP ð1973 ðVint Cerf (Stanford), Bob Khan (DARPA) §1974, first use of the “Internet” word in their paper “Transmission Control Protocol” ðUse of TCP/IP in ARPANET in 1976 vARPANET (1984) ðMILNET, ARPANET(Internet)

4 Computer Networks 4 Internet Organizations vIAB : Internet Architecture Broad (1983) ðDesign, Engineering, and Management of Internet vIETF : Internet Engineering Task Force (1986) ðTechnical Development of Internet ðWorking Groups §Example: ospf (Open Shortest Path First IGP) ðManaged by IESG: Internet Engineering Steering Group vIRTF : Internet Research Task Force (1986) ðResearch and long-term development of Internet ðResearch Groups ðManaged by IRSG: Internet Research Steering Group §Example: Routing Research Group

5 Computer Networks 5 Internet Organizations vISOC: Internet Society (1992) ðInternet Promotion ðContains IAB, IETF, and IRTF vW3C: World Wide Web Consortium (1994) ðTim Berners-Lee ðCERN ðDARPA, European Commission vICANN: The Internet Corporation for Assigned Names and Numbers (1998) ðSuccessor of IANA: Internet Assigned Numbers Authority ðIt is the highest international authority for all questions related to domain names, addresses, and protocols.

6 Computer Networks 6 Internet Organizations IAB IESGIRSG IETFIRTF ISOC

7 Computer Networks 7 Standards vRFC : Request For Comments ðRFC 2328 vRFC ðInternet Draft ðRFC §Prototype §Experimental §Informational §Historic §Standard –Proposed Standard –Draft Standard –Internet Standard

8 Computer Networks 8 TCP/IP Model Network Data Link Presentation Session Transport Physical Application Network Data Link Transport Physical Application TCP/IP Model OSI Model

9 Computer Networks 9 TCP/IP Model Application RARP FTPSMTPTELNET Transport TCPUDP Network IP ICMP ARP Data LinkPhysical OSPF SNMP

10 Computer Networks 10 IP Protocol vInternet Protocol vRFC 791 vNetwork Layer vInterconnection of networks ðEthernet ðToken Bus ðToken Ring vHardware is hidden by the Network layer (some exceptions like MTU: Maximum Transmission Unit)

11 Computer Networks 11 Functions provided by the IP layer vAddressing vRouting vForwarding vFragmentation and Reassembly vError Notification

12 Computer Networks 12 IP vSending and Receiving of packets vNo retransmissions ðIP does not provide a reliable forwarding service vPackets may be: ðlost ðdropped ðduplicated ðdelayed ðcorrupted ðdelivered out of order vBest effort service ðNetwork does his best effort to forward packets

13 Computer Networks 13 IP Addressing vAn IP address is represented on 32 bits (4 bytes) vEvery equipment has an IP address which identifies it in a unique manner on the network vIP Address Representation ðDotted-Decimal Representation ð4 decimal numbers separated by decimal point ðValue between 0 and 255 for each number vExample ð ð ð

14 Computer Networks 14 Addressing vWith 32 bits, we can have 2 32 different IP addresses vAddressing space is divided in many classes vAn address is divided in two parts ðThe first part represents the address of the network connected to the host (workstation) ðThe second part represents the address of the host (workstation) on the network ðHosts connected to the same network have the same network address (first part of the address is the same for all these hosts) vMask ð32 bits ðAllows the distinction between the network part and the host part of the address (1 if the bit belongs to the net-id, 0 otherwise)

15 Computer Networks 15 Addressing 1110xxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class D 11110xxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class E 110xxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class C 10xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class B 0xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class A

16 Computer Networks 16 Addressing: Class A vNet-id: 8 bits ð =126 class A networks ð1 … 126 (0 and 127 reserved) vHost-id: 24 bits ð = hosts vExample: xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class A Net-Id Host-Id

17 Computer Networks 17 Addressing: Class B vNet-id: 16 bits ð2 14 =16384 class B networks ð128 … 191 vHost-id: 16 bits ð = hosts vExample: xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class B Net-Id Host-Id

18 Computer Networks 18 Addressing: Class C vNet-id: 24 bits ð2 21 = class C networks ð192 … 223 vHost-id: 16 bits ð = 254 hosts vExample: xxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class C Net-Id Host-Id

19 Computer Networks 19 Private Addressing vPrivate Address: is an IP address that cannot be used to interconnect a host to Internet vPrivate addresses: ðClass A § – ðClass B § – ðClass C § – vExamples ð ð ð

20 Computer Networks 20 Loop-back and Multicast Addresses v ðLoop-back address ðInter-process communication on the same host ðTest the protocol stack without having a network connection ðPackets sent to this address will be directly sent to the local host vClass D: Multicast addresses ð : All OSPF Routers on the same LAN vClass E: reserved for future use

21 Computer Networks 21 Specific Addresses v ðAn IP address used by a host when it does not know its IP address (This host) v0.A.A.A, 0.0.B.B, C ðWhen the network-id is equal to 0, this indicates the network that is directly connected to the host (This host on this network) ð , , v ðBroadcast Address on the LAN vA , B.B , C.C.C.255 ðBroadcast Address on a distant network (A.0.0.0, B.B.0.0, C.0.0.0) ð , ,

22 Computer Networks 22 IP Subnet vHosts on the same network must have the same network address ðClass A: and are on the same IP network ðClass B: and are on the same IP network ðClass C: and are on the same IP network vA class A network may contain up to hosts vA class B network may contain up to hosts vTo simplify the management of class A and B networks, the concept of subnet was introduced.

23 Computer Networks 23 IP Subnet vWe can split a class A IP network to 256 different class B subnets (actually 254 class B subnets) ðWe use the 8 most significant bits of the host-id to address the subnet ð : class A network § : first subnet § : second subnet §… § : 254 th subnet 0xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class A Net-Id Host-Id Subnet-Id

24 Computer Networks 24 IP Subnet vWe can split a class B IP network to 256 different class B subnets (actually 254 class C subnets) ðWe use the 8 most significant bits of the host-id to address the subnet ð : class B network § : first subnet § : second subnet §… § : 254 th subnet 10xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class B Net-Id Subnet-Id Host-Id

25 Computer Networks 25 Mask vWe need a supplementary mechanism to distinguish between the network-id (network and subnet) and the host-id ðBefore, it is sufficient to determine the class of the address to distinguish between the network-id part and the host-id part vNetwork Mask: distinguish between the net-id (network and subnet) and the host-id ð32 bits (same size as an IP address)

26 Computer Networks 26 Mask vHow we compute the network mask? vFor each bit of order i (i = 0..31) of the IP address, ðAffect to the bit i of the mask the value §1 if the bit of order i is in the net-id (network and subnet) part §0 if the bit of order i is in the host-id part vNetwork mask is represented in the same manner as an IP address ðExample:

27 Computer Networks 27 Mask Mask Mask xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class A Net-Id Host-Id 10xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class B Net-Id Host-Id

28 Computer Networks 28 Class A Mask vExample ð §Mask ð §Mask Mask xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class A Net-Id Host-Id

29 Computer Networks 29 Class B Mask vExample ð §Mask ð §Mask Mask xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class B Net-Id Host-Id

30 Computer Networks 30 Class C Mask vExample ð §Mask ð §Mask Mask xxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class C Net-Id Host-Id

31 Computer Networks 31 Subnet Mask 0xxxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class A Net-Id Host-Id Subnet-Id Mask Mask 10xxxxxx.xxxxxxxx.xxxxxxxx.xxxxxxxx Class B Net-Id Subnet-Id Host-Id

32 Computer Networks 32 Subnet Mask vClass A Subnets ð : class A network, mask § : first subnet, mask § : second subnet, mask §… § : 254 th subnet, mask vClass B Subnets ð : class B network, mask § : first subnet, mask § : second subnet, mask §… § : 254 th subnet, mask

33 Computer Networks 33 Variable Length Mask vCan you do better? vExample ðWe have the class B address that we want to use to address 10 different subnets each one containing more than 256 hosts. ðSolution §In fact, we need only 4 bits to address the different subnets, so we can let 12 bits for addressing hosts on subnets. If we take 8 bits as usual, we can not address hosts on subnets that have more than 256 hosts connected to them. §Network mask is computed using the same algorithm §Mask = §Masque =

34 Computer Networks 34 Variable Length Mask vThe 10 subnets have all the same mask ð0000 et 1111 are not used ð = ð = ð = ð = ð = ð = ð = ð = ð = ð =

35 Computer Networks 35 Variable Length Mask vWith a variable length mask, we can also split a class C address to many subnets vExample ð §2 subnets –We need 2 bits (all 0s and all 1s are not used) –Mask : –Mask : – –

36 Computer Networks 36 IP Packet Format VersionIHL TOSTotal Length IdentificationFragment Offset TTL Protocol Header Checksum Source Address Destination Address Options + Padding Data 0 DFDF MFMF 32 bits

37 Computer Networks 37 IP Packet Format vVersion ð4 bits ðProtocol Version ðCurrent Version: 4 ðIPv4 vIHL: IP Header Length ð4 bits ðSize of the IP header in 32 bit words ðDetermines the start of the Data field ðMinimal size is 5

38 Computer Networks 38 IP Packet Format vTOS: Type Of Service ð8 bits ðIndicates the type of service requested by the packet ðNot used ðAlways set to ðNew re-use of TOS field (Diff-serv Architecture) vTotal Length ð16 bits ðTotal length (Header + payload) of the IP packet expressed in bytes ðMaximal Length of an IP packet: 64 Kbytes

39 Computer Networks 39 IP Packet Format vIdentification ð16 bits ðIdentifies the IP packet ðIt allows the identification of fragments of the same packet vFragment Offset ð13 bits ðIt indicates the position of the current fragment from the first fragment ðThe offset is measured in 8 byte words (64 bits) ðThe offset of the first fragment is 0

40 Computer Networks 40 IP Packet Format vDF: Don’t Fragment ðOne bit ðIf DF = 1, don’t fragment the packet ðIf DF = 0, the packet may be fragmented when it is needed vMF: More Fragments ðOne bit ðIf MF = 0, It is the last fragment of the packet ðIf MF = 1, there is more fragments after this fragment

41 Computer Networks 41 IP Packet Format vTTL: Time To Live ð8 bits ðTime remained for the packet before it will be dropped by the network if it doesn’t reach its destination ðEach traversed router decrements the packet TTL by 1 and drops the packet if its TLL equals 0 ðIt assures that the packet won’t loop indefinitely in the network vProtocol ð8 bits ðIt determines the protocol that must process data transported by the IP packet ðTCP = 6 ðUDP = 17

42 Computer Networks 42 IP Packet Format vHeader Checksum ð16 bits ðError control limited to the header of the packet ð1’s Complement ðSince TTL value changes from hop to hop, Checksum is checked and computed at each processing of the IP header ðAlgorithm: §Checksum is the 1’s complement of the sum over 16 bits of 1’s complements of all 16 bit words of the IP header, including Checksum (Checksum value used in the computation is 0) ðAlgorithm simple and easy to implement

43 Computer Networks 43 IP Packet Format vSource Address ð32 bits ðIP address of the host that sends the packet ðAlways, it is a unicast address ðOver Internet, source address must be a public domain address vDestination Address ð32 bits ðIP address of the host that will receive the packet ðMay be a unicast/multicast/broadcast address ðOver Internet, destination address must be a public domain address

44 Computer Networks 44 IP Packet Format vOptions ðType, Length, Value (TLV Encoding) ðRecord Route ðExplicit Route vPadding ðUsed to have an IP header length multiple of 32 bit word ðPadding bytes are set to 0

45 Computer Networks 45 IP Forwarding vIP Forwarding ðIt is the set of operations performed by a router over an IP packet in order to send it towards its destination ðRouter §Equipment that supports the IP stack and has many network interfaces and performs packet forwarding §A workstation may have many network interfaces and supports the IP stack without playing the role of router –Multihoming

46 Computer Networks 46 IP Forwarding vEach router that receives an IP packet performs following operations over the packet ðIt checks the Checksum, the packet is dropped if an error is detected ðIt decrements TTL by 1 and drops the packet if the TTL becomes 0 ðIt computes the new Checksum ðIt looks the routing table to determine the next hop that is on the route of the packet towards its destination ðIf it does not find required routing information to send the packet towards its destination, it drops the packet ðIt sends the packet towards its destination and eventually to its destination if it is on the same network

47 Computer Networks 47 Routing Table vContains required information to forward IP packets towards their destinations vThe routing table may be populated ðManually by the network administrator §Static Routing –Route command under Unix ðAutomatically using a routing protocol §Dynamic Routing –RIP, OSPF, BGP

48 Computer Networks 48 Routing Table DestinationNext Hop Cost

49 Computer Networks 49 CIDR vClassless Inter Domain Routing ðA new addressing scheme that allows §Efficient address allocation §Routing table size reduction §A solution to B addresses’ shortcomings ðClass concept is no longer used ðProblem: §Affect IP addresses to an IP network having 1000 hosts §A class C address is not sufficient §A class B address may solve the problem, but! –Wasting –There is not enough available class B addresses ðSolution: Use 4 class C addresses

50 Computer Networks 50 CIDR vThe attribution of many class C addresses to a company avoids the wasting of IP addresses ðExplosion of the size of routing tables §An entry for each class C network §2 21 = different class C networks ðRemedy §Class C addresses allocated to a given company must be contiguous in order to use the super-netting concept §Replace many contiguous network addresses by a single address accompanied by the number of bits starting from left that are identical for all addresses –This new presentation is called IP prefix and the number of bits is called prefix length

51 Computer Networks 51 CIDR vExample ðThe following 4 class C addresses are contiguous § , , , ðCorrespondent prefix is /22 ðThe prefix length is 22 §The 22 left bits of the 4 addresses are identical ðThe 4 addresses will be represented by a single entry in the routing table vThe same concept is generalized to reduce the size of the routing table (~ entries) ðAggregation: allows the substitution of many routing table entries by a single prefix if all entries have the same next-hop

52 Computer Networks 52 CIDR vCan you do better! ðSometimes many routing table entries are contiguous addresses and they have the same next-hop except one or two entries that have a different next-hop ðHow can you solve the problem? ðUse of the LMA §Longest Matching Algorithm §We replace all entries having the same next-hop by the correspondent prefix §We leave routing table entries that have a different prefix unchanged §It is the routing table entry that has the longest matching bits with the destination address starting from the left that will be used to forward the packet

53 Computer Networks 53 ARP vAddress Resolution Protocol vRFC 826 ðDetermines the physical address correspondent to an IP address when needed §MAC address of the next-hop router required by an intermediate router to forward packet towards its destination §MAC address of the destination required by the last router to forward packet to its destination ðExample: over an Ethernet network, find the MAC address of the host having the IP address §ARP messages are encapsulated in an Ethernet frame (Type = 0x806) ðBroadcast of an ARP Request §Ethernet destination address = FF:FF:FF:FF:FF:FF ðThe host having the same IP address replies with an ARP Reply message that contains its MAC address §ARP Reply message is sent only to the host that had sent the ARP Request

54 Computer Networks 54 ARP vResponses are saved in ARP table that contains correspondences between IP addresses and MAC addresses vEach table entry has a limited time to live (10 to 20 minutes) vIf a host A wants to communicate with a host B, it looks up the MAC address of the host B in its ARP table ðIf it doesn’t find it, it sends an ARP Request message over the network to get to the IP address of the host B that must reply with an ARP Reply message vAn ARP server may be used ðThe server answers all requests ðThe server must know all IP and MAC addresses of the network

55 Computer Networks 55 ARP Packet Format Protocol Type (IP = 0x800) H Add Len (6) P Add Len(4) Operation Sender Hardware Address Target Hardware Address 32 bits Hardware Type (Ethernet = 1) Sender Hardware AddressSender Protocol Address Target Hardware Address Target Protocol Address

56 Computer Networks 56 ARP Request Protocol Type (IP = 0x800) H Add Len (6) P Add Len(4) Operation (0x0001) Sender Hardware Address Target Hardware Address :00:00:00:00) 32 bits Hardware Type (Ethernet = 1) Sender Hardware AddressSender Protocol Address Target Hardware Address (00:00 Target Protocol Address

57 Computer Networks 57 ARP Reply Protocol Type (IP = 0x800) H Add Len (6) P Add Len(4) Operation (0x0002) Sender Hardware Address 00:00:c0:4a: Target Hardware Address 32 bits Hardware Type (Ethernet = 1) Sender Hardware Address d8:c5Sender Protocol Address Target Hardware Address Target Protocol Address

58 Computer Networks 58 ICMP vInternet Control Message Protocol vRFC 792 vAllows the notification of errors to the source vEncapsulated in IP ðProtocol = 1 vTypes ðEcho Request/Echo Reply ðDestination Unreachable ðRedirect ðTime Exceeded ð…

59 Computer Networks 59 ICMP Packet Format vType: 8 bits ð15 different types vCode: 8 bits ðSub-types for each type vChecksum 32 bits Data (function (type, code) : IP header + 8 first bytes of IP Data) Type Code Checksum

60 Computer Networks 60 ICMP vDestination Unreachable ðNetwork Unreachable §Sent by a router that cannot reach the destination network ðHost Unreachable §Sent by a router on the same network as the destination host that cannot reach the destination host ðPort Unreachable §Sent by the destination host when it cannot reach the destination process ðProtocol Unreachable §Sent by the destination host when it cannot recognize the protocol ðFragmentation Needed and 'Don't Fragment' bit set ðSource Route failed

61 Computer Networks 61 Ping vPing “IP address” ðUnix Command: ping ðChecks the operation of a distant host ðChecks if the distant host is reachable ðICMP Echo Request/ Echo Reply ðSequence Number field allows the determination of the number of lost packets ðIdentifier field allows the parallel execution of many ping programs between two hosts 32 bits Type Code Checksum Sequence NumberIdentifier Optional Data

62 Computer Networks 62 Traceroute vTraceroute “IP address” ðUnix Command: traceroute ðDetermines the whole path followed by packets to reach a particular destination vAlgorithm ðThe source sends an IP packet (UDP packet) to the destination address with a TTL 1 ðThe packet will be dropped by the first router on the path towards the destination ðThe router that dropped the packet sends an ICMP Time Exceeded message to the source which uses it to determine the first router on the path towards the destination ðThe source sends a second IP packet to the destination address with a TTL 2. The packet will be dropped by the second router on the path to the destination. This royter will send an ICMP Time Exceeded message to the source that uses it to determine the second router on the path ðThe source repeats the same procedure by incrementing the TTL until it receives an ICMP Error Message (ICMP Port Unreachable Message) from the destination.

63 Computer Networks 63 TCP vTransport Control Protocol vRFC 793 vEncapsulated in IP ðProtocol = 6 vConnection Oriented Service ðReliable (Error, Loss, and Duplicates Management) ðIn Order Delivery ðFull-Duplex vMultiplexing ðMany applications on the same host may communicate at the same time vT-PDU: segment

64 Computer Networks 64 TCP Destination Port Sequence Number Acknowledgement Number Options + Padding Data 32 bits Source Port HLEN Window Urgent PointerChecksum FINFIN SYNSYN RSTRST PSHPSH ACKACK URGURG Reserved

65 Computer Networks 65 TCP Segment Format vSource Port ð16 bits ðPort source ðIndicates the port number on which the sender is listening vDestination Port ð16 bits ðPort destination ðIndicates the port number on which the destination is listening vThe fields (Source Address, Destination Address, Protocol, Source Port, Destination Port) identify in a unique manner each connection

66 Computer Networks 66 TCP Segment Format vSequence Number ð32 bits ðIndicates the sequence number of the first data byte vAcknowledgement Number ð32 bits ðIndicates the number of the next data byte that the sender is ready to receive from the other side of the connection ðAcknowledgement of all previous bytes

67 Computer Networks 67 TCP Segment Format vHLen ð4 bits ðHeader Length of the TCP segment header in 32 bit words ðMinimal length is 5 (No options) vTCP Flags ðURG: Urgent, indicates the presence of urgent data in the segment ðACK: Acknowledgement, indicates that the segment is an acknowledgement segment ðPSH: Push, when it is set, data must be delivered to the higher layer immediately ðRST: Reset, reset the TCP connection ðSYN: Synchronize, indicates a connection setup segment ðFIN: Fin, indicates a connection release segment

68 Computer Networks 68 TCP Segment Format vWindow ð16 bits ðTCP Window ðIndicates the number of bytes that the receiver is ready to receive ðFlow Control

69 Computer Networks 69 TCP Segment Format vChecksum ð16 bits ðError control over the whole TCP segment (header + data) + a pseudo-header §Violation of layering concept ðA zero byte is added to the end of the segment if the size of the segment is odd ðSame algorithm as with IP Checksum Protocol TCP Segment Length Source Address Destination Address Pseudo-Header

70 Computer Networks 70 TCP Segment Format vUrgent Pointer ð16 bits ðPointer to the urgent Data ðWhen the flag URG is set, this field contains a pointer to the urgent data

71 Computer Networks 71 TCP Segment Format vSource port and destination port allows multiplexing vTwo different TCP connections have different (source port, destination port) pairs vServer listens passively over a well known port waiting for connection requests from clients ðTelnet Server: 23 ðWeb Server: 80 ðFTP: 20 and 21 §20 for commands §21 for data transfer

72 Computer Networks 72 TCP Connection Setup vServer listens passively over a particular port number ðServer uses a well known port §Telnet: 23 §FTP: 20 for commands and 21 for data §HTTP: 80 vConnection is established after the exchange of 3 segments between the client and the server ð3-way Handshake §Connection setup segments are retransmitted after a timer expiration if no acknowledgement is received (the timer is relative to a TCP connection setup which is different from the timer used for data retransmission)

73 Computer Networks 73 TCP Connection Setup vThe client sends a TCP segment ðThe operating system allocates a free source port to the client ðThe SYN flag of the segment is set to 1 ðDestination port contains the port number on which the server is listening (Telnet: port 23) ðThe first sequence number X is randomly selected (security reasons) vThe server replies by a TCP segment ðSYN and ACK flags are set to 1 ðThe first sequence number Y is randomly selected ðThe acknowledgement number contains the value X+1 (i.e. the server is waiting for the byte having the sequence number X+1 from the client) ðDestination port is equal to the source port of the segment received from the client

74 Computer Networks 74 TCP Connection Setup vThe client replies by a TCP segment ðThe ACK flag is set to 1 ðThe sequence number is set to X+1 ðThe acknowledgement number is set to Y+1 vThe sequence number is randomly selected for each connection ðTo avoid confusion with previous connections ðFor security reasons and to prevent against some attacks

75 Computer Networks 75 TCP Connection Setup SYN (SEQ=X) ClientServer SYN (SEQ=Y), ACK (X+1) (SEQ=X+1), ACK (Y+1) TCP Connection Setup

76 Computer Networks 76 Data Transfer vAfter the connection setup, the two parts may start data exchange vThe connection is full-duplex vEach part must not send more than what allowed by the flow control window vIf no acknowledgement is received before the retransmission timer, the sender retransmits the same segment vAcknowledgements may be sent with data ðPiggybacking

77 Computer Networks 77 Data Transfer (SEQ=X+1, n), ACK(Y+1) ClientServer (SEQ=Y+1, m), ACK (X+n+1) (SEQ=X+n+1, p), ACK (Y+m+1) Data Transfer (SEQ=X+1, n), ACK(Y+1) Sequence Number The number of bytes in the data field Acknowledgement Number The ACK flag is set to 1

78 Computer Networks 78 TCP Connection Release vSymmetric Release ðFull-Duplex Connection §Two distinct (separate) unidirectional connections §Each process release its connection when it has no data to send –The process that has no data to send sends a TCP segment with the FIN flag set to 1 –The other process acknowledges with a TCP segment having the flag ACK set to 1 –The first process may always receive data sent by the other process –When the second process has no data to send, it sends a TCP segment with the flag FIN set to 1 –The first process must acknowledges by a TCP segment with the flag ACK set to 1

79 Computer Networks 79 TCP Connection Release vTCP connection release is done in 4 steps ð1 – A TCP segment TCP with the flag FIN set to 1 ð2 – A TCP segment in the other direction with the flag ACK set to 1 ð3 – A TCP segment with the flag FIN set to 1 ð4 – A TCP segment with the flag ACK set to 1 vThe connection release may be done in 3 steps if the second process has finished the transmission of its data by sending a TCP segment with FIN and ACK flags set to 1

80 Computer Networks 80 TCP Connection Release FIN Process 1 ACK Process 2 FIN ACK

81 Computer Networks 81 TCP Connection Release FIN Process 1 FIN, ACK ACK Process 2

82 Computer Networks 82 Example of TCP Exchange SYN, (SEQ=17) ClientServer SYN, (SEQ=46), ACK (18) (SEQ=18), ACK (47) (SEQ=18, 8), ACK (47) (SEQ=47, 10), ACK (26) FIN, (SEQ=26), ACK (57) FIN, (SEQ=57, 3), ACK (18) (SEQ=26), ACK (60) Connection Setup Connection Release Data Transfer

83 Computer Networks 83 Congestion Control in TCP vThe TCP protocol reduces its traffic when it notices a segment loss ðThe sender maintains a congestion window with a value that depends on the network load ðThe sender maintains at the same time a flow control window where its value is managed by the receiver using the Window field of the TCP segment ðThe window with the minimal size determines the number of bytes that the sender can sends without receiving an acknowledgement

84 Computer Networks 84 UDP vUser Datagram Protocol vRFC 768 vEncapsulated in IP ðProtocol = 17 vConnectionless Service ðNo retransmissions ðData may be delivered out of order ðNo error control (optional) vMultiplexing vThe UDP protocol is useful for applications ðthat have negligible traffic to exchange ðthat are based on the request/reply model (SNMP, Time)

85 Computer Networks 85 UDP vSource Port, Destination port: same as in TCP vLength: total length of the UDP packet expressed in bytes vChecksum: ðSame algorithm as in TCP (header + data + pseudo-header) ðOptional Destination Port Data 32 bits Source Port ChecksumLength

86 Computer Networks 86 TCP/IP Services vTelnet (RFC 854) ðVirtual Terminal ðUses the TCP protocol ðPort: 23 vFTP (RFC 959) ðFile Transfer Protocol ðUses the TCP protocol ðPorts: 20 and 21 §20: FTP –Commands §21: FTP-DATA –Data Transfer

87 Computer Networks 87 TCP/IP Services vElectronic Mail ð ðSMTP protocol (RFC 788) §Simple Message Transfer Protocol §TCP vHTTP (RFC 1945) ðHyper-Text Transfer Protocol ðUses the TCP protocol ðPort: 80 vSNMP (RFC 1157) ðSimple Network Management Protocol ðUses the UDP protocol


Download ppt "Computer Networks TCP/IP Dr. Miled Tezeghdanti. Computer Networks 2 Outline vTCP/IP ðIP ðARP ðICMP ðTCP/UDP ðRouting Protocols."

Similar presentations


Ads by Google