IP Service Model
• Low-level communication model provided by Internet
• Datagram
• Each packet self-contained
• All information needed to get to destination
• No advance setup or connection maintenance
• Analogous to letter or telegram
0 4 8 12 16 19 24 28 31
version HLen TOS Length
IPv4 Identifier Flag Offset
Packet TTL Protocol Checksum Header
Format
Source Address
Destination Address
Options (if any)
Data
1
IPv4 Header Fields
0 4 8 12 16 19 24 28 31
• Version: IP Version
• 4 for IPv4
ver-
sion HLen TOS Length
Flag
Identifier s Offset
• HLen: Header Length
TTL Protocol Checksum
Source Address
Destination Address
Options (if any)
• 32-bit words
Data
• TOS: Type of Service
• Priority information
• Length: Packet Length
• Bytes (including header)
• Header format can change with versions
• First byte identifies version
• Length field limits packets to 65,535 bytes
• In practice, break into much smaller packets for network
performance considerations
2
IPv4 Header Fields
• Identifier, flags, fragment offset used primarily for fragmentation
• Time to live
• Must be decremented at each router
0 4 8 12 16 19 24 28 31
ver-
sion HLen TOS Length
• Packets with TTL=0 are thrown away Identifier Flag
s Offset
TTL Protocol Checksum
• Ensure packets exit the network Source Address
• Protocol Destination Address
Options (if any)
• Demultiplexing to higher layer protocols Data
• TCP = 6, ICMP = 1, UDP = 17…
• Header checksum
• Ensures some degree of header integrity
• Relatively weak – 16 bit
• Options
• E.g. Source routing, record route, etc.
• Performance issues
• Poorly supported
3
IPv4 Header Fields
0 4 8 12 16 19 24 28 31
ver-
sion HLen
Identifier
TOS
Flags
Length
Offset
• Source Address
• 32-bit IP address of sender
TTL Protocol Checksum
Source Address
Destination Address
Options (if any)
Data
• Destination Address
• 32-bit IP address of destination
• Like the addresses on an envelope
• Globally unique identification of sender &
receiver
4
IP Delivery Model
• Best effort service
• Network will do its best to get packet to destination
• Does NOT guarantee:
• Any maximum latency or even ultimate success
• Sender will be informed if packet doesn’t make it
• Packets will arrive in same order sent
• Just one copy of packet will arrive
• Implications
• Higher level protocols must make up for shortcomings
• Reliably delivering ordered sequence of bytes TCP
• Some services not feasible
• Latency or bandwidth guarantees
5
IP Fragmentation
MTU =
2000 host
router
router MTU = 1500
host
MTU = 4000
• Every Network has Own Maximum Transmission Unit
(MTU)
• Largest IP datagram it can carry within its own packet frame
• E.g., Ethernet is 1500 bytes
• Don’t know MTUs of all intermediate networks in advance
• IP Solution
• When hit network with small MTU, fragment packets
• Might get further fragmentation as proceed farther
6
Reassembly
• Where to do reassembly?
• End nodes or at routers?
• End nodes
• Avoids unnecessary work where large packets are
fragmented multiple times
• If any fragment missing, delete entire packet
• Dangerous to do at intermediate nodes
• How much buffer space required at routers?
• What if routes in network change?
• Multiple paths through network
• All fragments only required to go through destination
7
Fragmentation Related Fields
• Length
• Length of IP fragment
• Identification
• To match up with other fragments
• Flags
• Don’t fragment flag
• More fragments flag
• Fragment offset
• Where this fragment lies in entire IP datagram
• Measured in 8 octet units (13 bit field)
8
IP Fragmentation Example #1
router
host
MTU = 4000
Length = 3820, M=0
IP IP
Header Data
9
IP Fragmentation Example #2
MTU =
2000
router
router
Length = 2000, M=1, Offset = 0
Length = 3820, M=0
IP IP
IP IP Header Data
Header Data
1980 bytes
3800 bytes
Length = 1840, M=0, Offset = 1980
IP IP
Header Data
1820 bytes
10
IP Fragmentation Example #3
Length = 1500, M=1, Offset = 0
host IP IP
router
MTU = 1500 Header Data
Length = 2000, M=1, Offset = 0 1480 bytes
IP IP Length = 520, M=1, Offset = 1480
Header Data
IP IP
Header Data
1980 bytes Length = 1500, M=1, Offset = 1980
500 bytes
Length = 1840, M=0, Offset = 1980 IP IP
Header Data Length = 360, M=0, Offset = 3460
IP IP IP IP
Header Data Header Data
1480 bytes
1820 bytes 340 bytes
11
IP Reassembly
Length = 1500, M=1, Offset = 0
• Fragments might arrive out-of-
IP IP
Header Data order
• Don’t know how much memory
Length = 520, M=1, Offset = 1480
required until receive final fragment
IP
Header
IP
Data
• Some fragments may be
duplicated
Length = 1500, M=1, Offset = 1980
• Keep only one copy
IP
Header
IP
Data
• Some fragments may never arrive
• After a while, give up entire process
Length = 360, M=0, Offset = 3460
IP IP
Header Data
IP IP IP IP
Data Data Data Data
12
Fragmentation and Reassembly
Concepts
• Demonstrates many Internet concepts
• Decentralized
• Every network can choose MTU
• Connectionless
• Each (fragment of) packet contains full routing information
• Fragments can proceed independently and along different routes
• Best effort
• Fail by dropping packet
• Destination can give up on reassembly
• No need to signal sender that failure occurred
• Complex endpoints and simple routers
• Reassembly at endpoints
13
Fragmentation is Harmful
• Uses resources poorly
• Forwarding costs per packet
• Best if we can send large chunks of data
• Worst case: packet just bigger than MTU
• Poor end-to-end performance
• Loss of a fragment
• Path MTU discovery protocol determines minimum
MTU along route
• Uses ICMP error messages
14
Internet Control Message Protocol
(ICMP)
• Short messages used to send error & other control information
• Examples
• Ping request / response
• Can use to check whether remote host reachable
• Destination unreachable
• Indicates how packet got & why couldn’t go further
• Flow control
• Slow down packet delivery rate
• Redirect
• Suggest alternate routing path for future messages
• Router solicitation / advertisement
• Helps newly connected host discover local router
• Timeout
• Packet exceeded maximum hop limit
15
IP MTU Discovery with ICMP
MTU =
2000 host
router
router MTU = 1500
host
MTU = 4000
• Typically send series of packets from one host to another
• Typically, all will follow same route
• Routes remain stable for minutes at a time
• Makes sense to determine path MTU before sending real packets
• Operation
• Send max-sized packet with “do not fragment” flag set
• If encounters problem, ICMP message will be returned
• “Destination unreachable: Fragmentation needed”
• Usually indicates MTU encountered
16
IP MTU Discovery with ICMP
ICMP
Frag. Needed
MTU = 2000 MTU =
2000 host
router
router MTU = 1500
host
MTU = 4000
Length = 4000, Don’t Fragment
IP
Packet
17
IP MTU Discovery with ICMP
ICMP
Frag. Needed
MTU = 1500 MTU =
2000 host
router
router MTU = 1500
host
MTU = 4000
Length = 2000, Don’t Fragment
IP
Packet
18
IP MTU Discovery with ICMP
MTU =
2000 host
router
router MTU = 1500
host
MTU = 4000
Length = 1500, Don’t Fragment
IP
Packet
• When successful, no reply at IP level
• “No news is good news”
• Higher level protocol might have some form of
acknowledgement
19