tdc 365 network interconnections technologies lecture #4 notes spring, 2009
DESCRIPTION
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. - PowerPoint PPT PresentationTRANSCRIPT
TDC365-03 1
TDC 365TDC 365Network Interconnections Network Interconnections
TechnologiesTechnologies
Lecture #4 NotesLecture #4 NotesSpring, 2009Spring, 2009
TDC365-03 2
Lecture 4 Topics Lecture 4 Topics
IP Protocol and Operations (Chapter 8)IP Protocol and Operations (Chapter 8) IP Header and packet formatIP Header and packet format Packet FragmentationPacket Fragmentation optionsoptions checksumchecksum
Internet Control Message Protocol (ICMP) Internet Control Message Protocol (ICMP) (Chapter 9)(Chapter 9)
TDC365-03 3 3
Internet ProtocolInternet Protocol
Network layer protocol (layer 3)Network layer protocol (layer 3) The Internet is named after this protocolThe Internet is named after this protocol ““Unreliable” best effort serviceUnreliable” best effort service ConnectionlessConnectionless Packets in IP layer are called “Datagrams”Packets in IP layer are called “Datagrams”
a variable-length packet consisting of two parts: header a variable-length packet consisting of two parts: header and data. and data.
The header is 20 to 60 bytes in length and contains The header is 20 to 60 bytes in length and contains information essential to routing and delivery.information essential to routing and delivery.
Header has a fixed part (20 bytes) and variable part of options Header has a fixed part (20 bytes) and variable part of options (maximum 40 bytes)(maximum 40 bytes)
Each datagram is handled independently and can follow Each datagram is handled independently and can follow different paths to the destinationdifferent paths to the destination
TDC365-03 4 4
Position of IP Position of IP in TCP/IP protocol suitein TCP/IP protocol suite
TDC365-03 5 5
IP Field FormatIP Field Format
TDC365-03 6
IP Header Fields IP Header Fields
Version: IP protocol version. Version: IP protocol version. We are currently on IP version 4. Soon the We are currently on IP version 4. Soon the
Internet may be moved to IP version 6.Internet may be moved to IP version 6. 4 bit field – value 01004 bit field – value 0100
IP Header Length(HLEN) IP Header Length(HLEN) 4 bit field4 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)
TDC365-03 7
Total Length FieldTotal 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 FieldProtocol Field
Protocol fieldProtocol field IP carries PDUs of multiple protocols (e.g. TCP, UDP, IP carries PDUs of multiple protocols (e.g. TCP, UDP,
ICMP) ICMP) The Protocol field contains a code that tells them apartThe Protocol field contains a code that tells them apart
TDC365-03 9
Not all finalized, Read yourself (pg 183)
Service Type Service Type or Differentiated Servicesor Differentiated Services
TDC365-03 10
Type of ServiceType of Service
Indicates packet Indicates packet precedence and path precedence and path optimization type (currently optimization type (currently ignored by ALL routers):ignored by ALL routers): 3 bit precedence - 0 normal, 3 bit precedence - 0 normal,
7 control packet (has never 7 control packet (has never been used in v4)been used in v4)
1000 D bit – Minimize Delay 1000 D bit – Minimize Delay 0100 T bit – Maximize 0100 T bit – Maximize
Throughput Throughput 0010 R bit – Maximize 0010 R bit – Maximize
ReliabilityReliability0001 C bit – Minimize Cost0001 C bit – Minimize Cost
Default Type of Service
TDC365-03 11
Packet Size Calculationexample 1
Question:Question:In an IP packet, the value of HLEN is 1000 in binary. How In an IP packet, the value of HLEN is 1000 in binary. How
many bytes of options are being carried by this packet?many bytes of options are being carried by this packet?
SolutionSolutionThe HLEN value is 8, which means the total number of 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 in the header is 8 × 4 or 32 bytes. The first 20 bytes are the base header, the next 12 bytes are the bytes are the base header, the next 12 bytes are the options.options.
TDC365-03 12
Example 3Packet Size Calculation
example 2 Question:Question:
In an IP packet, the value of HLEN is 516 In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816 . Howand the value of the total length field is 002816 . Howmany bytes of data are being carried by this packet?many bytes of data are being carried by this packet?
SolutionSolution The HLEN value is 5, which means the total number of The HLEN value is 5, which means the total number of
bytes in the header is 5 × 4 or 20 bytes (no options). The bytes in the header is 5 × 4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying total length is 40 bytes, which means the packet is carrying 20 bytes of data (40 − 20).20 bytes of data (40 − 20).
TDC365-03 13
IP Header Fields (con’t)IP Header Fields (con’t)
Identification / Fragment Offset: Identification / Fragment Offset: used to identify fragments that are formed when an IP packet used to identify fragments that are formed when an IP packet
needs to be broken up into smaller packetsneeds 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 Max. number of routers this IP packet may pass through. This field is decremented by each router the packet passes through. If it is decremented by each router the packet passes through. If it reaches zero, packet will be discarded.reaches zero, packet will be discarded.
Header Checksum: Header Checksum: Allows error checking of IP packetsAllows error checking of IP packets
Source Address: Source Address: 4-byte IP source address for this packet4-byte IP source address for this packet
Destination Address: Destination Address: 4-byte IP destination address for this packet4-byte IP destination address for this packet
TDC365-03 14
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).
Example 4
TDC365-03 15
IP Packet Fragmentation IP Packet Fragmentation
The format and size of a frame The format and size of a frame depends on the protocol used by the depends on the protocol used by the physical network. Each layer 2 physical network. Each layer 2 protocol has a maximum protocol has a maximum transmission unit (MTU) size (max. transmission unit (MTU) size (max. frame data size)frame data size)
If a router determines that an IP If a router determines that an IP packet length exceeds the MTU for packet length exceeds the MTU for an outgoing port, it will fragment the an outgoing port, it will fragment the packet (that is, break it into smaller packet (that is, break it into smaller packets)packets)
Fragments are reassembled by IP Fragments are reassembled by IP software at destination host.software at destination host.
TDC365-03 16
IP Header Fields Used for IP Header Fields Used for Fragmentation Fragmentation
Identification: Identification: This is a random value chosen by the sender. If a packet is fragmented, the This is a random value chosen by the sender. If a packet is fragmented, the
same ID value is copied into all fragments.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 Don’t Fragment (DF) bit - Set to 1 if this packet should not be fragmented, 0 otherwiseotherwise
More Fragments (MF) bit – Set to 1 if packet has been fragmented and this is More Fragments (MF) bit – Set to 1 if packet has been fragmented and this is not the last fragment, 0 otherwise.not the last fragment, 0 otherwise.
Fragment Offset: Fragment Offset: 13 bit field shows relative position of this fragment with respect to the whole 13 bit field shows relative position of this fragment with respect to the whole
datagramdatagram Highest value can be 213-1 = 8191Highest value can be 213-1 = 8191 If this is a fragment packet, this is set to (byte offset of this packet data in the If this is a fragment packet, this is set to (byte offset of this packet data in the
original packet data) / 8original packet data) / 8 Note that this means that all fragments (except possibly last) must contain an Note that this means that all fragments (except possibly last) must contain an
exact multiple of 8 bytes of data.exact multiple of 8 bytes of data. This means that we can fragment a datagram of maximum length of 65535 This means that we can fragment a datagram of maximum length of 65535
(8192 * 8)(8192 * 8)
TDC365-03 17
Flags field
L2
(Mainly for diagnostic purpose)
= 0 this is the last fragment
= 1 more fragments to follow
MTU (Maximum Transfer Unit)MTU (Maximum Transfer Unit)
TDC365-03 18
IP Fragmentation ExampleIP Fragmentation Example
Question:Question: Assume a router receives an IP packet containing 4000 Assume a router receives an IP packet containing 4000
bytes of data (not including IP header). The Routing table bytes of data (not including IP header). The Routing table indicates this should be forwarded onto a subnet with MTU indicates this should be forwarded onto a subnet with MTU of 1420 bytes. How should this this packet be fragmented of 1420 bytes. How should this this packet be fragmented to enable L2 subnet transmission?to enable L2 subnet transmission?
Solution:Solution: The 4000 bytes is broken into fragments as follows (IP The 4000 bytes is broken into fragments as follows (IP
header size not included):header size not included): Fragment #1: 1400 bytes of dataFragment #1: 1400 bytes of data Fragment #2: 1400 bytes of dataFragment #2: 1400 bytes of data Fragment #3: 1200 bytes of dataFragment #3: 1200 bytes of data
TDC365-03 19 19
Fragmentation Example
TDC365-03 20
IP Fragmentation ExampleIP Fragmentation Example
Further assume that Fragment #2 (containing Further assume that Fragment #2 (containing 1400 data bytes) is later sent over an L2 1400 data bytes) is later sent over an L2 subnet with MTU of 820 bytes.subnet with MTU of 820 bytes. Fragment #2.1 contains 800 data bytesFragment #2.1 contains 800 data bytes Fragment #2.2 contains 600 data bytesFragment #2.2 contains 600 data bytes
TDC365-03 21 21
Total lengthIdentification
Fragment OffsetFlag
More Fragment
Detailed fragmentation
example
TDC365-03 22 22
Categories of OptionsCategories of Options
TDC365-03 23 23
IP Options FormatIP 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
TDC365-03 24 24
End of option
No-Op and End-OpNo-Op and End-Op
TDC365-03 25
Determines how many addresses to be recorded
Byte number of the first empty entry
1st 3 bytes of overhead
1st entry starts at 4
Total 15 bytes
Record Route
TDC365-03 26 26
Source RoutingSource Routing
Normally IP routing is dynamic where each router Normally IP routing is dynamic where each router makes its own decision about the next hop routermakes its own decision about the next hop router
Applications have no control, nor are concernedApplications have no control, nor are concerned In source routing, on the other hand, the sender In source routing, on the other hand, the sender
specifies the routespecifies the route Strict source routingStrict source routing
Sender specifies exact path – ICMP error if unspecified router is Sender specifies exact path – ICMP error if unspecified router is visitedvisited
Loose source routingLoose source routing Sender specifies a list of IP addresses that the datagram must Sender specifies a list of IP addresses that the datagram must
traverse, but the datagram can also pass thru other routerstraverse, but the datagram can also pass thru other routers
The destination address changes at each hop!!The destination address changes at each hop!!
TDC365-03 27
Strict Source RoutingStrict Source Routing
When an application receives When an application receives data that was source routed, it data that was source routed, it should supply a reversed route should supply a reversed route by fetching the value of the by fetching the value of the received routereceived route
STEP 1 Router compares STEP 1 Router compares destination IP withits incoming destination IP withits incoming IPIP
STEP 2: Router swaps IP address withoutgoing IP and forwards packet
STEP 3: Router also changes dest addrin IP header
TDC365-03 28 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
TDC365-03 29
IP Header ChecksumIP 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 bitsTruncate result to 16 bits 1-s Complement result1-s Complement result Put into Checksum field, send packetPut into Checksum field, send packet
Receiver Checksum check:Receiver Checksum check: Perform same calculation (with nonzero Perform same calculation (with nonzero
checksum)checksum) If result is not zero, discard IP packetIf result is not zero, discard IP packet
TDC365-03 30
Checksum ConceptChecksum Concept
TDC365-03 31
1’s complement
Checksum ExampleChecksum Example
TDC365-03 32 32
Read Yourself..Read Yourself..
Section 8.5 – IP PackageSection 8.5 – IP Package Especially the algorithmsEspecially the algorithms
Processing ModuleProcessing Module Fragmentation ModuleFragmentation Module Reassembly ModuleReassembly Module
TDC365-03 33
ICMP ICMP (Internet Control Message Protocol)(Internet Control Message Protocol) Companion to IPCompanion to IP
Network layer protocol, but encapsulated in IP Network layer protocol, but encapsulated in IP datagramsdatagrams
What happens when errors occur in delivering What happens when errors occur in delivering IP packets?IP packets? ICMP messages are used for Error ReportingICMP messages are used for Error Reporting
What if a host needs more information about What if a host needs more information about the network?the network? ICMP messages are used for Status QueriesICMP messages are used for Status Queries
TDC365-03 34
ICMP DesignICMP Design
TDC365-03 35
General format of ICMP messages
ICMP Encapsulation
TDC365-03 36
Error Report EncapsulationError 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
Query messages
ICMP Messages
TDC365-03 38
ICMP messagesICMP messagesICMP messages
TDC365-03 39
ICMP Error ReportsICMP Error Reports
Read more yourself –pgs 214-216Read more yourself –pgs 214-216 Sent by router (typically) or host back to the Source Address on data Sent by router (typically) or host back to the Source Address on data
packet when error occurs – includes header of error-causing packet.packet when error occurs – includes header of error-causing packet. Destination UnreachableDestination Unreachable
IP packet destination does not exist or cannot be reachedIP packet destination does not exist or cannot be reached One case is Fragmentation required, but DF bit is setOne case is Fragmentation required, but DF bit is set Another is source routing cannot be accomplishedAnother is source routing cannot be accomplished
Source QuenchSource Quench informs the source that a datagram has been discarded due to congestion in a router informs the source that a datagram has been discarded due to congestion in a router
or the destination hostor the destination host Used for limited flow controlUsed for limited flow control
Time ExceededTime Exceeded Whenever a router decrements a datagram with a time-to-live (no. of hops) value to 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 zero, it discards the datagram and sends a time-exceeded message All fragments did not arrive before fragment reassembly timeoutAll fragments did not arrive before fragment reassembly timeout
Parameter ProblemParameter Problem Error in header parameters in datagramError in header parameters in datagram
Redirection Redirection A better route to destination is knownA better route to destination is known
TDC365-03 40
‘Wrong’ router‘Correct’ router
RedirectionRedirection
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
TDC365-03 41
ICMP Query MessagesICMP Query Messages
Sent by host (typically) to diagnose networkSent by host (typically) to diagnose network Echo Request / ReplyEcho Request / Reply
Used for “ping”Used for “ping” Time Stamp Request / ReplyTime Stamp Request / Reply
““ping” with timestamps (ping –s)ping” with timestamps (ping –s) Address Mask Request / ReplyAddress Mask Request / Reply
Asks for IP Subnet Mask for current subnetAsks for IP Subnet Mask for current subnet Router Solicitation / AdvertisementRouter Solicitation / Advertisement
To find local routerTo find local router
TDC365-03 42
Ping and TraceroutePing and Traceroute
PingPing To find if a host is alive and respondingTo find if a host is alive and responding -R for record route-R for record route
TracerouteTraceroute Trace route from source to destinationTrace route from source to destination -g for loose source routing, -G for strict source -g for loose source routing, -G for strict source
routingrouting
TDC365-03 43
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 andunsupported port
B decrements TTL to 0, sends ‘destination unreachable’ msg to A with its own IP
Traceroute Operation