37
1 5 장 . 장장장장 장장장 장장장 내내 내내내내 내내 (Network Layer) 내내 내내내 내내내내 IP 내내내내 – IP addressing – IP 내내내내 ARP/RARP ICMP IPv6

5 장 . 네트워크 계층과 라우팅

Embed Size (px)

DESCRIPTION

5 장 . 네트워크 계층과 라우팅. 내용 네트워크 계층 (Network Layer) 소개 라우팅 알고리즘 IP 프로토콜 IP addressing IP 동작절차 ARP/RARP ICMP IPv6. transport packet from sending to receiving hosts network layer protocols in every host, router three important functions: - PowerPoint PPT Presentation

Citation preview

Page 1: 5 장 .  네트워크 계층과 라우팅

1

5 장 . 네트워크 계층과 라우팅

내용– 네트워크 계층 (Network Layer) 소개– 라우팅 알고리즘– IP 프로토콜

– IP addressing

– IP 동작절차

– ARP/RARP– ICMP– IPv6

Page 2: 5 장 .  네트워크 계층과 라우팅

2

Network layer functions transport packet from sending t

o receiving hosts network layer protocols in ever

y host, router

three important functions: path determination: route taken

by packets from source to dest. Routing algorithms

switching: move packets from router’s input to appropriate router output

call setup: some network architectures require router call setup along path before data flows

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 3: 5 장 .  네트워크 계층과 라우팅

3

The Internet Network layer

routingtable

Host, router network layer functions:

Routing protocols•path selection•RIP, OSPF, BGP

IP protocol•addressing conventions•datagram format•packet handling conventions

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

Page 4: 5 장 .  네트워크 계층과 라우팅

4

Routing algorithms- Distance Vector- Link State

Distance Vector Routing Alg. 각 라우터는 주기적으로 그 이웃 각각과 명확한 경로

정보를 교환하는데 , ARPANET 에서 처음 사용 각 라우터는 네트워크의 다른 라우터에 대한 엔트리를

갖는 라우팅 테이블을 유지 각 엔트리는 목적지를 위해 사용할 출력회선과 그

행선지까지의 측정시간이나 거리 RIP is a form of Distance Vector Alg. RIP 는 원래 Arpanet 에서 사용 현재도 Internet 에서 사용 Novell has adapted it as Novell RIP.

Page 5: 5 장 .  네트워크 계층과 라우팅

5

Distance Vector Routing 동작

매 T msec 마다 각 라우터는 각 라우터까지의 측정된 지연시간 리스트를 각 이웃 (neighbor) 에 보낸다 .

또한 라우터 (J) 는 각 이웃으로부터 비슷한 리스트를 받는다 . 이들 테이블 중 하나가 이웃 X 로 부터 방금 도착한 것이라 생각하자 . 여기서 Xi 는 라우터 i 에 도착하는데 걸리는 시간으로 X 의 측정치 이다 .

라우터 (J) 가 X 까지 측정된 지연시간이 msec 라고 한다면 X를 경유하여 라우터 i 에 도착하는 지연시간이 Xi+m msec 임을 안다 .

각 이웃에 대해 이와 같은 산출을 함으로 라우터는 그중에서 최상의 평가치를 알아내고 그 라우팅 정보와 링크를 사용한다 .

예 : [ 그림 5.13]

Page 6: 5 장 .  네트워크 계층과 라우팅

6

Link state routing

It is increasingly popular within autonomous systems

Link state protocols are contained in ISO’s OSPF (Open Shortest Path First) algorithm for connectionless network layer services

in the NFSNET backbone IS-IS protocol in Novell’s NLSP

Makes use of Dijkstra’s algorithm. Five steps.

Page 7: 5 장 .  네트워크 계층과 라우팅

7

Link State Routing algorithm 1. 각 라우터의 주변 (neighbor) 라우터를 인지하고 그들의 네트워크

주소를 숙지 HELLO packet send, 주변의 라우터는 응답

2. 주변 라우터의 각각에 대한 지연시간 또는 비용을 측정 ECHO packet send, 다른 라우터는 즉시 응답

3. Link state 를 주변 라우터에게 알려주기 위한 패킷을 생성 [ 그림 5.14]

4. 이 패킷을 모든 라우터에게 분배 flooding algorithm 사용

[ 그림 5.15]

5. 모든 라우터로의 최단 경로 (shortest path) 를 계산

Page 8: 5 장 .  네트워크 계층과 라우팅

8

TCP/IP 주소지정 세가지 호스트 식별자

Host name 예 : kowon.dongseo.ac.kr

IP address 예 : 203.241.176.13

Physical Hardware address 48 비트 MAC address

Page 9: 5 장 .  네트워크 계층과 라우팅

9

식별자 변환 호스트 이름을 인터넷 주소로의 변환

DNS

/etc/hosts

인터넷 주소를 물리적인 하드웨어 주소로의 변환 ARP: Address Resolution Protocol

RARP: Reverse ARP

Page 10: 5 장 .  네트워크 계층과 라우팅

10

인터넷 주소지정 IP 는 IP 데이타그램이 송신측 호스트에서 목적지 호스트로

전송되는 라우팅 (routing) 기능을 수행 인터넷을 통해 전달되는 IP 데이타그램 각각의 헤더는

송신측 호스트의 인터넷 주소와 목적지 호스트의 인터넷 주소를 포함

인터넷 주소 형식

32 비트 길이이며 두 부분 즉 네트워크 식별자와 호스트 식별자로 구성

네트워크 식별자의 앞쪽 비트들은 인터넷 주소가 어느 등급 (class) 에 속해있는지를 식별

Page 11: 5 장 .  네트워크 계층과 라우팅

11

IP address 구조

0 net-id host-id

3224168

7 24 (ºñÆ®)

Ŭ·¡½º A

1 net-id host-id

14 16

Ŭ·¡½º B0

1 net-id host-id

21 8

Ŭ·¡½º C1 0

Page 12: 5 장 .  네트워크 계층과 라우팅

12

점 - 십진 (Dotted-decimal) 표기 등급 A 주소는 0.0.0.1 에서 127.255.255.254 까지의 범위 등급 B 는 128.0.0.1 에서 191.255.255.254 까지의 범위 등급 C 는 192.0.0.1 에서 223.255.255.254 까지의 범위

Page 13: 5 장 .  네트워크 계층과 라우팅

13

Subnetting 원래 TCP/IP 주소지정 방식은 네트워크 식별자와 호스트

식별자로 단지 2 단계 계층만을 허용 TCP/IP 주소지정 방식이 이들 엄청나게 많은 네트워크를

수용하기 위해서 서브네팅의 개념이 고안 서브넷 식별자 : [ 그림 6.9]

서브넷 마스크 (mask): [ 그림 6.10]

인터넷 주소중 몇 비트가 네트워크를 식별하기 위해 사용되는지 그리고 몇 비트가 호스트를 식별하기 위해 사용되는지 구분

예 : 등급 A: 255.0.0.0, 등급 B: 255.255.0.0

Page 14: 5 장 .  네트워크 계층과 라우팅

14

주소 구조 ( 하나의 서브넷에 여러개의 망 )

IS

DTE 1 DTE 2

128 .10 .1.1 128 .10 .1.2

DTE 3 DTE 4

128 .10 .2.2128 .10 .2.1

128 .10 .1.x ¸Á

128 .10 .2.x ¸Á

¿ÜºÎ ÀÎÅͳÝ

128 .10 .x.xÀÇ´ÜÀÏ ¸ÁÀ¸·Î º¸ÀÓ

1 0

net-id (14 ºñÆ®) host-id (16 ºñÆ®)¿ÜºÎ ÀÎÅͳÝ

128 .10 .x.x ¸Á ³»ºÎ net-id (14 ºñÆ®) host-id(8ºñÆ®)¼ ºê³Ý-id(8ºñÆ®)

±¸¼º ¿¹

ÁÖ¼Ò ±¸Á¶ÀÇ ¿¹

Page 15: 5 장 .  네트워크 계층과 라우팅

15

IP addresses: how to get one?

Hosts (host portion): hard-coded by system admin in a file DHCP: Dynamic Host Configuration Protocol: dynamically get address: “plug-and-play”host broadcasts “DHCP discover” msgDHCP server responds with “DHCP offer” msghost requests IP address: “DHCP request” msgDHCP server sends address: “DHCP ack” msg

Page 16: 5 장 .  네트워크 계층과 라우팅

16

IP(Internet Protocol)

IP 는 TCP/IP 인터넷 계층에서 동작되며 데이터 단위를 출발지 호스트에서 목적지 호스트로 전달

IP 에서의 데이터 단위 : IP 데이타그램 또는 패킷 IP 데이타그램의 헤더부분

출발지 호스의 인터넷 주소와 목적지 호스트의 인터넷 주소를 포함 IP 는 비연결 데이터 전달 서비스를 제공

흐름제어나 오류회복을 하지 않는다 . 가능한 오류

손실된 IP 데이타그램 순서화 되지 않은 (out-of-sequence) IP 데이타그램 복제 (duplicate) IP 데이타그램

TCP : 오류들을 탐지해서 회복할 수 있는 기능을 책임

Page 17: 5 장 .  네트워크 계층과 라우팅

17

IP 데이타그램 ( 패킷 ) 구조

1 16984 5

¹öÁ¯ Çì´õ ±æÀÌ ¼ ºñ½º ŸÀÔ

3217

Àüü ±æÀÌ

(¸Þ½ÃÁö ¶Ç´Â µ¥ÀÌŸ±×¶÷) ±¸ºÐÀÚ (µ¥ÀÌŸ±×¶÷ ³»ÀÇ) ¿É¼Â(offset)MD

1918

ÆÐŶ »ýÁ¸ ½Ã°£ (»óÀ§) ÇÁ·ÎÅäÄÝ Çì´õ Ã¥¼¶

¼Û½ÅÃø IP ÁÖ¼Ò

¼ö½ÅÃø IP ÁÖ¼Ò

¿É¼Ç(option) + Æеù(pading)

µ¥ÀÌŸ

Çì´õ

ºñÆ®

Page 18: 5 장 .  네트워크 계층과 라우팅

18

IP routing

[그림 6.12] Sample Network

Page 19: 5 장 .  네트워크 계층과 라우팅

19

Node a.ncat.edu wants to send one IP packet to www.acme.com. 가정 :None of the nodes have any cached data. The only info

rmation they have is what is shown in the diagram. The table below shows all of the packets that would be sent.

Source HWaddr

Source IPaddr

Dest HWaddr

Dest IPaddr

purpose5 152.8.244.5

5Broadcast 152.8.244.

1ARP request for DNShardware address

3 152.8.244.1 5 152.8.244.55

ARP reply5 152.8.244.5

53 152.8.244.

1ask DNS for www.acme.comIP address

3 152.8.244.1 5 152.8.244.55

DNS replies with IPaddress5 152.8.244.5

5Broadcast 152.8.254.

254ARP request for gatewayhardware address

4 152.8.254.254

5 152.8.244.55

ARP reply5 152.8.244.5

54 176.5.6.9 Send message to gateway

2 176.5.4.3 Broadcast 176.5.6.9 ARP request forwww.acme.com hardwareaddress9 176.5.6.9 2 176.5.4.3 ARP reply

2 152.8.244.55

9 176.5.6.9 Send message towww.acme.com

Page 20: 5 장 .  네트워크 계층과 라우팅

20

IP routing 동작절차

[ 그림 6.13] 호스트에서의 IP routing 할때 두가지 경우

목적지가 같은 네트워크내에 있는 경우 바로 목적지 호스트에게 IP 데이타그램 전달

목적지가 다른 네트워크에 있는 경우 IP 라우팅 기능을 사용하여 라우터에게 전달

각 호스트는 각각의 라우팅 테이블을 유지 라우팅 테이블은 적어도 하나의 default router 의 주소를

포함하는 엔트리를 포함

Page 21: 5 장 .  네트워크 계층과 라우팅

21

같은 네트워크 상에서의 데이타그램 전달의 예 [ 그림 6.13] 에 있는 호스트 A 에서 호스트 B 로 IP 데이타그램

전달 1) B 의 네트워크 ID 값과 A 자신의 네트워크 ID 값을

비교하기 위해 서브넷 마스크를 사용 2) A 와 B 의 네트워크 ID 값은 서로 같으므로 IP

데이타그램을 직접 전달하기 위해 B 의 물리적인 하드웨어 주소를 알아야 함

3) 호스트 A 의 IP 프로세스는 ARP 캐쉬를 조회 4-1) 조회하여 있으면 호스트 IP 데이타그램을 직접 호스트 B

로 전달 4-2) 조회하여 없으면 ARP 프로토콜 동작

Page 22: 5 장 .  네트워크 계층과 라우팅

22

다른 네트워크로의 데이타그램 전달 [ 그림 6.13] 에 있는 호스트 A 에서 호스트 D 로 IP 데이타그램 전달 1) D 의 네트워크 ID 값과 A 자신의 네트워크 ID 값을 비교하기

위해 서브넷 마스크를 사용 2) A 와 D 의 네트워크 ID 값은 서로 다르므로 IP 데이타그램의

A 는 자신의 라우팅 테이블을 검색 ( 이경우 default router 사용 ) 3) A 의 IP 프로세스는 default router 의 물리적인 하드웨어

주소를 알기 위하여 다시 ARP 캐쉬를 조회 4-1) 조회하여 있으면 호스트 IP 데이타그램을 직접 default router

로 전달 4-2) 조회하여 없으면 ARP 프로토콜 동작

5) default router 는 1) ~4) 동작을 반복

Page 23: 5 장 .  네트워크 계층과 라우팅

23

Introduction - the future of IP(IPv6) Current version of IP - version 4 - is 20 years

old IPv4 has shown remarkable ability to move to new

technologies IETF has proposed entirely new version to

address some specific problems IP has accommodated dramatic changes since

original design Basic principles still appropriate today

Scaling Size - from a few tens to a few tens of millions of

computers Speed - from 56Kbps to 1Gbps

Page 24: 5 장 .  네트워크 계층과 라우팅

24

IP 변화의 필요성

Address space 32 bit address space allows for over a million

networks But...most are Class C and too small for many

organizations 2**14 Class B network addresses already almost

exhausted Type of service

Different applications have different requirements for delivery reliability and speed

Current IP has type of service that's not often implemented

Multicast

Page 25: 5 장 .  네트워크 계층과 라우팅

25

New features

Address size - IPv6 addresses are 128bits Header format - entirely different Extension headers - Additional information

stored in optional extension headers, followed by data

Support for audio and video - flow labels and quality of service allow audio and video applications to establish appropriate connections

Extensible - new features can be added more easily

Page 26: 5 장 .  네트워크 계층과 라우팅

26

IPv6 address notation

128-bit address--> dotted decimal; requires 16 numbers 105.220.136.100.255.255.255.255.0.0.18.128.140.10.255.255

Groups of 16-bit numbers in hex separated by colons- colon hexadecimal (or colon hex) 69DC:8864:FFFF:FFFF:0:1280:8C0A:FFFF

Zero-compression - series of zeroes indicated by two colons FF0C:0:0:0:0:0:0:B1 FF0C::B1

IPv6 address with 96 leading zeros is interpreted to hold an IPv4 address

Page 27: 5 장 .  네트워크 계층과 라우팅

27

IPv6 Initial motivation: 32-bit address space completely allocat

ed by 2008. Additional motivation:

header format helps speed processing/forwarding header changes to facilitate QoS new “anycast” address: route to “best” of several replic

ated servers IPv6 datagram format:

fixed-length 40 byte header no fragmentation allowed

Page 28: 5 장 .  네트워크 계층과 라우팅

28

IPv6 Header (Cont)Priority: identify priority among datagrams in flowFlow Label: identify datagrams in same “flow.” (concept of“flow” not well defined).Next header: identify upper layer protocol for data

Page 29: 5 장 .  네트워크 계층과 라우팅

29

Other Changes from IPv4 Checksum: removed entirely to reduce processing

time at each hop Options: allowed, but outside of header,

indicated by “Next Header” field ICMPv6: new version of ICMP

additional message types, e.g. “Packet Too Big”

multicast group management functions

Page 30: 5 장 .  네트워크 계층과 라우팅

30

Transition From IPv4 To IPv6 Not all routers can be upgraded simultaneous

no “flag days” How will the network operatewith mixed IPv4 and IPv6

routers? Two proposed approaches:

Dual Stack: some routers with dual stack (v6, v4) can “translate” between formats

Tunneling: IPv6 carried as payload n IPv4 datagram among IPv4 routers

Page 31: 5 장 .  네트워크 계층과 라우팅

31

Dual Stack Approach

Page 32: 5 장 .  네트워크 계층과 라우팅

32

Tunneling

IPv6 inside IPv4 where needed

Page 33: 5 장 .  네트워크 계층과 라우팅

33

ARP(Address Resolution Protocol)

계층간의 주소 구조– IP 계층 : IP 주소– IP 하위 계층 : 물리적인 하드웨어 주소 (PHA)

동일한 망내 호스트 들간의 패킷 교환– IP 계층에 망내 호스트 들의 “ IP 주소 , PHA 주소” 테이블 (

ARP cache)– IP 계층 동작

패킷의 수신지 IP 주소에 해당하는 PHA 주소로 패킷 전송

ARP– IP 주소에 해당하는 PHA 주소를 모르는 경우

Page 34: 5 장 .  네트워크 계층과 라우팅

34

ARP 의 동작 절차 1) ARP request packet 을 LAN 상에 broadcast

ARP request packet 내용 : 알고자 하는 호스트의 IP 주소 자신의 IP 주소 , PHA

주소 2) LAN 상의 모든 호스트에서 동작하는 ARP 프로세스는 ARP req

uest packet 수신 3) B 는 자신의 PHA 주소를 포함하는 ARP response packet 을 송신측에 전송

4) A 가 ARP 응답 패킷을 받을 때 호스트 A 는 그 ARP 캐쉬 내에 호스트 B 의 물리적인 하드웨어 주소를 저장

5) A 는 ARP 캐쉬 엔트리에 있는 정보를 사용 [ 그림 6.16], [ 그림 6.17], [ 그림 6.18]

Page 35: 5 장 .  네트워크 계층과 라우팅

35

RARP(Reverse ARP)– PHA 주소를 알고 , 그에 해당하는 IP 주소를 모르는 경우

– 디스크 없는 워크스테이션 (Diskless Workstation)에서 사용

Page 36: 5 장 .  네트워크 계층과 라우팅

36

인터넷 제어 메시지 프로토콜 (ICMP)

ICMP(Internet Control Message Protocol) 의 기능 – 에러 보고 (Error Reporting)– 도착 가능 검사 (Reachability Testing)– 혼잡 제어– 수신측 경로 변경

– [ 그림 6.19] [ 그림 6.20] – [ 그림 6.21]

Page 37: 5 장 .  네트워크 계층과 라우팅

37

ICMP: Internet Control Message Protocol

used by hosts, routers, gateways to communication network-level information error reporting: unreacha

ble host, network, port, protocol

echo request/reply (used by ping)

network-layer “above” IP: ICMP msgs carried in IP d

atagrams ICMP message: type, code plu

s first 8 bytes of IP datagram causing error

Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header