130 likes | 305 Views
CENG415 – Communication Networks. Lectures 14 Network layer – IP protocol. ICMP/IP protocol error reporting router “signaling”. IP protocol addressing conventions datagram format packet handling conventions. Routing protocols path selection RIP, OSPF, BGP. forwarding table.
E N D
CENG415 – Communication Networks Lectures 14 Network layer – IP protocol
ICMP/IP protocol • error reporting • router “signaling” • IP protocol • addressing conventions • datagram format • packet handling conventions • Routing protocols • path selection • RIP, OSPF, BGP forwarding table The Internet Network Layer Host, router network layer functions: Transport layer: TCP, UDP Network layer Link layer physical layer
IP protocol version number 32 bits total datagram length (bytes) head. len type of service header length (bytes) length ver for fragmentation/ reassembly fragment offset “type” of data flgs 16-bit identifier max number remaining hops (decremented at each router) upper layer time tolive header checksum 32 bit source IP address 32 bit destination IP address upper layer protocol to deliver payload to E.g. timestamp, record route taken, specify list of routers to visit. Options (if any) data (variable length, typically a TCP or UDP segment) IP Datagrapm Format
Fragmentation & Reassembly Definition • MTU: Maximum Transfer size. The maximum number of a datagram in bytes, including the IP header, that can travel a specific network (LAN) • Fragmentation is the process of dividing a Datagram into smaller pieces. Why? • A datagram reaches a router and need to be transferred to a network with MTU smaller than the datagram size Where? • Fragmentation happen in Routers • Reassembly in destination host only • How? • Identifier, Flags and Fragment Offset
length =1500 ID =x length =4000 ID =x ID =x length =1500 length =1040 ID =x fragflag =1 offset =0 fragflag =0 fragflag =0 offset =0 offset =370 fragflag =1 offset =185 One large datagram becomes several smaller datagrams Fragmentation & Reassembly Example • 4000 byte datagram • MTU = 1500 bytes 1480 bytes in data field offset =1480/8 Steps: 1. Subtract 20 from original length: 4000 -20 = 3980 (bytes of "IP data") 2. Subtract 20 from new MTU: 1500- 20 = 1480 (max. bytes of data in each fragment) 3. Divide "maximum data bytes" by 8: 1480/8 = 185 to get offset increment 4. Offset of each fragment "n" (n = 0, 1, 2, ...) = n x "offset increment": 0, 185, 370. ... 5. Length of each fragment (except last) = 20 + "max. data bytes" = 20 +1480 = 1500 Length of last fragment = 20 + remaining data bytes = 20 + 3980 - 2 x 1480 = 1040
Fragmentation & Reassembly Stepsto remember: • Subtract 20 from original length: (bytes of "IP header data") • Subtract 20 from new MTU: (max. bytes of data in each fragment) • Divide "maximum data bytes" by 8: to get offset increment • Offset of each fragment "n" (n = 0, 1, 2, ...) = n x "offset increment" • Length of each fragment (except last) = 20 + "max. data bytes“ • Length of last fragment = 20 + remaining data bytes
40.0.0.7 40.0.0.0/12 MTU=900 30.0.0.7 30.0.0.0/15 MTU=1700 Router 1 50.1.0.8 40.0.0.8 60.2.0.0/17 MTU=800 Router 2 50.1.0.0/18 MTU=700 C1 Router 3 C2 50.1.0.9 60.2.0.9 Example: Fragmentation • Computer 1 sends a 1500 bytes datagram to C2. • Find the fragments that reaches C2
40.0.0.7 40.0.0.0/12 MTU=900 30.0.0.7 30.0.0.0/15 MTU=1700 Router 1 C2 50.1.0.8 40.0.0.8 60.2.0.0/17 MTU=800 Router 2 50.1.0.0/18 MTU=700 C1 Router 3 50.1.0.9 60.2.0.9 Example: Fragmentation Router 1: output MTU is 900. Datagram is 1500. 1500-20 = 1480 900-20 = 880 880/8 = 1101480 = 880 + 600 Two segments
40.0.0.7 40.0.0.0/12 MTU=900 30.0.0.7 30.0.0.0/15 MTU=1700 Router 1 C2 50.1.0.8 40.0.0.8 60.2.0.0/17 MTU=800 Router 2 50.1.0.0/18 MTU=700 C1 Router 3 50.1.0.9 60.2.0.9 Example: Fragmentation Router 2: output MTU is 700. Datagram 880 need to be fragmented
Fragmentation Complete Datagram To identify segments: • Flag = 0 • Offset = 0 • Flag = 1 • Offset = 0 • Flag ≠ 0 • Offset ≠ 0 • Flag = 0 • Offset ≠ 0 First segment Intermediate fragment Last fragment
Reassembly fragmentation: in: one large datagram out: 3 smaller datagrams • different link types, different MTUs • large IP datagram divided (“fragmented”) within net • one datagram becomes several datagrams • “reassembled” only at final destination • IP header bits used to identify, order related fragments Blue: IP Header reassembly Another fragment flag, DNF (do not fragment) causes a ICMP response (and dropped datagram) instead of fragmentation. The sender then resends future datagrams with smaller size (may fragment itself or reduce MSS for TCP)