1 / 52

CSCI-690 C omputer Networks: Shrinking the globe one click at a time Lecture 3

CSCI-690 C omputer Networks: Shrinking the globe one click at a time Lecture 3. Khurram Kazi. Major sources of the slides for this lecture. Slides from Tanenbaum’s and William Stallings’ website are used in this lecture

chloe-brock
Download Presentation

CSCI-690 C omputer Networks: Shrinking the globe one click at a time Lecture 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI-690Computer Networks:Shrinking the globe one click at a timeLecture 3 Khurram Kazi CSCI 690

  2. Major sources of the slides for this lecture • Slides from Tanenbaum’s and William Stallings’ website are used in this lecture • Interworking with TCP/IP, M9000-02, Global knowledge, training manual, (http://am.globalknowledge.com) • Teach yourself TCP/IP in 24 hours, Joe Casad, Bob Willsey, SAMS • The Internet and Its Protocol, Adrian Farrel’s book. CSCI 690 2

  3. Topics for the next few weeks • For the next few weeks we will concentrate on: • Protocols • IP • TCP / UDP • IP Addressing • Go through an example of the Life of a Packet in a Network • In the process we will develop a functional model of a ROUTER. CSCI 690 3

  4. Reference Network: For discussion purposes CSCI 690 4

  5. Source of IP Traffic • Application Traffic type could be • FTP (file transfer) • Instant messaging • Secure or non-secure web access • Streaming video • Document sharing (similar to net meeting) • Database access (across the street or across the continent) • Voice over IP • It all boils down to what protocols are used CSCI 690 5

  6. Summarizing Features of the Protocol Functions • have a small set of functions that form basis of all protocols • Encapsulation (e.g. IP packets encapsulated in Ethernet frames) • fragmentation and reassembly (e.g. fragmentation of a file during an FTP and reassembly of it at the destination) • connection control (e.g. during TCP session) • ordered delivery • flow control • error control • addressing • multiplexing • transmission services CSCI 690 6

  7. PDUs (Protocol Data Units) and Fragmentation Example: Fragmentation seen during file transfer using FTP This can be a TCP component of the Packet This can be an IP Packet CSCI 690 7

  8. Demonstrate file transfer using FTP while capturing the data by Wireshark Starting from the traffic source CSCI 690 8

  9. Fragmentation and Reassembly • Protocol exchanges data between two entities • Lower-level protocols may need to break data up into smaller blocks, called fragmentation • For various reasons • Network only accepts blocks of a certain size • More efficient error control & smallerretransmission units • Fairer access to shared facilities • Smaller buffers • Disadvantages • Smaller buffers • More interrupts & processing time CSCI 690 9

  10. Starting the protocol stack analysis with The IP Protocol (RFC 791) http://www.ietf.org/rfc/rfc0791.txt?number=791 The IPv4 (Internet Protocol) header. CSCI 690 10

  11. IP Header Fields continued • Version (4 bits) • (whether the format is of type) • currently IP v4 • IP v6 • Internet Header Length (IHL) (4 bits) • Is the length of header in 32 bit words, • Points to the beginning of the data (payload) • including options • Minimum value for a correct header is 5 CSCI 690 11

  12. IP Header Fields continued Type of Service (8 bits) (see RFC 791 for details) • Is an indication of the abstract parameters of the Quality of Service (QoS) desired. These parameters are to be used to guide the selection of the actual service parameters when transmitting a datagram through a particular network. Several networks offer service precedence, which somehow treats high precedence traffic as more important than other traffic (generally by accepting only traffic above a certain precedence at time of high load). The major choice is a three way tradeoff between low-delay, high-reliability, and high-throughput. Bits 0-2: Precedence: Primarily used within a particular network 111 - Network Control 110 - Internetwork Control 101 - CRITIC/ECP 100 - Flash Override 011 - Flash 010 - Immediate 001 - Priority 000 - Routine CSCI 690 12

  13. IP Header Fields continued Type of Service (8 bits) (see RFC 791 for details) • Is an indication of the abstract parameters of the Quality of Service (QoS) desired. These parameters are to be used to guide the selection of the actual service parameters when transmitting a datagram through a particular network. Several networks offer service precedence, which somehow treats high precedence traffic as more important than other traffic (generally by accepting only traffic above a certain precedence at time of high load). The major choice is a three way tradeoff between low-delay, high-reliability, and high-throughput. Bit 3: 0 = Normal Delay, 1 = Low Delay. Bits 4: 0 = Normal Throughput, 1 = High Throughput. Bits 5: 0 = Normal Reliability, 1 = High Reliability. Bit 6 1 = minimize monetary cost [defined in RFC 1349] Bit 7: Reserved for Future Use. Only one of the bits [6:3] can be set to a 1 CSCI 690 13

  14. IP Header Fields continued • Total Length (16 bits) • Total Length is the length of the datagram, measured in octets, including internet header and data. This field allows the length of a datagram to be up to 65,535 octets. Such length of a datagram are impractical for most hosts and networks. Since there is no “end of datagram” character/indicator, network hosts use the datagram length to figure out when the datagram ends and other network data begins. Q. Can an IP datagram be as large as 65,535 octets when the data is transmitted over Ethernet (in LAN applications)? CSCI 690 14

  15. IP Header Fields continued • Identification (16 bits) • An identifying value assigned by the sender to aid in assembling the fragments of a datagram. It is assigned by the originating host. At the source, there is one-to-one relation between datagrams and datagram identifier. As these datagrams traverse the network, they could be split. Hence this field is used by the receiving host to reassemble the original datagram. CSCI 690 15

  16. IP Header Fields continued • Flags (3 bits) Bit 0: reserved, must be zero Bit 1: (DF) 0 = May Fragment, 1 = Don't Fragment. Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments. • If the datagram cannot be routed without being fragmented, the router will throw it away and send an error message back to the originating host. • When MF=1, it means that the datagram is one of the two or more fragments, but not the last one of the fragments. Receiving hosts use this flag along with the fragment offset to reassemble the fragmented datagrams. CSCI 690 16

  17. IP Header Fields continued • Fragment Offset (13 bits) • This field specifies how many units from the start of the original datagram the current datagram is. In other words, the first fragment datagram would have a value of 0 for the offset; if the second datagram starts 100 units from the beginning of the original datagram, the offset would be 100. the unit size is eight bytes (instead of one byte) since the field is only 13 bits wide. CSCI 690 17

  18. IP Header Fields continued • Time to Live (8 bits) • This field indicated how long the datagram should be allowed to exist after entering the internetwork, measuring in seconds (maximum TTL is 255). Presently as datagrams traverse a router, this number is decremented by one. • This informally represents the maximum number of hops that a datagram can make before being discarded. CSCI 690 18

  19. IP Header Fields continued • Protocol (8 bits) • This field identifies the next higher layer protocol of the data being carried in the datagram. 01 hex ICMP 06 hex TCP 11 hex UDP http://www.ietf.org/rfc/rfc1700.txt?number=1700lists the different protocols and their identifier numbers CSCI 690 19

  20. IP Header Fields continued • Header Checksum (16 bits) • This field provides error checking on the IP header only, and does not cover the data that is carried at the end of the header. If the header is extended using the options field, then the checksum includes the extended header field too. • If the target IP-addressed interface receives a datagram with a failed checksum, the entire datagram is silently discarded. CSCI 690 20

  21. IP Header Fields continued • Source IP Address (32 bits) • The sender’s interface’s 32-bit Internet address is identified in four bytes/octets. • e.g. • C0 99 B8 01 Four pair of Hex characters • 192.153.184.1 • Find the decimal equivalent of the following IP address represented in Hex • 0F 10 07 11 • ---.---.---.--- ?? CSCI 690 21

  22. IP Header Fields continued • Destination IP Address (32 bits) • The target’s host’s 32-bit Internet address is identified in four bytes/octets. • e.g. • C0 99 B8 03 Four pair of Hex characters • 192.153.184.3 CSCI 690 22

  23. Connectionless Transport with User Datagram Protocol (UDP) • Connectionless protocols have the ability to transmit messages without first establishing a circuit. • The network does not need to do anything except transmit packets to the destination • All error checking and flow control is handled by the sending and receiving applications CSCI 690 23

  24. Advantages and disadvantages of UDP • Speed • UDP offers speed as it carries short messages between hosts on the same network • Can be used in events where a single packet of data needs to be exchanged between hosts • Reliability • In UDP the data is transmitted “blindly” as opposed to sending the data and waiting for an acknowledgement. This may result in data loss • Only application layer deals with error recovery • Applications can simply turn to the user to send the message again! • Optional checksum CSCI 690 24

  25. UDP Header CSCI 690 25

  26. UDP Header • The process layer uses TCP or UDP to pass information to the internetwork layer. It is necessary to identify the client or server tasks uniquely so that the information is passed to the proper service or user task. The identification used in the TCP/IP protocol is called the “Port Number”. • UDP and TCP identify server tasks by using a port number that is consistent and well known. To access a service such as DNS (Domain Name Server), the software knows that DNS is waiting for sessions to be established at port 53. • Client tasks are identified by using port numbers that are variable and temporary, called random port numbers. The client random port numbers exist during the communication process and are discarded when the communication process is complete. CSCI 690 26

  27. UDP Headers CSCI 690 27

  28. UDP Headers The term sockets refers to both an API (application program interface) between host systems and the TCP/IP applications, and a pairing of the IP address and the port number being used. It is also considered the complete network address of an end of the UDP session. In the language of UDP, the sockets in the figure are 192.136.118.30,53 and 192.153.118.30,8193 This indicates the client is asking for DNS service CSCI 690 28

  29. Connection Oriented protocol CSCI 690 29

  30. Connection Oriented Protocol • A connection oriented protocol establishes and maintains a connection between communicating computers and monitors the state of that connection over the course of transmission. Each package of data sent across the network receives an acknowledgement, and the sending machine records status information to ensure each package is received without errors. At the end of the transmission, the sending and receiving computers gracefully close the connection. • This method is used by reliable transport services • TCP is connection oriented protocol. [RFC 793] CSCI 690 30

  31. Features of TCP [RFC 793]: Stream Oriented Processing • TCP processes data in a bytes stream. TCP formats the data into variable length segments which it will pass to the IP Layer. • In general, the TCPs decide when to block and forward data at their own convenience. Sometimes users need to be sure that all the data they have submitted to the TCP has been transmitted. For this purpose a push function is defined. • To assure that data submitted to a TCP is actually transmitted the sending user indicates that it should be pushed through to the receiving user. A push causes the TCPs to promptly forward and deliver data up to that point to the receiver. The exact push point might not be visible to the receiving user and the push function does not supply a record boundary marker. CSCI 690 31

  32. Features of TCP: Reliability/Re-sequencing • The TCP must recover from data that is damaged, lost, duplicated, or delivered out of order by the internet communication system. This is achieved by assigning a sequence number to each octet transmitted, and requiring a positive acknowledgment (ACK) from the receiving TCP. • If the ACK is not received within a timeout interval, the data is retransmitted. At the receiver, the sequence numbers are used to correctly order segments that may be received out of order and to eliminate duplicates. • Damage is handled by adding a checksum to each segment transmitted, checking it at the receiver, and discarding damaged segments. CSCI 690 32

  33. Features of TCP: Flow Control • TCP flow control feature ensures that the data transmission will not overflow or underflow the destination machine’s capability to receive data. This is a very critical feature as different machines may have different processor speeds and buffer sizes. • TCP provides a means for the receiver to govern the amount of data sent by the sender. This is achieved by returning a "window" with every ACK indicating a range of acceptable sequence numbers beyond the last segment successfully received. The window indicates an allowed number of octets that the sender may transmit before receiving further permission. CSCI 690 33

  34. Features of TCP:Multiplexing • To allow for many processes within a single Host to use TCP communication facilities simultaneously, the TCP provides a set of addresses or ports within each host. Concatenated with the network and host addresses from the internet communication layer, this formsa socket. A pair of sockets uniquely identifies each connection. That is, a socket may be simultaneously used in multiple connections. • The binding of ports to processes is handled independently by each Host. However, it proves useful to attach frequently used processes (e.g., a "logger" or timesharing service) to fixed sockets which are made known to the public. These services can then be accessed through the known addresses. Establishing and learning the port addresses of other processes may involve more dynamic mechanisms. CSCI 690 34

  35. Features of TCP:Connections • The reliability and flow control mechanisms described above require that TCPs initialize and maintain certain status information for each data stream. The combination of this information, including sockets, sequence numbers, and window sizes, is called a connection. Each connection is uniquely specified by a pair of sockets identifying its two sides. • When two processes wish to communicate, their TCP's must first establish a connection (initialize the status information on each side). When their communication is complete, the connection is terminated or closed to free the resources for other uses. • Since connections must be established between unreliable hosts and over the unreliable internet communication system, a handshake mechanism with clock-based sequence numbers is used to avoid erroneous initialization of connections. • Graceful termination: The graceful termination feature ensures that all segments have been sent and received before a connection is closed. CSCI 690 35

  36. Features of TCP:Connections; in a nutshell • A connection is established between {source IP address, source port} and {destination IP address, destination port}. • Connection ensures that applications are present at both sender and receiver and negotiates capabilities for use on the connection. CSCI 690 36

  37. The TCP Segment Header CSCI 690 37

  38. TCP Headers explained • Source port: (16 bits) – The port number assigned to the application on the source machine • Destination port: (16 bits) – The port number assigned to the application on the destination machine CSCI 690 38

  39. TCP Headers explained • Sequence Number: (32 bits) – The number of the first byte in this particular segment, unless SYN flag is set to one. If SYN Flag is set to a 1, the sequence number field provides the Initial Sequence Number (ISN), which is used to synchronize sequence numbers. • Sequence number DOES NOT represent how many bytes of user data may be in that segment • # of bytes of user data = IP total length – (IP + TCP Header bytes) CSCI 690 39

  40. TCP Headers explained • Sequence Number: The sequence number are chosen arbitrarily, rather than always starting at some standard number (e.g. 1). This to avoid confusing the system when a host unexpectedly is turned off (or crashes). If the system came back up soon enough after having started a TCP connection and attempted to reopen that connection, the remote would not be able to determine if the data being sent was a duplicate copy of the data it already received. CSCI 690 40

  41. TCP Headers explained • Acknowledgement Number: (32 bits) -- This number acknowledges a received segment. The value is the next sequence number the receiving computer is expecting to receive; in other words, the sequence number of the last byte received + 1. • For example from the sender if the seq. # was 12, then the ack. Seq. # sent from the receiver to the sender will be 13 (which 12 + 1). CSCI 690 41

  42. TCP Headers explained • TCP Header Length: (4 bits) – The field tells the length of the TCP header. It is expressed as an integer number of 32-bit words. For example a value of 5 will translate into 20 bytes. CSCI 690 42

  43. TCP Headers explained: Session Bits Flags • First two bits of the octet are reserved, i.e. not used. • URG – Urgent data: If this bit is set to a 1, some of the data in this segment must be processed before all other data. The data usually makes changes in the state of the session. • ACK – Valid Acknowledgement: When this bit is set to a 1, the data in the acknowledgement field is a valid number. • PSH – Push Request: When set to a 1, it tells the TCP software to push all the data sent so far through the pipeline to the receiving application. • RST – Reset Session: A value of 1 resets the connection. • SYN – When set to a 1, it announces that the sequence numbers will be synchronized, marking the beginning of a connection. • FIN– Final Data: A value of 1 signifies that the sending computer has no more data to transmit. This flag is used to close a connection. CSCI 690 43

  44. TCP Headers explained • Window Size: (16 bits) A parameter used for flow control. The window size defines the range of sequence numbers beyond the last acknowledged sequence number that the sending machine is free to transmit without further acknowledgement. • http://www.raduniversity.com/networks/2004/sliding_window/demo.html • http://www.kom.e-technik.tu-darmstadt.de/projects/iteach/itbeankit/Applets/Sliding_Window/sliding_window.html#Selective%20Repeat CSCI 690 44

  45. TCP Headers explained • Checksum: The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit words in the header and text. If a segment contains an odd number of header and text octets to be checksummed, the last octet is padded on the right with zeros to form a 16 bit word for checksum purposes. The pad is not transmitted as part of the segment. • The checksum also covers a 96 bit pseudo header conceptually prefixed to the TCP header. This pseudo header contains the Source Address, the Destination Address, the Protocol, and TCP length. This gives the TCP protection against misrouted segments. CSCI 690 45

  46. Fields used in calculating Checksum including Pseudo Header # of bytes of user data = IP total length – (IP Header bytes) CSCI 690 46

  47. Fields used in calculating Checksum including Pseudo Header (for UDP) CSCI 690 47

  48. Example of Checksum Calculation FFFF = 65535 40280 + 32785 = 73065; In Hex 9D58 + 8011 = 11D69 73065 – 65535 = 7530; In Hex remove the MSB and add 1 to 1D69 = 1D69 + 1 = 1D6A CSCI 690 48

  49. TCP Headers explained • Urgent Pointer: (16 bits) An offset pointer pointing to the sequence number that marks the beginning of any urgent information. Typically it is 0000 Hex. • When the target device is congested or has other data throughput problems, it clears the correct amount of buffer space to receive and process the urgent message. CSCI 690 49

  50. Connection Establishment • TCP connections are established and maintained on demand from applications and are kept active (barring network failure) until the applications explicitly release them • In order for the TCP connection to be established, the receiver must be listening– (similar to when a phone call is made the other party has to be present to answer it) • The application goes into listen mode CSCI 690 50

More Related