Download presentation
Presentation is loading. Please wait.
1
1 TDC365-03 TDC 365 Network Interconnections Technologies Lecture #4 Notes Spring, 2009
2
2 TDC365-03 Lecture 4 Topics IP Protocol and Operations (Chapter 8) IP Protocol and Operations (Chapter 8) IP Header and packet format IP Header and packet format Packet Fragmentation Packet Fragmentation options options checksum checksum Internet Control Message Protocol (ICMP) (Chapter 9) Internet Control Message Protocol (ICMP) (Chapter 9)
3
3 TDC365-03 3 Internet Protocol Network layer protocol (layer 3) Network layer protocol (layer 3) The Internet is named after this protocol The Internet is named after this protocol “Unreliable” best effort service “Unreliable” best effort service Connectionless Connectionless Packets in IP layer are called “Datagrams” Packets in IP layer are called “Datagrams” a variable-length packet consisting of two parts: header and data. 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. 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) 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 Each datagram is handled independently and can follow different paths to the destination
4
4 TDC365-03 4 Position of IP in TCP/IP protocol suite
5
5 TDC365-03 5 IP Field Format
6
6 TDC365-03 IP Header Fields Version: IP protocol version. Version: IP protocol version. We are currently on IP version 4. Soon the Internet may be moved to IP version 6. We are currently on IP version 4. Soon the Internet may be moved to IP version 6. 4 bit field – value 0100 4 bit field – value 0100 IP Header Length(HLEN) IP Header Length(HLEN) 4 bit field 4 bit field Length of IP header in 32-bit words. Length of IP header in 32-bit words. Min. value = 5 (20 bytes) Min. value = 5 (20 bytes) Max. value = 15 (60 bytes) Max. value = 15 (60 bytes)
7
7 TDC365-03 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.
8
8 TDC365-03 Protocol Field Protocol field Protocol field IP carries PDUs of multiple protocols (e.g. TCP, UDP, ICMP) IP carries PDUs of multiple protocols (e.g. TCP, UDP, ICMP) The Protocol field contains a code that tells them apart The Protocol field contains a code that tells them apart
9
9 TDC365-03 Not all finalized, Read yourself (pg 183) Service Type or Differentiated Services
10
10 TDC365-03 Type of Service Indicates packet precedence and path optimization type (currently ignored by ALL routers): 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) 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
11
11 TDC365-03 Packet Size Calculation example 1 Question: 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 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.
12
12 TDC365-03 Example 3 Packet Size Calculation example 2 Question: Question: In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816. How many bytes of data are being carried by this packet? In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816. How many bytes of data are being carried by this packet? Solution 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). 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).
13
13 TDC365-03 IP Header Fields (con’t) Identification / Fragment Offset: Identification / Fragment Offset: used to identify fragments that are formed when an IP packet needs to be broken up into smaller packets used to identify fragments that are formed when an IP packet needs to be broken up into smaller packets Time to Live: 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. 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: Header Checksum: Allows error checking of IP packets Allows error checking of IP packets Source Address: Source Address: 4-byte IP source address for this packet 4-byte IP source address for this packet Destination Address: Destination Address: 4-byte IP destination address for this packet 4-byte IP destination address for this packet
14
14 TDC365-03 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? Solution To 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). Example 4
15
15 TDC365-03 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) 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) 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. Fragments are reassembled by IP software at destination host.
16
16 TDC365-03 IP Header Fields Used for Fragmentation Identification: Identification: This is a random value chosen by the sender. If a packet is fragmented, the same ID value is copied into all fragments. This is a random value chosen by the sender. If a packet is fragmented, the same ID value is copied into all fragments. Flags: Flags: Don’t Fragment (DF) bit - Set to 1 if this packet should not be fragmented, 0 otherwise 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. More Fragments (MF) bit – Set to 1 if packet has been fragmented and this is not the last fragment, 0 otherwise. Fragment Offset: Fragment Offset: 13 bit field shows relative position of this fragment with respect to the whole datagram 13 bit field shows relative position of this fragment with respect to the whole datagram Highest value can be 213-1 = 8191 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 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. 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) This means that we can fragment a datagram of maximum length of 65535 (8192 * 8)
17
17 TDC365-03 Flags field L2 (Mainly for diagnostic purpose) = 0 this is the last fragment = 1 more fragments to follow MTU (Maximum Transfer Unit)
18
18 TDC365-03 IP Fragmentation Example Question: 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? 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: Solution: The 4000 bytes is broken into fragments as follows (IP header size not included): The 4000 bytes is broken into fragments as follows (IP header size not included): Fragment #1: 1400 bytes of data Fragment #1: 1400 bytes of data Fragment #2: 1400 bytes of data Fragment #2: 1400 bytes of data Fragment #3: 1200 bytes of data Fragment #3: 1200 bytes of data
19
19 TDC365-03 19 Fragmentation Example
20
20 TDC365-03 IP Fragmentation Example Further assume that Fragment #2 (containing 1400 data bytes) is later sent over an L2 subnet with MTU of 820 bytes. 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.1 contains 800 data bytes Fragment #2.2 contains 600 data bytes Fragment #2.2 contains 600 data bytes
21
21 TDC365-03 21 Total length Identification Fragment Offset Flag More Fragment Detailed fragmentation example
22
22 TDC365-03 22 Categories of Options
23
23 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
24
24 TDC365-03 24 End of option No-Op and End-Op
25
25 TDC365-03 Determines how many addresses to be recorded Byte number of the first empty entry 1 st 3 bytes of overhead 1 st entry starts at 4 Total 15 bytes Record Route
26
26 TDC365-03 26 Source Routing Normally IP routing is dynamic where each router makes its own decision about the next hop router Normally IP routing is dynamic where each router makes its own decision about the next hop router Applications have no control, nor are concerned Applications have no control, nor are concerned In source routing, on the other hand, the sender specifies the route In source routing, on the other hand, the sender specifies the route Strict source routing Strict source routing Sender specifies exact path – ICMP error if unspecified router is visited Sender specifies exact path – ICMP error if unspecified router is visited Loose source routing Loose source routing Sender specifies a list of IP addresses that the datagram must traverse, but the datagram can also pass thru other routers 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!! The destination address changes at each hop!!
27
27 TDC365-03 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 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 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
28
28 TDC365-03 28 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 Timestamp
29
29 TDC365-03 IP Header Checksum Sender IP Checksum calculation: Sender IP Checksum calculation: Split IP header into 16-bit fields Split IP header into 16-bit fields Add fields together (set Checksum to 0) Add fields together (set Checksum to 0) Truncate result to 16 bits Truncate result to 16 bits 1-s Complement result 1-s Complement result Put into Checksum field, send packet Put into Checksum field, send packet Receiver Checksum check: Receiver Checksum check: Perform same calculation (with nonzero checksum) Perform same calculation (with nonzero checksum) If result is not zero, discard IP packet If result is not zero, discard IP packet
30
30 TDC365-03 Checksum Concept
31
31 TDC365-03 1’s complement Checksum Example
32
32 TDC365-03 32 Read Yourself.. Section 8.5 – IP Package Section 8.5 – IP Package Especially the algorithms Especially the algorithms Processing Module Processing Module Fragmentation Module Fragmentation Module Reassembly Module Reassembly Module
33
33 TDC365-03 ICMP (Internet Control Message Protocol) Companion to IP Companion to IP Network layer protocol, but encapsulated in IP datagrams Network layer protocol, but encapsulated in IP datagrams What happens when errors occur in delivering IP packets? What happens when errors occur in delivering IP packets? ICMP messages are used for Error Reporting ICMP messages are used for Error Reporting What if a host needs more information about the network? What if a host needs more information about the network? ICMP messages are used for Status Queries ICMP messages are used for Status Queries
34
34 TDC365-03 ICMP Design
35
35 TDC365-03 General format of ICMP messages ICMP Encapsulation
36
36 TDC365-03 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
37
37 TDC365-03 Error-reporting messages Query messages ICMP Messages
38
38 TDC365-03 ICMP messages
39
39 TDC365-03 ICMP Error Reports Read more yourself –pgs 214-216 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. 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 Destination Unreachable IP packet destination does not exist or cannot be reached IP packet destination does not exist or cannot be reached One case is Fragmentation required, but DF bit is set One case is Fragmentation required, but DF bit is set Another is source routing cannot be accomplished Another is source routing cannot be accomplished Source Quench Source Quench informs the source that a datagram has been discarded due to congestion in a router or the destination host informs the source that a datagram has been discarded due to congestion in a router or the destination host Used for limited flow control Used for limited flow control Time Exceeded 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 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 All fragments did not arrive before fragment reassembly timeout Parameter Problem Parameter Problem Error in header parameters in datagram Error in header parameters in datagram Redirection Redirection A better route to destination is known A better route to destination is known
40
40 TDC365-03 ‘Wrong’ router ‘Correct’ routerRedirection 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
41
41 TDC365-03 ICMP Query Messages Sent by host (typically) to diagnose network Sent by host (typically) to diagnose network Echo Request / Reply Echo Request / Reply Used for “ping” Used for “ping” Time Stamp Request / Reply Time Stamp Request / Reply “ping” with timestamps (ping –s) “ping” with timestamps (ping –s) Address Mask Request / Reply Address Mask Request / Reply Asks for IP Subnet Mask for current subnet Asks for IP Subnet Mask for current subnet Router Solicitation / Advertisement Router Solicitation / Advertisement To find local router To find local router
42
42 TDC365-03 Ping and Traceroute Ping Ping To find if a host is alive and responding To find if a host is alive and responding -R for record route -R for record route Traceroute Traceroute Trace route from source to destination Trace route from source to destination -g for loose source routing, -G for strict source routing -g for loose source routing, -G for strict source routing
43
43 TDC365-03 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 A then sends to B a UDP msg with TTL=2 R2 decrements TTL to 0, discards the packet, sends ‘time exceeded’ msg to A with its own IP A sends to B a UDP msg with TTL = n and unsupported port B decrements TTL to 0, sends ‘destination unreachable’ msg to A with its own IP Traceroute Operation
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.