hannam university http://netwk.hannam.ac.kr 1 chapter 8 internet protocol (ip)

76
1 HANNAM UNIVERSITY Http://netwk.hannam.ac.kr Chapter 8 Internet Protocol (IP)

Upload: christiana-short

Post on 27-Dec-2015

227 views

Category:

Documents


9 download

TRANSCRIPT

1HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

Chapter 8

Internet Protocol(IP)

2HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

CONTENTSCONTENTS

• DATAGRAM• FRAGMENTATION• OPTIONS• CHECKSUM• IP PACKAGE

3HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

인터넷 프로토콜인터넷 프로토콜 ((IP)IP)

TCP/IP 에서 사용하는 전송 메커니즘

신뢰성 없는 비연결형 데이터그램 프로토콜

최선노력 (best effort) 전달 서비스

오류 검사 및 추적 기능을 수행하지 않음

각 데이터그램은 독립적으로 처리

각 데이터그램은 서로 다른 경로로 전달될 수 있음

각 데이터그램은 순서가 바뀌어 전달될 수 있음

4HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

5HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

DATAGRAM

8.18.1

6HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.1 8.1 데이터 그램데이터 그램

IP 데이터 그램

7HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

가변 길이 패킷헤더와 데이터 부분으로 구성헤더 : 20 ~ 60 바이트 길이 , 라우팅과 전달에

필요한 정보헤더 내의 필드

버전 (Ver) - IP 프로토콜 버전 (4 비트 )

헤더길이 (HLEN) - 헤더의 전체 길이를 4 바이트 단위로 표시 (4 비트 )

8HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

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

9HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

TOS(type of service) 비트서비스 유형

TOS Bits Description0000 Normal (default)0001 Minimize cost0010 Maximize reliability0100 Maximize throughput1000 Minimize delay

10HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

응용 프로그램들의 서비스 유형 기본 값Protocol TOS Bits DescriptionICMP 0000 NormalBOOTP 0000 NormalNNTP 0001 Minimize costIGP 0010 Maximize reliabilitySNMP 0010 Maximize reliabilityTELNET 1000 Minimize delayFTP (data) 0100 Maximize throughputFTP (control) 1000 Minimize delayTFTP 1000 Minimize delaySMTP (command) 1000 Minimize delaySMTP (data) 0100 Maximize throughputDNS (UDP query) 1000 Minimize delayDNS (TCP query) 0000 NormalDNS (zone) 0100 Maximize throughput

11HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

차별화된 서비스 (Differentiated Service) 오른쪽 3 비트가 0 이면 우선순위와 같은 의미로 해석 오른쪽 3 비트가 0 이 아니면 기관에서 정의된 서비스

코드 포인트의 값

The precedence subfield is The precedence subfield is not used in version 4.not used in version 4.

Category Codepoint Assigning Authority

1 XXXXX0 Internet

2 XXXX11 Local

3 XXXX01 Temporary or experiment

12HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

The total length field defines theThe total length field defines thetotal length of the total length of the

datagram including the header.datagram including the header.

13HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

전체 길이 (total length)16 bit 필드 (65,535 까지 표현 )

IP 데이터그램의 전체 길이를 바이트 단위로 표시데이터 길이 = 전체 길이 – 헤더 길이이더넷 프레임에서 작은 데이터그램의 캡슐화

14HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

식별 (Identification) – 단편화에 사용

플래그 (flag) – 단편화에 사용

단편 옵셋 (fragmentation offset) –

단편화에 사용

수명 (time to live) – 데이터그램의 수명

15HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.1 IP 8.1 IP 데이터 그램데이터 그램 프로토콜 (protocol) – IP 계층의 서비스를

사용하는 상위 계층 프로토콜 검사합 (checksum)

– 오류 확인 발신지 주소

(source address) 목적지 주소

(destination address)OSPF89

UDP17

TCP6

IGMP2

ICMP1

protocoladdress

16HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

Example 1Example 1

An IP packet has arrived with the first 8 bits as shown:

01000010

The receiver discards the packet. Why?

17HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

SolutionSolution

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.

18HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

Example 2Example 2

In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet?

19HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

SolutionSolution

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 main header, the next 12 bytes are the options.

20HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

Example 3Example 3

In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816. How many bytes of data are being carried by this packet?

21HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

SolutionSolution

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 (4020).

22HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

Example 4Example 4

An IP packet has arrived with the first few hexadecimal digits as shown below:

45000028000100000102...................

How many hops can this packet travel before being dropped? The data belong to what upper layer protocol?

23HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

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

SolutionSolution

To find the time-to-live field, we should 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.

24HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

FRAGMENTATION

8.28.2

25HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

네트워크가 사용하는 프로토콜에 따라 프레임 형식과 크기가 서로 다르다

각 네트워크에서 전달되는 최대 전송 길이를 MTU (Maximum Transfer Unit) 라고 함

MTU 길이에 따라 나누어 보내는 것을 단편화 (fragmentation) 라고 함

26HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

MTU(Maxmum Transfer Unit)

27HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

서로 다른 네트워크의 MTU

Protocol MTUHyperchannel 65,535Token Ring (16 Mbps) 17,914Token Ring (4 Mbps) 4,464FDD 4,352Ethernet 1,500X.25 576PPP 296

28HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

단편화와 관련된 필드식별자 (identification) – 단편들은 같은 식별자 값을

가짐플래그 (flag) – 3 비트 필드

29HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

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

바이트 단위 )

단편화 예

30HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

상세한 단편화 예

31HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

Example 5Example 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?

32HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

SolutionSolution

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.

33HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

Example 6Example 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?

34HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

SolutionSolution

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). However, we can definitely say the original packet has been fragmented because the M bit value is 1.

35HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

Example 7Example 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?

36HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

SolutionSolution

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.

37HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

Example 8Example 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?

38HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

SolutionSolution

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.

39HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

Example 9Example 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?

40HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.2 8.2 단편화단편화

SolutionSolution

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 879.

41HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

OPTIONS

8.38.3

42HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

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

바이트 )

43HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

코드 필드 (8 비트 ) : 고정 길이 복사 (copy)

단편화에 옵션을 포함시킨 것인지 제어

클래스 (class)

옵션의 목적을 나타냄

번호 (number)

옵션 유형

길이 필드 (8 비트 ) : 고정길이 옵션의 전체 길이

데이터 필드 : 가변 길이

44HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

옵션 유형

45HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

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

46HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

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

47HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

경로 기록 (Record Route) 옵션데이터그램을 처리한 인터넷 라우터들 기록

48HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

데이터그램이 라우터를 경유하여 이동하는 과정

49HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

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

50HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

엄격한 발신지 경로 개념

51HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

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

방문 가능

52HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

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

53HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

타임스탬프에서 플래그 사용

54HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

타임스탬프 개념

55HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

Example 10Example 10

Which of the six options must be copied to each fragment?

56HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

SolutionSolution

We look at the first (left-most) bit of the code for each option.

No operation: Code is 00000001; no copy.

End of option: Code is 00000000; no copy.

Record route: Code is 00000111; no copy.

Strict source route: Code is 10001001; copied.

Loose source route: Code is 10000011; copied.

Timestamp: Code is 01000100; no copy.

57HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

Example 11Example 11

Which of the six options are used for datagram control and which are used for debugging and management?

58HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.3 8.3 옵션옵션

SolutionSolution

We look at the second and third (left-most) bits of the code.

No operation: Code is 00000001; control.

End of option: Code is 00000000; control.

Record route: Code is 00000111; control.

Strict source route: Code is 10001001; control.

Loose source route: Code is 10000011; control.

Timestamp: Code is 01000100; debugging

59HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

CHECKSUM

8.48.4

60HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.4 8.4 검사합검사합

To create the checksum the sender does To create the checksum the sender does the following:the following:

1.1. The packet is divided into k sections, The packet is divided into k sections, each of n bits. each of n bits.

2.2. All sections are added together using All sections are added together using one’s complement arithmetic. one’s complement arithmetic.

3.3. The final result is complemented The final result is complemented to make the checksum. to make the checksum.

61HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.4 8.4 검사합검사합

검사합 개념

62HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.4 8.4 검사합검사합

1 의 보수를 이용한 검사합

63HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.4 8.4 검사합검사합

이진수 검사합 예

64HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.4 8.4 검사합검사합

16 진수 검사합 예

65HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.4 8.4 검사합검사합

Check Appendix C for a detailed Check Appendix C for a detailed description of checksum calculation description of checksum calculation

and the handling of carries.and the handling of carries.

66HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

IP PACKAGE

8.58.5

67HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 8.5 IP 설계설계

IP 컴포넌트

68HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 8.5 IP 설계설계

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

69HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 8.5 IP 설계설계

헤더 추가 모듈 (Header-Adding Module)알고리즘

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.

70HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 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.

71HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 8.5 IP 설계설계

큐 (Queue) – 입 / 출 큐 라우팅 테이블 : 패킷의 다음 홉 주소 결정하기 위해

라우팅 모듈이 사용 라우팅 모듈 : 6 장 참조 MTU 테이블 : 단편화 모듈이 특정 인터페이스의

MTU 를 찾기 위해 사용

72HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 8.5 IP 설계설계

단편화 모듈 (Fragmentation Module)Receive: an IP packet from routing module1. 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 message3. Return.

2. Else1. 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.

73HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 8.5 IP 설계설계

재조립 테이블 (Reassembly table)재조립 모듈에 의해 사용재조립 테이블

74HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 8.5 IP 설계설계

재조립 테이블 필드상태 (state) : FREE 또는 IN-USE

IP 주소 : 발신지 주소

데이터그램 ID : 단편을 구분하는 번호

타임 아웃 : 단편이 도착해야 하는 시간

단편 : 연결 리스트의 포인터

75HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 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.

76HANNAM UNIVERSITYHttp://netwk.hannam.ac.kr

8.5 IP 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