1 00:00:00,000 --> 00:00:05,000 TCP or Transmission Control Protocol is a transport layer protocol 2 00:00:06,000 --> 00:00:10,000 residing at layer 4 in OSI model and is connection orientated 3 00:00:11,000 --> 00:00:17,000 it once again allows high layer protocols access to the network layer or IP layer 4 00:00:18,000 --> 00:00:20,000 but in this case providing reliability. 5 00:00:21,000 --> 00:00:23,000 It is connection orientated before transmission 6 00:00:24,000 --> 00:00:27,000 a session is establish between 2 devices. 7 00:00:28,000 --> 00:00:31,000 TCP generally implements a full duplex mode of operation. 8 00:00:32,000 --> 00:00:34,000 There are some exceptions but we won’t go into them here 9 00:00:35,000 --> 00:00:38,000 In other words a TCP connection is a pair of virtual circuits 10 00:00:39,000 --> 00:00:42,000 one in each direction which operate in full duplex mode. 11 00:00:43,000 --> 00:00:47,000 The transmitter can receive data at the same time its transmitting. 12 00:00:48,000 --> 00:00:52,000 Both host in a conversation can transmit and receive at the same time. 13 00:00:53,000 --> 00:00:55,000 there is error checking in TCP 14 00:00:56,000 --> 00:01:00,000 because there is a checksum in the datagram to verify that there’s no corruption. 15 00:01:01,000 --> 00:01:04,000 TCP segments are also numbered in sequence 15 16 00:01:05,000 --> 00:01:08,000 so that the destination can re-order segments and determine if data is missing. 17 00:01:09,000 --> 00:01:15,000 There is also acknowledgement of receipt of data, so all data is acknowledge by the receiver. 18 00:01:20,000 --> 00:01:25,000 the transmitter or sender can re-transmit the segment or terminate the connection 19 00:01:26,000 --> 00:01:29,000 if it determines that the receiver is no longer involve in the conversation. 20 00:01:30,000 --> 00:01:32,000 TCP implements data recovery features 21 00:01:33,000 --> 00:01:35,000 in other words there can be re-transmission of lost data. 22 00:01:36,000 --> 00:01:39,000 So if there’s no acknowledgement of a segment, the segment will be re-transmitted. 23 00:01:40,000 --> 00:01:44,000 TCP segment are sent using IP packets. 24 00:01:45,000 --> 00:01:51,000 The TCP header will follow the IP header supplying information specific to the TCP protocol. 25 00:01:52,000 --> 00:01:56,000 As you can see here the TCP header has many more options than the UDP header. 26 00:01:57,000 --> 00:02:01,000 So firstly you have a 16 bit source port number which identifies the sending port. 27 00:02:02,000 --> 00:02:06,000 We have a 16 bit destination port, which identifies the receiving port. 28 00:02:07,000 --> 00:02:13,000 There’s a 32 bit sequence number, if the SYN bit is set 29 00:02:14,000 --> 00:02:16,000 then this is the initial sequence number. 30 00:02:17,000 --> 00:02:23,000 The sequence number of the actual first data byte are then this sequence number plus 1. 31 00:02:24,000 --> 00:02:30,000 If the SYN bit is not set then the sequence number, is the accumulated sequence number 32 00:02:31,000 --> 00:02:34,000 of the first data byte of this packet for the current session. 33 00:02:35,000 --> 00:02:38,000 It then has a 32 bit acknowledgement number. 34 00:02:39,000 --> 00:02:43,000 If the ACK flag is set or bit is set 35 00:02:44,000 --> 00:02:46,000 then the value of the acknowledgement number 36 00:02:47,000 --> 00:02:50,000 is the next sequence number that the receiver is expecting to receive. 37 00:02:51,000 --> 00:02:54,000 This field acknowledges receipt of all prior bytes. 38 00:02:55,000 --> 00:03:00,000 The fist ACK or acknowledgement sent by each end 39 00:03:01,000 --> 00:03:06,000 acknowledges the other ends initial sequence number but no data. 40 00:03:07,000 --> 00:03:15,000 The header length or data offset specifies the size of the TCP header in 32 bit words. 41 00:03:16,000 --> 00:03:21,000 The minimum size of the header is 5 words and the maximum is 15 words. 42 00:03:22,000 --> 00:03:25,000 The minimum size of the header is 20 bytes 43 00:03:26,000 --> 00:03:29,000 and the maximum size of the header is 60 bytes in IPv4 44 00:03:30,000 --> 00:03:37,000 which allows for up to 40 bytes of options in the header. 45 00:03:38,000 --> 00:03:43,000 The reserve fill the set to 0 and is reserve for future use. 46 00:03:44,000 --> 00:03:49,000 Now there are lot of flags or control bits available in the TCP header 47 00:03:50,000 --> 00:03:51,000 and we won’t go through all of them. 48 00:03:52,000 --> 00:03:57,000 The Congestion Window Reduced Flag is part of a congestion notification mechanism 49 00:03:58,000 --> 00:04:02,000 used in conjunction with the ECE bit or flag 50 00:04:03,000 --> 00:04:08,000 or echo congestion notification echo field or flag. 51 00:04:09,000 --> 00:04:10,000 Once again used in congestion notification. 52 00:04:11,000 --> 00:04:15,000 This can be used in quality of service where the network 53 00:04:16,000 --> 00:04:19,000 and the host communicate to indicate congestion 54 00:04:20,000 --> 00:04:23,000 therefore letting the transmitter know that it needs to slowdown. 55 00:04:24,000 --> 00:04:27,000 The URG flag can indicate that this segment is urgent 56 00:04:28,000 --> 00:04:29,000 and should be process as soon as possible. 57 00:04:30,000 --> 00:04:34,000 The ACK flag as mentioned is used for acknowledgement of data. 58 00:04:35,000 --> 00:04:41,000 PSH is the flag set by TCP sender 59 00:04:42,000 --> 00:04:44,000 to cause the TCP receiver to immediately pass 60 60 00:04:45,000 --> 00:04:48,000 that segment's data to the receivers application socket 61 00:04:49,000 --> 00:04:55,000 along with all other in order data that the receiver is yet to give to that application. 62 00:04:56,000 --> 00:05:01,000 Reset; resets the connection in other words, the connection is turned down. 63 00:05:02,000 --> 00:05:05,000 SYN is used to synchronize sequence numbers. 64 00:05:06,000 --> 00:05:12,000 Only the first packet sent from each end will have this flag set. 65 00:05:13,000 --> 00:05:17,000 FIN means that there is no more data from the sender. 66 00:05:18,000 --> 00:05:21,000 The window size which is 16 bits in length 67 00:05:22,000 --> 00:05:24,000 specifies the size of the received window 68 00:05:25,000 --> 00:05:30,000 which is the number of bytes that the receiver is currently willing to receive 69 00:05:31,000 --> 00:05:35,000 we'll be talking more about flow control and window sizes in a moment. 70 00:05:36,000 --> 00:05:39,000 TCP also includes a 16 bits TCP checksum 71 00:05:40,000 --> 00:05:43,000 which is used for error checking of the header and the data. 72 00:05:44,000 --> 00:05:49,000 The 16 bit urgent pointer is used with the URG flag 73 00:05:50,000 --> 00:05:55,000 which when set on means that the 16 bit urgent pointer is used. 74 00:05:56,000 --> 00:06:02,000 This indicates an offset from the sequence number indicating the last urgent data byte. 75 00:06:03,000 --> 00:06:05,000 There are also various options available in the TCP 76 00:06:06,000 --> 00:06:10,000 but this are out of the scope of this course. 77 00:06:11,000 --> 00:06:15,000 And lastly we have the data, which is the data from higher layer protocols 78 00:06:16,000 --> 00:06:18,000 encapsulated within the TCP header. 79 00:06:19,000 --> 00:06:26,000 There are some examples of applications that rely on either TCP or UDP. 80 00:06:27,000 --> 00:06:33,000 Examples are file transfer protocols include; FTP or File Transfer Protocol 81 00:06:34,000 --> 00:06:40,000 TFTP or Trivial File Transfer Protocol, NFS or Network File System. 82 00:06:41,000 --> 00:06:49,000 In email we tend to use POP3 or Post Office Protocol to receive mail 83 00:06:50,000 --> 00:06:54,000 Simple Mail Transfer Protocol or SMTP to send mail 84 00:06:55,000 --> 00:06:58,000 or IMAP or Internet Message Access Protocol 85 00:06:59,000 --> 00:07:02,000 which is another protocol used for email retrieval 86 86 00:07:03,000 --> 00:07:05,000 For remote log in to devices, we could use telnet 87 00:07:06,000 --> 00:07:09,000 which sends traffic in clear text 88 00:07:10,000 --> 00:07:13,000 and is therefore in secure or secure SHELL or SSH 89 00:07:14,000 --> 00:07:16,000 which allows for a secure connection to remote devices. 90 00:07:17,000 --> 00:07:23,000 For network management we can use Simple Network Management Protocol or SNMP 91 00:07:24,000 --> 00:07:27,000 and for name management we can use Domain Name System 92 00:07:28,000 --> 00:07:31,000 which allows for the use of names rather than IP addresses 93 00:07:32,000 --> 00:07:35,000 and translates those meaningful domain names, into IP addresses 94 00:07:36,000 --> 00:07:40,000 so for instance cisco.com will be converted to an IP address 95 00:07:41,000 --> 00:07:43,000 when a user browses the internet. 96 00:07:44,000 --> 00:07:47,000 Before continuing I wanna mention again how the mappings work 97 00:07:48,000 --> 00:07:50,000 between the different layers of the OSI model. 98 00:07:51,000 --> 00:07:56,000 At layer 2 in an Ethernet 2 frame, there’s a field called the type number 99 99 00:07:57,000 --> 00:08:01,000 which allows a host to differentiate between multiple layer 3 protocols 100 100 00:08:02,000 --> 00:08:08,000 at layer 3, remember you could be using a protocol like IPv4 or IPv6 101 101 00:08:09,000 --> 00:08:12,000 or in the old days IPX or apple talk. 102 00:08:13,000 --> 00:08:20,000 So at layer 2 the NEC needs to know which layer 3 protocol to send this traffic to 103 00:08:21,000 --> 00:08:25,000 and the type number is used to differentiate the different layer 3 protocols. 104 00:08:26,000 --> 00:08:31,000 At layer 3 a protocol number is used to differentiate 105 105 00:08:32,000 --> 00:08:37,000 the different protocols running at layer 4, so in an IP header 106 00:08:38,000 --> 00:08:43,000 the protocol field will denote where the TCP or UDP is being used at layer 4 107 00:08:44,000 --> 00:08:52,000 At layer 4 a port number is used to differentiate multiple applications being use at layer 7. 108 108 00:08:53,000 --> 00:08:59,000 So it’s important to note that at layer 4 the way TCP or UDP 109 00:09:00,000 --> 00:09:04,000 know which application this traffic is destined to is by the port number.