1 / 43

TDC 365 Network Interconnections Technologies Lecture #4 Notes Spring, 2009

TDC 365 Network Interconnections Technologies Lecture #4 Notes Spring, 2009. Lecture 4 Topics. IP Protocol and Operations (Chapter 8) IP Header and packet format Packet Fragmentation options checksum Internet Control Message Protocol (ICMP) (Chapter 9). Internet Protocol.

Download Presentation

TDC 365 Network Interconnections Technologies Lecture #4 Notes Spring, 2009

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. TDC 365Network Interconnections TechnologiesLecture #4 NotesSpring, 2009 TDC365-03

  2. Lecture 4 Topics • IP Protocol and Operations (Chapter 8) • IP Header and packet format • Packet Fragmentation • options • checksum • Internet Control Message Protocol (ICMP) (Chapter 9) TDC365-03

  3. Internet Protocol • Network layer protocol (layer 3) • The Internet is named after this protocol • “Unreliable” best effort service • Connectionless • Packets in IP layer are called “Datagrams” • a variable-length packet consisting of two parts: header and data. • The header is 20 to 60 bytes in length and contains information essential to routing and delivery. • Header has a fixed part (20 bytes) and variable part of options (maximum 40 bytes) • Each datagram is handled independently and can follow different paths to the destination 3 TDC365-03

  4. Position of IP in TCP/IP protocol suite 4 TDC365-03

  5. IP Field Format 5 TDC365-03

  6. IP Header Fields • Version: IP protocol version. • We are currently on IP version 4. Soon the Internet may be moved to IP version 6. • 4 bit field – value 0100 • IP Header Length(HLEN) • 4 bit field • Length of IP header in 32-bit words. • Min. value = 5 (20 bytes) • Max. value = 15 (60 bytes) TDC365-03

  7. Total Length Field • Total Length field: Length of IP packet in bytes (including header) • maximum 65535 (216 -1) bytes • Why do we need the Total Length Field? • For Ethernet to work properly, this portion must be at least 46 bytes long. • We need the Total Length field in IP to know the actual length of data, since IP datagram can be less than 46 bytes, and would require padding. TDC365-03

  8. Protocol Field • Protocol field • IP carries PDUs of multiple protocols (e.g. TCP, UDP, ICMP) • The Protocol field contains a code that tells them apart TDC365-03

  9. Service Type or Differentiated Services Not all finalized, Read yourself (pg 183) TDC365-03

  10. Type of Service • Indicates packet precedence and path optimization type (currently ignored by ALL routers): • 3 bit precedence - 0 normal, 7 control packet (has never been used in v4) 1000 D bit – Minimize Delay 0100 T bit – Maximize Throughput 0010 R bit – Maximize Reliability 0001 C bit – Minimize Cost Default Type of Service TDC365-03

  11. Packet Size Calculationexample 1 • Question: In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet? • Solution The HLEN value is 8, which means the total number of bytes in the header is 8 × 4 or 32 bytes. The first 20 bytes are the base header, the next 12 bytes are the options. TDC365-03

  12. Packet Size Calculationexample 2 Example 3 • Question: • In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816 . Howmany bytes of data are being carried by this packet? • Solution • The HLEN value is 5, which means the total number of bytes in the header is 5 × 4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (40 − 20). TDC365-03

  13. IP Header Fields (con’t) • Identification / Fragment Offset: • used to identify fragments that are formed when an IP packet needs to be broken up into smaller packets • Time to Live: • Max. number of routers this IP packet may pass through. This field is decremented by each router the packet passes through. If it reaches zero, packet will be discarded. • Header Checksum: • Allows error checking of IP packets • Source Address: • 4-byte IP source address for this packet • Destination Address: • 4-byte IP destination address for this packet TDC365-03

  14. Example 4 An IP packet has arrived with the first few hexadecimal digits as shown below: 45000028000100000102 . . . How many hops can this packet travel before being dropped? The data belong to what upper layer protocol? SolutionTo find the time-to-live field, we skip 8 bytes (16 hexadecimal digits). The time-to-live field is the ninth byte, which is 01. This means the packet can travel only one hop. The protocol field is the next byte (02), which means that the upper layer protocol is IGMP (see slide 7). TDC365-03

  15. IP Packet Fragmentation • The format and size of a frame depends on the protocol used by the physical network. Each layer 2 protocol has a maximum transmission unit (MTU) size (max. frame data size) • If a router determines that an IP packet length exceeds the MTU for an outgoing port, it will fragment the packet (that is, break it into smaller packets) • Fragments are reassembled by IP software at destination host. TDC365-03

  16. IP Header Fields Used for Fragmentation • Identification: • This is a random value chosen by the sender. If a packet is fragmented, the same ID value is copied into all fragments. • Flags: • Don’t Fragment (DF) bit - Set to 1 if this packet should not be fragmented, 0 otherwise • More Fragments (MF) bit – Set to 1 if packet has been fragmented and this is not the last fragment, 0 otherwise. • Fragment Offset: • 13 bit field shows relative position of this fragment with respect to the whole datagram • Highest value can be 213-1 = 8191 • If this is a fragment packet, this is set to (byte offset of this packet data in the original packet data) / 8 • Note that this means that all fragments (except possibly last) must contain an exact multiple of 8 bytes of data. • This means that we can fragment a datagram of maximum length of 65535 (8192 * 8) TDC365-03

  17. MTU (Maximum Transfer Unit) Flags field L2 (Mainly for diagnostic purpose) = 0  this is the last fragment = 1  more fragments to follow TDC365-03

  18. IP Fragmentation Example • Question: • Assume a router receives an IP packet containing 4000 bytes of data (not including IP header). The Routing table indicates this should be forwarded onto a subnet with MTU of 1420 bytes. How should this this packet be fragmented to enable L2 subnet transmission? • Solution: • The 4000 bytes is broken into fragments as follows (IP header size not included): • Fragment #1: 1400 bytes of data • Fragment #2: 1400 bytes of data • Fragment #3: 1200 bytes of data TDC365-03

  19. Fragmentation Example 19 TDC365-03

  20. IP Fragmentation Example • Further assume that Fragment #2 (containing 1400 data bytes) is later sent over an L2 subnet with MTU of 820 bytes. • Fragment #2.1 contains 800 data bytes • Fragment #2.2 contains 600 data bytes TDC365-03

  21. Detailed fragmentation example More Fragment Total length Identification Fragment Offset Flag 21 TDC365-03

  22. Categories of Options 22 TDC365-03

  23. IP Options Format Used for testing and debugging • Record Route • Add router address to the header • Strict Source Routing • Gives complete path • Loose Source Routing • Traverse the list of routers in order • Timestamp • Add time stamp as well as router address 23 TDC365-03

  24. No-Op and End-Op End of option 24 TDC365-03

  25. Record Route Byte number of the first empty entry Determines how many addresses to be recorded 1st 3 bytes of overhead 1st entry starts at 4 Total 15 bytes TDC365-03

  26. Source Routing • Normally IP routing is dynamic where each router makes its own decision about the next hop router • Applications have no control, nor are concerned • In source routing, on the other hand, the sender specifies the route • Strict source routing • Sender specifies exact path – ICMP error if unspecified router is visited • Loose source routing • Sender specifies a list of IP addresses that the datagram must traverse, but the datagram can also pass thru other routers • The destination address changes at each hop!! 26 TDC365-03

  27. Strict Source Routing • When an application receives data that was source routed, it should supply a reversed route by fetching the value of the received route • STEP 1 Router compares destination IP withits incoming IP • STEP 2: Router swaps IP address withoutgoing IP and forwards packet • STEP 3: Router also changes dest addrin IP header TDC365-03

  28. Timestamp Figure 8-21 • To record the time at each router, expressed in ms from midnight, Universal time • Estimate, since router clocks may not be synchronized 28 TDC365-03

  29. IP Header Checksum • Sender IP Checksum calculation: • Split IP header into 16-bit fields • Add fields together (set Checksum to 0) • Truncate result to 16 bits • 1-s Complement result • Put into Checksum field, send packet • Receiver Checksum check: • Perform same calculation (with nonzero checksum) • If result is not zero, discard IP packet TDC365-03

  30. Checksum Concept TDC365-03

  31. Checksum Example 1’s complement TDC365-03

  32. Read Yourself.. • Section 8.5 – IP Package • Especially the algorithms • Processing Module • Fragmentation Module • Reassembly Module 32 TDC365-03

  33. ICMP (Internet Control Message Protocol) • Companion to IP • Network layer protocol, but encapsulated in IP datagrams • What happens when errors occur in delivering IP packets? • ICMP messages are used for Error Reporting • What if a host needs more information about the network? • ICMP messages are used for Status Queries TDC365-03

  34. ICMP Design TDC365-03

  35. ICMP Encapsulation General format of ICMP messages TDC365-03

  36. Error Report Encapsulation • First 8 bytes of data are added • contains the port information from transport layer (TCP or UDP) • So that source can inform the transport protocols about the error TDC365-03

  37. Error-reporting messages ICMP Messages Query messages TDC365-03

  38. ICMP messages ICMP messages TDC365-03

  39. ICMP Error Reports • Read more yourself –pgs 214-216 • Sent by router (typically) or host back to the Source Address on data packet when error occurs – includes header of error-causing packet. • Destination Unreachable • IP packet destination does not exist or cannot be reached • One case is Fragmentation required, but DF bit is set • Another is source routing cannot be accomplished • Source Quench • informs the source that a datagram has been discarded due to congestion in a router or the destination host • Used for limited flow control • Time Exceeded • Whenever a router decrements a datagram with a time-to-live (no. of hops) value to zero, it discards the datagram and sends a time-exceeded message • All fragments did not arrive before fragment reassembly timeout • Parameter Problem • Error in header parameters in datagram • Redirection • A better route to destination is known TDC365-03

  40. Redirection • Hosts do not take part in routing update process (ch. 14) used by routers • The static routing table of the host might not be efficient • ‘Wrong’ router forwards datagram to correct router and sends a redirection message to host in the local network ‘Wrong’ router ‘Correct’ router TDC365-03

  41. ICMP Query Messages • Sent by host (typically) to diagnose network • Echo Request / Reply • Used for “ping” • Time Stamp Request / Reply • “ping” with timestamps (ping –s) • Address Mask Request / Reply • Asks for IP Subnet Mask for current subnet • Router Solicitation / Advertisement • To find local router TDC365-03

  42. Ping and Traceroute • Ping • To find if a host is alive and responding • -R for record route • Traceroute • Trace route from source to destination • -g for loose source routing, -G for strict source routing TDC365-03

  43. Traceroute Operation A sends to B a UDP msg with TTL=1 R1 decrements TTL to 0, discards the packet, sends ‘time exceeded’ ICMP msg to A with its own IP R2 decrements TTL to 0, discards the packet, sends ‘time exceeded’ msg to A with its own IP A then sends to B a UDP msg with TTL=2 B decrements TTL to 0, sends ‘destination unreachable’ msg to A with its own IP A sends to B a UDP msg with TTL = n and unsupported port TDC365-03

More Related