Presentation is loading. Please wait.

Presentation is loading. Please wait.

Internet Protocol Objectives Chapter 8

Similar presentations


Presentation on theme: "Internet Protocol Objectives Chapter 8"— Presentation transcript:

1 Internet Protocol Objectives Chapter 8
Upon completion you will be able to: Understand the format and fields of a datagram Understand the need for fragmentation and the fields involved Understand the options available in an IP datagram Be able to perform a checksum calculation Understand the components and interactions of an IP package

2 CONTENTS DATAGRAM FRAGMENTATION OPTIONS CHECKSUM IP PACKAGE

3 인터넷 프로토콜(IP) TCP/IP에서 사용하는 전송 메커니즘 신뢰성 없는 비연결형 데이터그램 프로토콜
최선노력(best effort) 전달 서비스 오류 검사 및 추적 기능을 수행하지 않음 각 데이터그램은 독립적으로 처리 각 데이터그램은 서로 다른 경로로 전달될 수 있음 각 데이터그램은 순서가 바뀌어 전달될 수 있음

4 TCP/IP 프로토콜에서 IP의 위치

5 8.1 DATAGRAM A packet in the IP layer is called a datagram, a variable-length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery.

6 8.1 데이터 그램 IP 데이터 그램

7 8.1 IP 데이터 그램 가변 길이 패킷 헤더와 데이터 부분으로 구성
헤더 : 20 ~ 60 바이트 길이, 라우팅과 전달에 필요한 정보 헤더 내의 필드 버전(Ver) - IP 프로토콜 버전(4비트) 헤더길이(HLEN) - 헤더의 전체 길이를 4 바이트 단위로 표시(4 비트)

8 8.1 IP 데이터 그램 서비스 유형(Service type) - (8 비트) 라우터에 의해 처리하는 방법
3 bit는 우선 순위, 4 bit는 서비스 유형

9 The precedence subfield was designed, but never used in version 4.
8.1 데이터 그램 Note: The precedence subfield was designed, but never used in version 4.

10 8.1 IP 데이터 그램 TOS(type of service) 비트 서비스 유형

11 8.1 IP 데이터 그램 응용 프로그램들의 서비스 유형 기본 값

12 The precedence subfield is not used in version 4.
8.1 IP 데이터 그램 차별화된 서비스(Differentiated Service) 오른쪽 3비트가 0이면 우선순위와 같은 의미로 해석 오른쪽 3비트가 0이 아니면 기관에서 정의된 서비스 코드 포인트의 값 The precedence subfield is not used in version 4.

13 8.1 데이터 그램 Note: The total length field defines the total length of the datagram including the header.

14 8.1 IP 데이터 그램 전체 길이(total length) 16 bit 필드(65,535 까지 표현)
데이터 길이 = 전체 길이 – 헤더 길이 이더넷 프레임에서 작은 데이터그램의 캡슐화

15 8.1 IP 데이터 그램 식별(Identification) – 단편화에 사용 플래그(flag) – 단편화에 사용
단편 옵셋(fragmentation offset) – 단편화에 사용 수명(time to live) – 데이터그램의 수명

16 8.1 IP 데이터 그램 프로토콜(protocol) – IP 계층의 서비스를 사용하는 상위 계층 프로토콜
검사합(checksum) – 오류 확인 발신지 주소 (source address) 목적지 주소 (destination address)

17 Example 1 An IP packet has arrived with the first 8 bits as shown: The receiver discards the packet. Why? Solution There is an error in this packet. The 4 left-most bits (0100) show the version, which is correct. The next 4 bits (0010) show the header length; which means (2 × 4 = 8), which is wrong. The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission.

18 Example 2 In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet? Solution 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 are the base header, the next 12 bytes are the options.

19 Example 3 In an IP packet, the value of HLEN is 516 and the value of the total length field is How many bytes of data are being carried by this packet? Solution The HLEN value is 5, which means the total number of bytes in the header is 5 × 4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (40 − 20).

20 Example 4 An IP packet has arrived with the first few hexadecimal digits as shown below: How many hops can this packet travel before being dropped? The data belong to what upper layer protocol? Solution To 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 Table 8.4).

21 8.2 FRAGMENTATION The format and size of a frame depend on the protocol used by the physical network. A datagram may have to be fragmented to fit the protocol regulations. The topics discussed in this section include: Maximum Transfer Unit (MTU) Fields Related to Fragmentation

22 8.2 단편화 네트워크가 사용하는 프로토콜에 따라 프레임 형식과 크기가 서로 다르다
각 네트워크에서 전달되는 최대 전송 길이를 MTU (Maximum Transfer Unit) 라고 함 MTU 길이에 따라 나누어 보내는 것을 단편화 (fragmentation) 라고 함

23 8.2 단편화 MTU(Maxmum Transfer Unit)

24 8.2 단편화 서로 다른 네트워크의 MTU

25 8.2 단편화 단편화와 관련된 필드 식별자(identification) – 단편들은 같은 식별자 값을 가짐
플래그(flag) – 3 비트 필드

26 8.2 단편화 단편화 옵셋(Fragmentation offset) : 13 비트 필드
전체 데이터그램에서 단편의 상대적인 위치(8 바이트 단위) 단편화 예

27 8.2 단편화 상세한 단편화 예

28 Example 5 A packet has arrived with an M bit value of 0. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented? Solution If the M bit is 0, it means that there are no more fragments; the fragment is the last one. However, we cannot say if the original packet was fragmented or not. A nonfragmented packet is considered the last fragment.

29 Example 6 A packet has arrived with an M bit value of 1. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented? Solution If the M bit is 1, it means that there is at least one more fragment. This fragment can be the first one or a middle one, but not the last one. We don’t know if it is the first one or a middle one; we need more information (the value of the fragmentation offset). See also the next example.

30 Example 7 A packet has arrived with an M bit value of 1 and a fragmentation offset value of zero. Is this the first fragment, the last fragment, or a middle fragment?. Solution Because the M bit is 1, it is either the first fragment or a middle one. Because the offset value is 0, it is the first fragment.

31 Example 8 A packet has arrived in which the offset value is 100. What is the number of the first byte? Do we know the number of the last byte? Solution To find the number of the first byte, we multiply the offset value by 8. This means that the first byte number is 800. We cannot determine the number of the last byte unless we know the length of the data.

32 Example 9 A packet has arrived in which the offset value is 100, the value of HLEN is 5 and the value of the total length field is 100. What is the number of the first byte and the last byte? Solution The first byte number is 100 × 8 = 800. The total length is 100 bytes and the header length is 20 bytes (5 × 4), which means that there are 80 bytes in this datagram. If the first byte number is 800, the last byte number must be 879.

33 8.3 OPTIONS The header of the IP datagram is made of two parts: a fixed part and a variable part. The variable part comprises the options that can be a maximum of 40 bytes. The topics discussed in this section include: Format Option Types

34 8.3 옵션 옵션 형식 IP 데이터그램 헤더 내의 가변 부분(최대 40바이트)

35 8.3 옵션 코드 필드(8 비트) : 고정 길이 길이 필드(8 비트) : 고정길이 데이터 필드 : 가변 길이 복사(copy)
단편화에 옵션을 포함시킨 것인지 제어 클래스(class) 옵션의 목적을 나타냄 번호(number) 옵션 유형 길이 필드(8 비트) : 고정길이 옵션의 전체 길이 데이터 필드 : 가변 길이

36 8.3 옵션 옵션 유형

37 8.3 옵션 무연산(No Operation) 옵션 사이의 여백을 채워줌(1byte option)

38 8.3 옵션 종료 옵션(End of Option) 옵션 필드의 패딩 목적으로 사용 (1byte option)

39 8.3 옵션 Record Route 옵션 데이터그램을 처리한 인터넷 라우터들 기록

40 8.3 옵션 Record route 개념

41 8.3 옵션 엄격한 발신지 경로 지정 (Strict Source Route) 옵션
데이터그램이 거쳐야할 경로를 미리 지정하기 위해 사용 데이터그램은 옵션에 정의된 모든 라우터 방문

42 8.3 옵션 엄격한 발신지 경로 지정 개념

43 8.3 옵션 느슨한 발신지 경로 지정(Loose Source Route) 옵션
엄격한 발신지 경로와 비슷하지만 리스트에 없는 라우터도 방문 가능

44 8.3 옵션 타임스탬프(Timestamp) 옵션 라우터가 데이터그램을 처리하는 시간 기록
세계 표준시 이용 millisecond 단위 표시

45 8.3 옵션 타임스탬프에서 플래그 사용

46 8.3 옵션 타임스탬프 개념

47 Example 10 Which of the six options must be copied to each fragment? Solution We look at the first (left-most) bit of the code for each option. a. No operation: Code is ; not copied. b. End of option: Code is ; not copied. c. Record route: Code is ; not copied. d. Strict source route: Code is ; copied. e. Loose source route: Code is ; copied. f. Timestamp: Code is ; not copied.

48 Example 11 Which of the six options are used for datagram control and which are used for debugging and management? Solution We look at the second and third (left-most) bits of the code. a. No operation: Code is ; datagram control. b. End of option: Code is ; datagram control. c. Record route: Code is ; datagram control. d. Strict source route: Code is ; datagram control. e. Loose source route: Code is ; datagram control. f. Time stamp: Code is ; debugging and management control.

49 Example 12 One of the utilities available in UNIX to check the travelling of the IP packets is ping. In the next chapter, we talk about the ping program in more detail. In this example, we want to show how to use the program to see if a host is available. We ping a server at De Anza College named fhda.edu. The result shows that the IP address of the host is $ ping fhda.edu PING fhda.edu ( ) 56(84) bytes of data. 64 bytes from tiptoe.fhda.edu ( ): .... The result shows the IP address of the host and the number of bytes used.

50 8.4 CHECKSUM The error detection method used by most TCP/IP protocols is called the checksum. The checksum protects against the corruption that may occur during the transmission of a packet. It is redundant information added to the packet. The topics discussed in this section include: Checksum Calculation at the Sender Checksum Calculation at the Receiver Checksum in the IP Packet

51 8.4 검사합 Note: To create the checksum the sender does the following:
❏ The packet is divided into k sections, each of n bits ❏ All sections are added together using 1’s complement arithmetic ❏ The final result is complemented to make the checksum. Note:

52 8.4 검사합 검사합 개념

53 8.4 검사합 1의 보수를 이용한 검사합

54 Example 17 Figure 8.24 shows an example of a checksum calculation for an IP header without options. The header is divided into 16-bit sections. All the sections are added and the sum is complemented. The result is inserted in the checksum field.

55 8.4 검사합 이진수 검사합 예

56 Example 18 Let us do the same example in hexadecimal. Each row has four hexadecimal digits. We calculate the sum first. Note that if an addition results in more than one hexadecimal digit, the right-most digit becomes the current-column digit and the rest are carried to other columns. From the sum, we make the checksum by complementing the sum. However, note that we subtract each digit from 15 in hexadecimal arithmetic (just as we subtract from 1 in binary arithmetic). This means the complement of E (14) is 1 and the complement of 4 is B (11). Figure 8.25 shows the calculation. Note that the result (8BB1) is exactly the same as in Example 17.

57 8.4 검사합 16진수 검사합 예

58 8.4 검사합 Check Appendix C for a detailed description of checksum calculation and the handling of carries. Note:

59 8.5 IP PACKAGE We give an example of a simplified IP software package to show its components and the relationships between the components. This IP package involves eight modules. The topics discussed in this section include: Header-Adding Module Processing Module Queues Routing Table Forwarding Module MTU Table Fragmentation Module Reassembly Table Reassembly Module

60 8.5 IP 설계 IP 컴포넌트

61 8.5 IP 설계 IP 구성 요소 헤더 추가 모듈 처리 모듈 큐 라우팅 테이블 라우팅 모듈 MTU 테이블 단편화 모듈
재조립 모듈

62 8.5 IP 설계 헤더 추가 모듈(Header-Adding Module) 알고리즘
Receive: data, destination address 1. Encapsulate the data in an IP datagram. 2. Calculate the checksum and insert it in the checksum field. 3. Send the data to the corresponding input queue. 4. Return.

63 8.5 IP 설계 처리 모듈(Processing Module) 알고리즘 Processing Module
1. Remove one datagram from one of the input queues. 2. If (destination address is 127.X.Y.Z or matches one of the local addresses) 1. Send the datagram to the reassembly module. 2. Return. 3. If (machine is a router) 1. Decrement TTL. 4. If (TTL less than or equal to zero) 1. Discard the datagram. 2. Send an ICMP error message. 3. Return. 5. Send the datagram to the routing module. 6. Return.

64 8.5 IP 설계 큐(Queue) – 입/출 큐 라우팅 테이블 : 패킷의 다음 홉 주소 결정하기 위해 라우팅 모듈이 사용
라우팅 모듈 : 6장 참조 MTU 테이블 : 단편화 모듈이 특정 인터페이스의 MTU를 찾기 위해 사용

65 8.5 IP 설계 단편화 모듈(Fragmentation Module)
Receive: an IP packet from routing module 1. Extract the size of the datagram. 2. If (size > MTU of the corresponding network) 1. If (D (do not fragment) bit is set) 1. Discard the datagram. 2. Send an ICMP error message 3. Return. 2. Else 1. Calculate the maximum size. 2. Divide the datagram into fragments. 3. Add header to each fragment. 4. Add required options to each fragment. 5. Send the datagrams. 6. Return. 3. Else 1. Send the datagram. 4. Return.

66 8.5 IP 설계 재조립 테이블(Reassembly table) 재조립 모듈에 의해 사용 재조립 테이블

67 8.5 IP 설계 재조립 테이블 필드 상태(state) : FREE 또는 IN-USE IP 주소 : 발신지 주소
데이터그램 ID : 단편을 구분하는 번호 타임 아웃 : 단편이 도착해야 하는 시간 단편 : 연결 리스트의 포인터

68 8.5 IP 설계 재조립 모듈(Reassembly Module)
Receive: an IP datagram from the processing module 1. If (offset value is zero and the M bit is 0) 1. Send the datagram to the appropriate queue. 2. Return. 2. Search the reassembly table for the corresponding entry. 3. If (not found) 1. Create a new entry.

69 8.5 IP 설계 재조립 모듈(Reassembly Module) (계속)
4. Insert the fragment at the appropriate place in the link list. 1. If(all fragments have arrived) 1. Reassemble the fragments. 2. Deliver the datagram to the corresponding upper layer protocol. 3. Return. 2. Else 1. Check the time-out. 2. If(time-out expired) 1. Discard all fragments. 2. Send an ICMP error message(see chapter 9). 5. return

70 알림 연습문제 풀이해서 Report로 다음주까지(일주일 후) 제출해 주세요!


Download ppt "Internet Protocol Objectives Chapter 8"

Similar presentations


Ads by Google