INTERNET PROTOCOL IP Header Format Fragmentation 2008 10

  • Slides: 22
Download presentation
INTERNET PROTOCOL (IP) Header Format & Fragmentation 2008. 10

INTERNET PROTOCOL (IP) Header Format & Fragmentation 2008. 10

Contents § Introductions – Motivation – Scope – Operation § Function Description – Addressing

Contents § Introductions – Motivation – Scope – Operation § Function Description – Addressing – Fragmentation § Internet Header Format – Header fields § Examples – Minimal datagram – 2 -way fragmentation – Datagram containing options § Appendices – IPv 6 header – Fragment and reassemble example procedure § Reference 2

Introduction § Operation – IP의 두 가지 기본 기능은 addressing과 fragmentation – Internet module들은

Introduction § Operation – IP의 두 가지 기본 기능은 addressing과 fragmentation – Internet module들은 datagram을 다음 목적지로 전송하기 위해 internet header에 들어있는 address를 참조 ü 전송을 위한 경로 선택을 ‘routing’이라 함 – Internet module들은 “small packet” network을 통해 datagram을 전 송할 때 fragmentation을 하기 위해 internet header에 들어있는 관 련 field들을 사용 – Operation의 주체들은 address를 해석하고, datagram을 fragmenting and assembling 하기 위한 공통의 규칙을 가짐 ü 통신에 관여하는 각 host들의 internet module ü Network들을 연결하는 각 gateway들의 internet module ü 각 internet module들, 특히 gateway의 module은 routing을 결정하기 위한 기능을 가짐 – IP는 각 datagram을 서로 연관성 없는 독립된 개체로 취급 ü Connection이나 logical circuit의 개념이 없음 – Header checksum error는 IP module 내에 구현 된 ICMP를 통해 상 대에게 알려질 수 있음 4

Function Description § Addressing – Name, address, route의 구별 ü Name: 찾아야 할 것

Function Description § Addressing – Name, address, route의 구별 ü Name: 찾아야 할 것 ü Address: 어디에 있는가 ü Route: 어떻게 갈 것인가 ü IP는 이들 중 주로 address과 관련이 있음 – Address mapping ü Name과 address를 mapping하는 것은 상위 protocol의 역할 ü Internet module은 internet address를 local net address와 mapping ü Local net address를 route와 mapping 시키는 것은 하위 procedure의 역할 – Address ü Address의 길이는 4 octet으로 고정 ü Network number + local address (rest fields)의 형식 – Address format (class) ü Class A: 최상위 bit은 0, 다음 7 bit이 network, 나머지 24 bit이 local ü Class B: 최상위 2 bit은 10, 다음 14 bit이 network, 나머지 16 bit이 local ü Class C: 최상위 3 bit은 110, 다음 21 bit이 network, 나머지 8 bit이 local 5

Function Description § Fragmentation – 2 -way split process ü 두 개의 새로운 internet

Function Description § Fragmentation – 2 -way split process ü 두 개의 새로운 internet datagram을 만들고 원래의 datagram header를 각각에 복사 ü 원래 datagram의 data를 둘로 분할 • 8 octet 단위로 분할해야 함 • 길이에 따라서는 8의 배수가 되지 않을 수 있으나 분할 된 두 data 중 첫 번째는 반드시 8의 배수가 되어야 함 • 첫 번째 data에 포함된 8 octet block의 개수를 NFB (Number of Fragment Blocks)라 부름 ü 분할 된 첫 번째 data를 새로 만든 datagram 중 첫 번째에 넣음 • Total length field에 datagram의 길이를 기록 • More-fragments flag을 1로 만듦 ü 분할 된 두 번째 data를 새로 만든 datagram 중 두 번째에 넣음 • Total length field에 datagram의 길이를 기록 • More-fragments flag은 원래 datagram과 같은 값을 가짐 • Fragment offset field는 원래 datagram의 해당 field 값에 NFB를 더한 값이 들어 감 ü 이상의 과정을 일반화하여 n-way split을 구현할 수 있음 – Reassemble ü Identification, source, destination, protocol의 네 field가 같은 datagram들을 모두 모아 fragment offset 값 순서대로 data를 합침 • Fragment offset이 0인 datagram이 가장 첫 번째 • More-fragments flag이 0인 datagram이 마지막 7

Internet Header Format § Header fields – Version (4 bits) ü Internet header format의

Internet Header Format § Header fields – Version (4 bits) ü Internet header format의 버전 • 위의 그림은 version 4 (RFC 791) – IHL (Internet Header Length) (4 bits) ü Internet header의 길이 (32 bit word 단위)이며 data가 시작되는 위치를 나타냄 ü 이 값은 최소 5가 되어야 함 – Type of Service (8 bits) ü Service 별로 datagram의 우선순위를 정해 전송하는 기능을 제공하기 위해 정의 되었으나 현실적으로 거의 쓰이지 않음 ü Filed 내에 precedence, delay, throughput, reliability 정보를 가짐 8

Internet Header Format § Header fields – Header Checksum (16 bits) ü Data는 제외한

Internet Header Format § Header fields – Header Checksum (16 bits) ü Data는 제외한 header 부분 만의 checksum ü TTL과 같은 값은 계속하여 변하므로 매번 checksum을 재계산 해야 함 ü 이 값이 올바르지 않으면 datagram을 버림 – Source Address (32 bits) ü 송신자의 IP 주소 – Destination Address (32 bits) ü 수신자의 IP 주소 – Options (variable) ü Option의 사용은 선택적이나 각 node는 정의된 모든 option을 이해하고 처리할 수 있도록 구현되어야 함 ü Option은 두 가지 형태 중 하나를 가짐 • Case 1: 1 octet으로 option-type만을 나타냄 • Case 2: option-type 1 octet, option-length 1 octet, 여러 octet의 optiondata ü Option-type (8 bits) • Copied flag (1 bit): fragmentation이 일어나는 경우에 이 값이 1이면 모든 fragment에 이 option을 복사, 0이면 그렇게 하지 않음 • Option class (2 bits): 0이면 control option, 2이면 debugging and measurement option, 1과 3은 reserved 11

Internet Header Format § Header fields – Options (variable) ü Option-type (8 bits) •

Internet Header Format § Header fields – Options (variable) ü Option-type (8 bits) • Option number (5 bits): option의 종류를 나타냄 CLASS NUMBER LENGTH DESCRIPTION 0 0 - End of Option list: option 목록이 끝났음을 표시 0 1 - No Operation: 다음 option의 시작을 32 bit 경계에 맞추기 위해 option들 사이에 이 option을 끼워넣음 0 2 11 0 3 가변 Loose Source Routing: destination까지 가는 경로를 송신자가 지정 하기 위해 사용, IP 주소 목록을 포함하고 있으며 이 목록 사이에 다 른 gateway 등을 거치는 것을 허용 0 9 가변 Strict Source Routing: Loose Source Routing과 같으나 주소 목록 사이에 다른 node를 거치는 것을 허용하지 않음 0 7 가변 Record Route: datagram이 거쳐간 경로를 기록 0 8 4 2 4 가변 Security: 보안에 관련된 security, compartment, handling restriction, TCC parameter를 포함 Stream ID: stream 개념을 지원하지 않는 network에서 사용 Internet Timestamp: datagram이 경로를 지나간 시간을 기록 12

Examples § Minimal datagram 13

Examples § Minimal datagram 13

Examples § 2 -way fragmentation 14

Examples § 2 -way fragmentation 14

Examples § Datagram containing options 15

Examples § Datagram containing options 15

Appendices § IPv 6 header (RFC 2460) – Version (4 bits) ü Internet Protocol

Appendices § IPv 6 header (RFC 2460) – Version (4 bits) ü Internet Protocol version (6) – Traffic Class (8 bits) ü RFC 2474에 정의 된 DS(Differentiated Services)를 사용하여 Qo. S 지원 ü IPv 4의 TOS를 대체 16

Appendices § IPv 6 Header (RFC 2460) – Flow Label (20 bits) ü Real-time

Appendices § IPv 6 Header (RFC 2460) – Flow Label (20 bits) ü Real-time traffic과 Qo. S 보장을 위해 만들어짐 ü 여러 datagram을 하나의 흐름으로 표시하여 보낼 수 있으며 router들이 이 흐름에 속한 datagram들을 동일하게 처리할 수 있음 – Payload Length (16 bits) ü Header를 제외한 payload의 길이 (octet 단위) ü RFC 2460에 정의 된 extension header를 사용하는 경우 이들은 payload 로 취급하며 payload length에도 포함 – Next Header (8 bits) ü IPv 6 header 다음에 따라오는 header의 종류를 나타냄 ü IPv 4의 Protocol field와 같음 – Hop Limit (8 bits) ü 각 node를 지날 때마다 1씩 감소 되며 0이 되면 packet을 폐기 ü IPv 4의 TTL과 같은 용도 – Source Address (128 bits) ü 송신자의 IP 주소 – Destination Address (128 bits) ü 수신자의 IP 주소 17

Appendices § Fragment and reassemble example procedure – General notation =< - less than

Appendices § Fragment and reassemble example procedure – General notation =< - less than or equal # - not equal = - equal <- is set to x to y - includes x and excludes y – Fragmentation notation FO - Fragment Offset IHL - Internet Header Length DF - Don't Fragment flag MF - More Fragments flag TL - Total Length OFO - Old Fragment Offset OIHL - Old Internet Header Length OMF - Old More Fragments flag OTL - Old Total Length NFB - Number of Fragment Blocks MTU - Maximum Transmission Unit 18

Appendices § Fragment and reassemble example procedure – Fragmentation procedure IF TL =< MTU

Appendices § Fragment and reassemble example procedure – Fragmentation procedure IF TL =< MTU THEN Submit this datagram to the next step in datagram processing ELSE IF DF = 1 THEN discard the datagram ELSE To produce the first fragment: (1) Copy the original internet header; (2) OIHL <- IHL; OTL <- TL; OFO <- FO; OMF <- MF; (3) NFB <- (MTU-IHL*4)/8; (4) Attach the first NFB*8 data octets; (5) Correct the header: MF <- 1; TL <- (IHL*4)+(NFB*8); Recompute Checksum; (6) Submit this fragment to the next step in datagram processing; To produce the second fragment: (7) Selectively copy the internet header (some options are not copied, see option definitions); (8) Append the remaining data; (9) Correct the header: IHL <- (((OIHL*4)-(length of options not copied))+3)/4; TL <- OTL - NFB*8 - (OIHL-IHL)*4); FO <- OFO + NFB; MF <- OMF; Recompute Checksum; (10) Submit this fragment to the fragmentation test; DONE. 19

Appendices § Fragment and reassemble example procedure – Reassembly notation FO - Fragment Offset

Appendices § Fragment and reassemble example procedure – Reassembly notation FO - Fragment Offset IHL - Internet Header Length MF - More Fragments flag TTL - Time To Live NFB - Number of Fragment Blocks TL - Total Length TDL - Total Data Length BUFID - Buffer Identifier RCVBT - Fragment Received Bit Table TLB - Timer Lower Bound 20

Appendices § Fragment and reassemble example procedure – Reassembly procedure (1) BUFID <- source

Appendices § Fragment and reassemble example procedure – Reassembly procedure (1) BUFID <- source | destination | protocol | identification; (2) IF FO = 0 AND MF = 0 (3) THEN IF buffer with BUFID is allocated (4) THEN flush all reassembly for this BUFID; (5) Submit datagram to next step; DONE. (6) ELSE IF no buffer with BUFID is allocated (7) THEN allocate reassembly resources with BUFID; TIMER <- TLB; TDL <- 0; (8) put data from fragment into data buffer with BUFID from octet FO*8 to octet (TL-(IHL*4))+FO*8; (9) set RCVBT bits from FO to FO+((TL-(IHL*4)+7)/8); (10) IF MF = 0 THEN TDL <- TL-(IHL*4)+(FO*8) (11) IF FO = 0 THEN put header in header buffer (12) IF TDL # 0 (13) AND all RCVBT bits from 0 to (TDL+7)/8 are set (14) THEN TL <- TDL+(IHL*4) (15) Submit datagram to next step; (16) free all reassembly resources for this BUFID; DONE. (17) TIMER <- MAX(TIMER, TTL); (18) give up until next fragment or timer expires; (19) timer expires: flush all reassembly with this BUFID; DONE. 21

References § RFC 791 – Internet Protocol (Sep. 1981) § RFC 2460 – Internet

References § RFC 791 – Internet Protocol (Sep. 1981) § RFC 2460 – Internet Protocol, Version 6 (Dec. 1998) § TCP/IP 완벽 가이드 (한글판) – 에이콘 출판 (2006년 1월) 22