3. Internet Protocol: Connectionless Datagram Delivery 최양희 서울대학교 컴퓨터공학부 MMlab 1 Introduction Internet architecture and philosophy Application Services Reliable Transport Service Connectionless Packet Delivery Service IP packet delivery service • • • • • Unreliable: lost, duplicated, delayed, or delivered out of order Best-effort Connectionless Variable size datagrams Data forwarding only (routing, error, and control by other protocols) 2005 Yanghee Choi MMlab 2 IP Features Interconnecting end systems across multiple networks Implemented everywhere (end system, router) High level protocol data encapsulated in IP Protocol Data Unit (PDU) IP version 4 (rfc 791, in 1981) IP version 6 (IPv6) (rfc 2460, in 1998) 2005 Yanghee Choi MMlab 3 Router Features Coping with the differences among networks • Addressing schemes • Maximum packet size • Hardware and software interfaces • No assumption on network reliability 2005 Yanghee Choi MMlab 4 IP datagram HEADER 2005 Yanghee Choi DATA MMlab 5 IP encapsulation IP Header Frame Header 2005 Yanghee Choi IP Data Frame Data MMlab 6 Transmission across Internet 2005 Yanghee Choi MMlab 7 IP Datagram Forwarding Delivers datagrams to destination subnetwork Routers maintain a routing table of next hops Next hop field does not appear in the datagram Net 1 Table at R2 2005 Yanghee Choi R1 Net 2 Destination Net 1 Net 2 Net 3 Net 4 R2 Net 3 R3 Net 4 Next Hop Forward to R1 Deliver Direct Deliver Direct Forward to R3 MMlab 8 Routing Table IF ((Mask[I] & Destination_Address) = Destination [I]) Forward to NextHop [I] 30.0.0.7 Net 1 30.0.0.0 40.0.0.8 R1 Net 2 40.0.0.0 40.0.0.7 Destination 30.0.0.0 40.0.0.0 128.1.0.0 192.4.10.0 2005 Yanghee Choi R2 128.1.0.9 Net 3 128.1.0.0 128.1.0.8 Mask 255.0.0.0 255.0.0.0 255.255.0.0 255.255.255.0 MMlab R3 Net 4 192.4.0.0 192.4.10.9 Next Hop 40.0.0.7 Deliver Direct Deliver Direct 128.1.0.9 9 IPv4 Datagram Format 0 4 8 VERS HLEN 16 24 19 SERVICE TYPE 31 TOTAL LENGTH IDENTIFICATION FLAGS TIME TO LIVE PROTOCOL FRAGMENT OFFSET HEADER CHECKSUM SOURCE IP ADDRESS DESTINATION IP ADDRESS IP OPTIONS (IF ANY) PADDING DATA ... 2005 Yanghee Choi MMlab 10 IP Format Version (4 bits) Internet Header Length (4 bits) : in 32-bit words Min header is 5 words Type of Service (8 bits) Precedence, delay, reliability, throughput Total Length (16 bits) header + data in bytes, less than 64KB Identifier (16 bits) uniquely identifies the datagram during its life Flags (3 bits) More flag, No fragmentation Fragment offset (13 bits) in units of 8 bytes Time to live (8 bits) in router hops 2005 Yanghee Choi MMlab 11 IP Format (cont’d) Protocol (8 bits) Next level protocol to receive the data Header Checksum (16 bits) One’s complement sum of all 16-bit words in the header Source Address (32 bits) Original source. Does not change along the path Destination Address (32 bits) Final destination. Does not change among the path Options (variable) Padding (variable) Makes header length a multiple of 4 bytes, zero is inserted Data (variable) Data + header < 65,535 bytes 2005 Yanghee Choi MMlab 12 Service Type 0 1 2 PRECEDENCE 3 4 5 D T R 6 7 UNUSED D low delay T high throughput R high reliability Precedence=importance of datagram ===> hint to routing algorithm 2005 Yanghee Choi MMlab 13 DiffServ 0 5 CODEPOINT 6 7 Unused 64 different services xxx000 for original definition precedence 6 or 7 for routing traffic 2005 Yanghee Choi MMlab 14 Fragmentation Datagram Size, Network MTU, and Fragmentation • MTU (maximum Transfer Unit): fixed upper bound on the amount data that can be transferred in one physical frame e.g.) Ethernet: 1500 octets, FDDI: 4470 octets • Fragmentation: dividing large datagrams into smaller pieces when the datagram needs to traverse a network that has a small MTU • Fragments must be reassembled at the destination • If any fragments are lost, the datagram cannot be reassembled. • Reassembly timer : if expired, discard the received packets Fragmentation control • IDENTIFICATION : identical to the fragments • FLAGS: Don’t Fragment bit, More Fragments bit, • FRAGMENT OFFSET : by 8 octets No sequence number 2005 Yanghee Choi MMlab 15 Fragmentation HOST A HOST B Net 1 MTU=1500 R1 2005 Yanghee Choi Net 2 MTU=620 MMlab Net 3 MTU=1500 R2 16 Fragments Datagram Header Data1 600 octets Data2 Data3 600 octets 200 octets Fragment 1 Data1 Header 600 octets Fragment 1 (offset 0) Fragment 2 Data2 Header 600 octets Fragment 2 (offset 600) Fragment 3 Data3 Header 200 octets Fragment 3 (offset 1200) 2005 Yanghee Choi MMlab 17 Internet Datagram Options Included primarily for network testing or debugging Type(code)- Length-Value Option code (1 octet) 0 1 2 COPY OPTION CLASS 3 4 5 6 7 OPTION NUMBER Copy = 1 option copied to all fragments =0 copied to the first fragment only Class = 0 Datagram or network control =1 Resv’d =2 Debugging and measurement =3 Resv’d Option length (1 octet) Value : variable length 2005 Yanghee Choi MMlab 18 IP Options Loose Source Routing Record Route Strict Source Routing Internet Timestamp etc. 2005 Yanghee Choi MMlab 19 Record Route Option 0 8 16 24 31 CODE LENGTH POINTER FIRST IP ADDRESS SECOND IP ADDRESS ……... 2005 Yanghee Choi MMlab 20 Strict Source Route Option 0 8 16 24 31 CODE LENGTH POINTER IP ADDRESS OF FIRST HOP IP ADDRESS OF SECOND HOP ……... Addresses overwritten by visited routers (= record route) 2005 Yanghee Choi MMlab 21 Timestamp Option 0 8 16 24 31 CODE LENGTH POINTER OFLOW FLAGS FIRST IP ADDRESS FIRST TIMESTAMP ……... In msec since midnight OFLOW : count of routers that couldn’t supply timestamps because the option was too small FLAGS : record timestamps only (0), etc. 2005 Yanghee Choi MMlab 22 IPv6 Expanded Addressing Capabilities Flexible header format Improved Support for Extensions and Options Support for resource allocation Provision for protocol extension Flow Labeling Capability Authentication and Privacy Capabilities 2005 Yanghee Choi MMlab 23 IPv6 Addresses 128-bit long. Fixed size 3.4 X 10~38 addresses Assigned to individual interfaces Allows multiple interfaces per host Allows multiple addresses per interface Allows unicast, multicast, anycast Allows provider based, site-local, link-local 85% of the space is unassigned 2005 Yanghee Choi MMlab 24 Colon-Hex Notation Dot-Decimal 147.47.114.115 Colon-Hex FEDC:0000:0000:0000:3232:0000:0000:ACFE 2005 Yanghee Choi MMlab 25 IPv6 Prefix Allocation Allocation Prefix Allocation Prefix Reserved Unassigned NSAP IPX Unassigned Unassigned Unassigned Global Unicast Unassigned Unassigned Unassigned 0000 0000 0000 0001 0000 001 0000 010 0000 011 0000 1 0001 001 010 011 100 Unassigned Unassigned Unassigned Unassigned Unassigned Unassigned Unassigned Unassigned Link-Local Site-Local Multicast 101 110 1110 1111 0 1111 10 1111 110 1111 1110 1111 1110 0 1111 1110 10 1111 1110 11 1111 1111 2005 Yanghee Choi MMlab 26 IPv6 Address Formats Top-Level Aggregation (ISP or exchange) Next-Level Aggregation (subscriber site) Site-Level Aggregation (subnet) 001 TLA id RES 3 13 8 NLA id SLA id INTERFACE id 24 16 64 Aggregatable global unicast address 2005 Yanghee Choi MMlab 27 Local Address 1111111010 Interface ID Link Local address : Not forwarded outside the link 1111111011 Interface ID Site Local address : Not forwarded outside the subnetwork 2005 Yanghee Choi MMlab 28 IPv4 Addresses 32 0000…………………………………………...…………………..0000 IPv4 address 0000…………………………………………...…………………..FFFF IPv4 address IPv4-compatible IPv6 address 2005 Yanghee Choi MMlab 29 Anycast Address Routed to the nearest interface in the group Allocated in the unicast address space Subnet-router anycast address : delivered to one router in the subnetwork 2005 Yanghee Choi MMlab 30 Multicast Addresses Flag bit : T=0 Permanent (well-known) multicast address T=1 Transient Scope 1 Node-local 2 Link-local 5 Site-local 8 Organization-local E Global Group ID Predefined 1 All nodes 2 Routers 1:0 DHCP servers 11111111 Flag Scope 2005 Yanghee Choi Group ID MMlab 31 IPv6 PDU General Form 40 octets IPv6 header 2005 Yanghee Choi 0 or more Extension header ….. MMlab Extension Transport-level header PDU 32 IPv6 Header 4 8 16 Version traffic class Payload length 24 Flow label 31 Next header Hop limit Source Address 40 octets 0 Destination Address 2005 Yanghee Choi MMlab 33 IPv6 Header Version = 6 Traffic Class (8 bits) Flow Label (20 bits) Payload length (16 bits) : in octets except the IPv6 header Next Header (8 bits) : identifies the type of header following the IPv6 header Hop Limit (8 bits) : remaining number of allowable hops for this packet Source Address (128 bits) Destination Address (128 bits) : may not be the ultimate destination, if routing header is present 40 octets in length 2005 Yanghee Choi MMlab 34 Flow Label A Flow is uniquely identified by source address and 20-bit flow label. A flow may comprise single or multiple TCP connections. A single application may generate a single or multiple flows (multimedia conferencing). At router, the same flow has the same path, resource allocation, discard requirements, accounting, and security attributes. 2005 Yanghee Choi MMlab 35 Header Order IPv6 header : mandatory Hop-by-Hop Options header Destination Options header to be processed by destinations in the IPv6 header and Routing header Routing header : extended routing (source routing) Fragment header Authentication header Encapsulating Security Payload header Destination Options header to be processed by destination in the IPv6 header upper-layer header (TCP, application etc.) 2005 Yanghee Choi MMlab 36 IPv6 Fragmentation End-to-end Does not accommodate route changes Use Path MTU Discovery to determine minimum MTU in the path Minimum MTU is 1280 octets 2005 Yanghee Choi MMlab 37 IPv6 Transition (ngtrans) IPv4/IPv6 DualStack IPv4 IPv6 IPv6 IPv4 IPv6-in-IPv4 tunneling IPv4 IPv4/IPv6 Translation 2005 Yanghee Choi IPv6 MMlab 38