ARP and RARP

Chapter 7
ARP
and
RARP
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
1
CONTENTS
• ARP
• ARP PACKAGE
• RARP
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
2
인터넷에서 사용하는 주소
1. 논리 주소(logical address)
 호스트나 라우터가 사용하는 네트워크 레벨 주소
 전세계적으로 유일한 주소
 IP 주소
 32 비트 길이
2. 물리 주소(physical address)
 로컬 네트워크에서 유효한 주소
 로컬 주소(local address)
 로컬에서만 유일하면 됨
 보통 하드웨어로 구현
 호스트나 라우터내에 설치된 NIC에 들어 있음
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
3
인터넷에서 사용하는 주소
호스트나 라우터로 패킷을 전달하기 위해 논
리 및 물리 주소가 모두 필요
논리 주소를 물리 주소로 변환 또는 그 반대가
필요
정적 또는 동적 변환 가능
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
4
인터넷에서 사용하는 주소
정적 변환(static mapping)
논리 주소와 물리 주소 연관 테이블 생성
네트워크상의 각 시스템에 저장
필요시 테이블 검색
물리 주소가 변경될 경우 정적 테이블의 주기적인
갱신으로 인한 오버헤드
(NIC 변경, 이동 컴퓨터의 네트워크 이동 등)
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
5
인터넷에서 사용하는 주소
동적 변환(dynamic mapping)
물리 주소와 논리 주소 쌍 중 하나만 알면 프로토콜
을 이용하여 다른 하나를 알아냄
ARP : 논리 주소를 물리 주소로 변환
RARP : 물리 주소를 논리 주소로 변환
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
6
인터넷에서 사용하는 주소
ARP와 RARP
Address Resolution Protocol
Reverse Address Resolution Protocol
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
7
인터넷에서 사용하는 주소
TCP/IP 프로토콜에서 ARP와 RARP의 위치
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
8
7.1
ARP
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
9
7.1 ARP
ARP 동작
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
10
7.1 ARP
ARP 패킷 형식
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
11
7.1 ARP
 Hardware type : 네트워크 유형 정의(이더넷 : 1)
 Protocol type : 프로토콜 정의(IPv4 : 080016)
 Hardware length : 물리 주소의 바이트 단위 길이
 Protocol length : 논리 주소의 바이트 단위 길이
 Operation : 패킷 유형-ARP 요청(1), ARP 응답(2)
 Sender hardware address : 송신자 물리 주소
 Sender protocol address : 송신자 논리 주소
 Target hardware address : 타겟 물리 주소
 Target protocol address : 타겟 논리 주소
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
12
7.1 ARP
ARP 패킷의 캡슐화
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
13
7.1 ARP
 ARP 프로세스의 캡슐화 동작 과정
1.
송신자는 타겟 IP 주소를 알고있다
2.
IP가 ARP에게 ARP 요청 메시지 생성 요청
(송신자 물리 주소, IP 주소; 타겟 IP 주소, 물리 주소(O))
3.
데이터링크층에 전달되면 발신지 주소는 송신자의 물리주소, 목
적지 주소는 물리 브로드캐스트 주소로 하는 프레임에 캡슐화
4.
모든 호스트나 라우터가 프레임을 수신하여 자신의 ARP에 전달
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
14
7.1 ARP
5. 타겟 시스템을 자신의 물리 주소를 포함한 ARP 응
답 메시지 송신(유니케스트)
6. 송신자는 응답 메시지를 받고 타겟 시스템의 물리
주소를 알게 된다
7. IP 데이터그램은 프레임으로 캡슐화 되어 목적지
에 유니캐스트
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
15
7.1 ARP
 ARP 서비스가 사용되는 4 가지 경우
1. 송신자가 호스트로서 같은 네트워크상에 다른 호
스트에 패킷 전송(논리주소는 목적지 IP주소)
2. 송신자가 호스트이고 다른 네트워크상에 있는 다
른 호스트에게 패킷 전송(논리 주소는 라우터의 IP
주소)
3. 송신자는 다른 네트워크상에 있는 호스트로 가는
데이터그램을 수신한 라우터(논리 주소는 다음 홉
라우터의 IP 주소)
4. 송신자는 같은 네트워크 상에 있는 호스트로 가는
데이터그램을 수시한 라우터(논리 주소는 목적지
IP 주소)
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
16
7.1 ARP
ARP를 사용 예
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
17
7.1 ARP
ARP 사용 예
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
18
7.1 ARP
ARP 사용 예
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
19
7.1 ARP
ARP 사용 예
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
20
7.1 ARP
An ARP request is broadcast;
an ARP reply is unicast.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
21
7.1 ARP
Example 1
A host with IP address 130.23.43.20 and physical
address 0xB23455102210 has a packet to send to
another host with IP address 130.23.43.25 and
physical address 0xA46EF45983AB. The two
hosts are on the same Ethernet network. Show the
ARP request and reply packets encapsulated in
Ethernet frames.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
22
7.1 ARP
Solution
Figure 7.7 shows the ARP request and
reply packets. Note that the ARP data
field in this case is 28 bytes, and that
the individual addresses do not fit in the
4-byte boundary.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
23
7.1 ARP
예제 1
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
24
7.1 ARP
예제 1(계속)
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
25
7.1 ARP
Proxy ARP
서브넷팅 효과를 만들기 위해 사용
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
26
7.2
ARP
PACKAGE
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
27
7.2 ARP 설계
구성 모듈
캐쉬 테이블
큐
출력 모듈
입력 모듈
캐쉬 제어 모듈
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
28
7.2 ARP 설계
ARP 컴포넌트
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
29
7.2 ARP 설계
캐쉬 테이블
송신자가 같은 목적지에 여러 개의 IP 데이터그램을 보
낼때 매번 ARP 프로토콜을 사용하는 것은 비 효율적
호스트나 라우터가 IP 데이터그램에 해당되는 물리 주
소를 수신하면 캐쉬 테이블에 저장
그런 다음 같은 수신자로 보내지는 데이터그램에 사용
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
30
7.2 ARP 설계
 캐쉬 테이블의 엔트리 구성
 상태(State) : FREE, PENDING, RESOLVED
 하드웨어 유형(Hardware type) :
 하드웨어 길이(Hardware length) :
 프로토콜 길이(Protocol length) :
 인터페이스 번호(Interface number) :
 큐 번호(Queue number) :
 시도(Attempt) : ARP 요청 횟수
 타임아웃(Time-out) : 엔트리 수명
 하드웨어 주소(Hardware address) : 목적지 하드웨어 주소
 프로토콜 주소(Protocol address) : 목적지 IP 주소
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
31
7.2 ARP 설계
 출력 모듈
1. Sleep until an IP packet is received from IP software.
2. Check cache table for an entry corresponding to the destination of this IP
packet.
3. If(found)
1. If(the state is RESOLVED)
1. Extract the value of the hardware address from the entry.
2. Send the packet and the hardware address to data link layer.
3. Return.
2. If(the state is PENDING)
1. Enqueue the packet to the corresponding queue.
2. Return.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
32
7.2 ARP 설계
4. If(not found)
1. Create a cache entry with state set to PENDING and
ATTEMPTS set to 1.
2. Create a queue.
3. Enqueue the packet.
4. Send an ARP request.
5. Return.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
33
7.2 ARP 설계
 입력 모듈
1. Sleep until an ARP packer(request or reply) arrives.
2. Check the cache table to find an entry corresponding to this ARP packet.
3. If(found)
1. Update the entry.
1. While the queue is not empty
2. If(the state is PENDING)
1. Dequeue one packet.
2. Send the packet and the hardware address to data link
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
34
7.2 ARP 설계
4. If(not found)
1. Create an entry.
2. Add the entry to the table.
5. If(the packet is a request)
1. Send an ARP relay
6. Return.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
35
7.2 ARP 설계
 캐쉬 제어 모듈
1. Sleep until the periodic timer matures.
2. For every entry in the cache table
1. If(the state is FREE)
1. Continue.
2. If(the state is PENDING)
1. Increment the value of attempts by 1.
2. If(attempts greater than maximum)
1. Change the state to FREE.
2. Destroy the corresponding queue.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
36
7.2 ARP 설계
3. Else
1. Send an ARP request.
4. Continue.
3. If(the state is RESOLVED)
1. Decrement the value of time-out by the value of elagsed time.
2. If(time-out less than or equal to zero)
1. Change the state to FREE.
2. Destroy the corresponding queue
3. Return.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
37
7.2 ARP 설계
ARP 예
Original cache table
State Queue
Attempt
Time-out Protocol Addr.
900
Hardware Addr.
R
5
P
2
2
129.34.4.8
P
14
5
201.11.56.7
R
8
P
12
450
1
180.3.6.1
114.5.7.89
ACAE32457342
457342ACAE32
220.55.5.7
F
R
9
P
18
60
3
Http://netwk.hannam.ac.kr
19.1.7.82
4573E3242ACA
188.11.8.71
HANNAM UNIVERSITY
38
7.2 ARP 설계
Example 2
The ARP output module receives an IP datagram (from
the IP layer) with the destination address 114.5.7.89. It
checks the cache table and finds that an entry exists for
this destination with the RESOLVED state (R in the
table). It extracts the hardware address, which is
457342ACAE32, and sends the packet and the address to
the data link layer for transmission. The cache table
remains the same.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
39
7.2 ARP 설계
Example 3
Twenty seconds later, the ARP output module receives an
IP datagram (from the IP layer) with the destination
address 116.1.7.22. It checks the cache table and does not
find this destination in the table. The module adds an
entry to the table with the state PENDING and the
Attempt value 1. It creates a new queue for this
destination and enqueues the packet. It then sends an ARP
request to the data link layer for this destination.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
40
7.2 ARP 설계
예제 3의 캐쉬 테이블
State Queue Attempt
Time-out
Hardware Addr.
180.3.6.1
ACAE32457342
R
5
P
2
2
129.34.4.8
P
14
5
201.11.56.7
R
8
P
12
1
220.55.5.7
P
23
1
116.1.7.22
R
9
P
18
Http://netwk.hannam.ac.kr
900
Protocol Addr.
450
60
3
114.5.7.89
19.1.7.82
457342ACAE32
4573E3242ACA
188.11.8.71
HANNAM UNIVERSITY
41
7.2 ARP 설계
Example 4
Fifteen seconds later, the ARP input module receives an
ARP packet with target protocol (IP) address 188.11.8.71.
The module checks the table and finds this address. It
changes the state of the entry to RESOLVED and sets the
time-out value to 900. The module then adds the target
hardware address (E34573242ACA) to the entry. Now it
accesses queue 18 and sends all the packets in this queue,
one by one, to the data link layer.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
42
7.2 ARP 설계
예제 4의 캐쉬 테이블
State Queue Attempt Time-out
Protocol Addr.
Hardware Addr.
R
5
180.3.6.1
ACAE32457342
P
2
2
129.34.4.8
P
14
5
201.11.56.7
R
8
P
12
1
220.55.5.7
P
23
1
116.1.7.22
R
9
R
18
Http://netwk.hannam.ac.kr
900
450
60
114.5.7.89
457342ACAE32
19.1.7.82
4573E3242ACA
188.11.8.71
E34573242ACA
HANNAM UNIVERSITY
43
7.2 ARP 설계
Example 5
Twenty-five seconds later, the cache-control module updates every
entry. The time-out values for the first three resolved entries are
decremented by 60. The time-out value for the last resolved entry is
decremented by 25. The state of the next-to-the last entry is
changed to FREE because the time-out is zero. For each of the
three entries, the value of the attempts field is incremented by one.
After incrementing, the attempts value for one entry (the one with
IP protocol address 201.11.56.7) is more than the maximum; the
state is changed to FREE, the queue is deleted.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
44
7.2 ARP 설계
예제 5의 캐쉬 테이블
State Queue
R
5
P
2
Attempt Time-out
840
3
Protocol Addr.
Hardware Addr.
180.3.6.1
ACAE32457342
129.34.4.8
F
R
8
390
114.5.7.89
P
12
2
220.55.5.7
P
23
2
116.1.7.22
457342ACAE32
F
R
18
Http://netwk.hannam.ac.kr
874
188.11.8.71
E34573242ACA
HANNAM UNIVERSITY
45
7.3
RARP
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
46
7.3 RARP
물리 주소는 알고 있으나 논리 주소를 모를 때 사용
물리 주소는 NIC로 부터 얻어진다
디스크가 없는 시스템 부팅시 이용
요청 장치는 RARP 클라이언트 프로그램 수행
응답 장치는 RARP 서버 프로그램 수행
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
47
7.3 RARP
RARP 동작
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
48
7.3 RARP
The RARP request packets are
broadcast;
the RARP reply packets are
unicast.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
49
7.3 RARP
RARP 패킷
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
50
7.3 RARP
RARP 패킷의 캡슐화
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
51
7.3 RARP
Alternative Solutions to RARP
When a diskless computer is booted, it needs more
information in addition to its IP address. It needs to
know its subnet mask, the IP address of a router, and the
IP address of a name server. RARP cannot provide this
extra information. New protocols have been developed
to provide this information. In Chapter 17 we discuss
two protocols, BOOTP and DHCP, that can be used
instead of RARP.
Http://netwk.hannam.ac.kr
HANNAM UNIVERSITY
52