3. ディレクテッド ARP
ディレクテッド ARP は、通常の ARP パケットフォーマットを用い、[1] および [2] で定義された ARP 手順、ならびにそれらの手順を実装したルーターおよびホストと整合性を保つ。
3.1. ARP ヘルパーアドレス
ホストおよびルーターはルーティング情報を保持しており、それは論理的にルーティングテーブルとして構成される。各ルーティングテーブルエントリは、1 つ以上の宛先 IP アドレスを、次ホップ IP アドレスおよびパケットを次ホップ IP アドレスへ転送するために用いられる物理インターフェースに関連付ける。宛先 IP アドレスがローカル(つまりルーターの助けなしに到達可能)である場合、次ホップ IP アドレスは NULL(または、関連付けられた物理インターフェースの IP アドレスなどの論理的等価物)である。それ以外の場合、次ホップ IP アドレスは次ホップルーターのアドレスである。
ディレクテッド ARP 手順を実装するホストやルーターは、各ルーティングテーブルエントリに関連付けて ARP ヘルパーアドレスを保持する。ホストやルーターが次ホップ IP アドレスをそれに関連付けられたリンクレベルアドレスに解決する(あるいは次ホップ IP アドレスが NULL である場合は宛先 IP アドレスを解決する)ように設定されている場合、関連付けられた ARP ヘルパーアドレスは NULL である。それ以外の場合、ARP ヘルパーアドレスは、当該ルーティング情報(その次ホップアドレスが関連付けられた物理インターフェースと同じリンクレベルネットワーク上にあることを示していたもの)を提供したルーターの IP アドレスである。セクション 4 では、動的ルーティング手順による ARP ヘルパーアドレスの決定について詳細な例を示す。
3.2. アドレス解決手順
IP パケットを転送するため、ホストやルーターは、宛先 IP アドレス、場合によってはその他の要因(たとえばサービスタイプ)に基づいて最良に一致するエントリをルーティングテーブルから探索する。選択されたルーティングテーブルエントリには、次ホップルーターの IP アドレス(NULL の場合もある)、IP パケットを転送すべき物理インターフェース、ARP ヘルパーアドレス(NULL の場合もある)、およびその他の情報が含まれる。ルーティング機能は、次ホップ IP アドレス、物理インターフェース、および ARP ヘルパーアドレスをアドレス解決機能に渡す。アドレス解決機能は、次に次ホップ IP アドレス(次ホップ IP アドレスが NULL の場合は宛先 IP アドレス)をそれに関連付けられたリンクレベルアドレスに解決しなければならない。その後、IP パケット、パケットを転送すべきリンクレベルアドレス、およびパケットを転送すべきインターフェースが、当該物理インターフェースに関連付けられたリンクレベルドライバに渡される。リンクレベルドライバは、IP パケットを、関連付けられたリンクレベルアドレス宛ての 1 つ以上のリンクレベルフレーム(すなわち、フラグメント化を行う場合がある)にカプセル化し、適切な物理インターフェースを通じてフレームを転送する。実行される機能の詳細は、以下の C 疑似コードによって説明される。
これらの手順は、ルーティングとアドレス解決に対応する 2 つの関数 Route() と Resolve() として構成される。さらに、以下の低レベル関数も用いられる。
Get_Route(IP_Add,Other) returns a pointer to the routing table
entry with the destination field that best matches IP_Add. If no
matching entry is found, NULL is returned. Other information such
as Type of Service may be considered in selecting the best route.
Forward(Packet,Link_Level_Add,Phys_Int) fragments Packet (if
needed), and encapsulates Packet in one or more Link Level Frames
addressed to Link_Level_Add, and forwards the frame(s) through
interface, Phys_Int.
Look_Up_Add_Res_Table(IP_Add,Phys_Int) returns a pointer to the
link level address associated with IP_Add in the address
resolution table associated with interface, Phys_Int. If IP_Add
is not found in the address resolution table, NULL is returned.
Local_Add_Res(IP_Add,Phys_Int) returns a pointer to the Link Level
address associated with IP_Add, using address resolution
procedures associated with address, IP_Add, and interface,
Phys_Int. If address resolution is unsuccessful, NULL is
returned. Note that different address resolution procedures may
be used for different IP networks.
Receive_ARP_Response(IP_Add,Phys_Int) returns a pointer to an ARP
Response received through interface, Phys_Int, that resolves
IP_Add. If no ARP response is received, NULL is returned.
Dest_IP_Add(IP_Packet) returns the IP destination address from
IP_Packet.
Next_Hop(Entry) returns the IP address in the next-hop field of
(routing table) Entry.
Interface(Entry) returns the physical interface field of (routing
table) Entry.
ARP_Helper_Add(Entry) returns the IP address in the ARP Helper
Address field of (routing table) Entry.
ARP_Request(IP_Add) returns an ARP Request packet with IP_Add as
the Target IP address.
Source_Link_Level(ARP_Response) returns the link level address of
the sender of ARP_Response.
ROUTE(IP_Packet)
{
Entry = Get_Route(Dest_IP_Add(IP_Packet),Other(IP_Packet));
If (Entry == NULL) /* No matching entry in routing table */
Return; /* Discard IP_Packet */
else
{ /* Resolve next-hop IP address to link level address */
If (Next_Hop(Entry) != NULL) /* Route packet via next-hop router */
Next_IP = Next_Hop(Entry);
else /* Destination is local */
Next_IP = Dest_IP_Add(IP_Packet);
L_L_Add = Resolve(Next_IP,Interface(Entry),ARP_Helper_Add(Entry));
If (L_L_Add != NULL)
Forward(IP_Packet,L_L_Add,Interface(Entry));
else /* Couldn't resolve next-hop IP address */
Return; /* Discard IP_Packet */
Return;
}
}
Figure 1: C Pseudo-Code for the Routing function.
Resolve(IP_Add,Interface,ARP_Help_Add)
{
If ((L_L_Add = Look_Up_Add_Res_Table(IP_Add,Interface)) != NULL)
{ /* Found it in Address Resolution Table */
Return L_L_Add;
}
else
{
If (ARP_Help_Add == NULL)
{ /* Do local Address Resolution Procedure */
Return Local_Add_Res(IP_Add,Interface);
}
else /* ARP_Help_Add != NULL */
{
L_L_ARP_Help_Add = Look_Up_Add_Res_Table(ARP_Help_Add,Interface);
If (L_L_ARP_Help_Add == NULL)
/* Not in Address Resolution Table */
L_L_ARP_Help_Add = Local_Add_Res(ARP_Help_Add,Interface);
If (L_L_ARP_Help_Add == NULL) /* Can't Resolve ARP Helper Add */
Return NULL; /* Address Resolution Failed */
else
{ /* ARP for IP_Add */
Forward(ARP_Request(IP_Add),L_L_ARP_Help_Add,Interface);
ARP_Resp = Receive_ARP_Response(IP_Add,Interface);
If (ARP_Resp == NULL) /* No ARP Response (after persistence) */
Return NULL; /* Address Resolution Failed */
else
Return Source_Link_Level(ARP_Resp);
}
}
}
}
}
Figure 2: C Pseudo-Code for Address Resolution function.
3.3. ARP リクエストの転送
ディレクテッド ARP 手順を実装するホストは、受信した ARP リクエストを処理するために通常の手順を用いる。すなわち、ターゲット IP アドレスがそのホストのアドレスである場合、ホストは通常の手順を用いて ARP リクエストに応答する。ターゲット IP アドレスがホストのアドレスでない場合、ホストは ARP リクエストを黙って廃棄する。
ルーターが受信した ARP リクエストのターゲット IP アドレスがそのルーターのアドレスである場合、ルーターは通常の手順を用いて ARP リクエストに応答する。しかし、ターゲット IP アドレスがルーターのアドレスでない場合、ルーターは ARP リクエストを、受信したのと同じインターフェースを通じて、ルーターのルーティングテーブル内の ARP ヘルパーアドレスに対応するリンクレベルアドレス宛てに転送してもよい。ARP リクエストを処理する手順は、以下の C 疑似コードによって説明される。関数 Receive() はホストおよびルーターが従う手順を記述し、関数 Direct() はルーターが追加で従う手順を記述する。さらに、以下の低レベル関数も用いられる。
Is_Local_IP_Add(IP_Add,Phys_Int) returns TRUE if Phys_Int has been
assigned IP address, IP_Add. Otherwise, returns FALSE.
Do_ARP_Processing(ARP_Request,Interface) processes ARP_Request
using ARP procedures described in [2].
I_Am_Router returns TRUE if device is a router and False if device
is a host.
Target_IP(ARP_Request) returns the Target IP address from
ARP_Request.
Filter(ARP_Request,Phys_Int) returns TRUE if ARP_Request passes
filtering constraints, and FALSE if filtering constraints are not
passed. See section 3.4.
Forward(Packet,Link_Level_Add,Phys_Int) fragments Packet (if
needed), and encapsulates Packet in one or more Link Level Frames
addressed to Link_Level_Add, and forwards the frame(s) through
interface, Phys_Int.
Look_Up_Next_Hop_Route_Table(IP_Add) returns a pointer to the
routing table entry with the next-hop field that matches IP_Add.
If no matching entry is found, NULL is returned.
Look_Up_Dest_Route_Table(IP_Add) returns a pointer to the routing
table entry with the destination field that best matches IP_Add.
If no matching entry is found, NULL is returned.
Link_Level_ARP_Req_Add(IP_Add,Phys_Int) returns the link level
address to which an ARP Request to resolve IP_Add should be
forwarded. If ARP is not used to perform local address resolution
of IP_Add, NULL is returned.
Local_Add_Res(IP_Add,Phys_Int) returns a pointer to the Link Level
address associated with IP_Add, using address resolution
procedures associated with address, IP_Add, and interface,
Phys_Int. If address resolution is unsuccessful, NULL is
returned. Note that different address resolution procedures may
be used for different IP networks.
Next_Hop(Entry) returns the IP address in the next-hop field of
(routing table) Entry.
Interface(Entry) returns the physical interface field of (routing
table) Entry.
ARP_Helper_Add(Entry) returns the IP address in the ARP Helper
Address field of (routing table) Entry.
Source_Link_Level(ARP_Request) returns the link level address of
the sender of ARP_Request.
Receive(ARP_Request,Interface)
{
If (Is_Local_IP_Add(Target_IP(ARP_Request),Interface))
Do_ARP_Processing(ARP_Request,Interface);
else /* Not my IP Address */
If (I_Am_Router) /* Hosts don't Direct ARP Requests */
If (Filter(ARP_Request,Interface)) /* Passes Filter Test */
/* See Section 3.4 */
Direct(ARP_Request,Interface); /* Directed ARP Procedures */
Return;
}
Figure 3: C Pseudo-Code for Receiving ARP Requests.
Direct(ARP_Request,Phys_Int)
{
Entry = Look_Up_Next_Hop_Route_Table(Target_IP(ARP_Request));
If (Entry == NULL) /* Target_IP Address is not a next-hop */
{ /* in Routing Table */
Entry = Look_Up_Dest_Route_Table(Target_IP(ARP_Request));
If (Entry == NULL) /* Not a destination either */
Return; /* Discard ARP Request */
else
If (Next_Hop(Entry) != NULL) /* Not a next-hop and Not local */
Return; /* Discard ARP Request */
}
If (Interface(Entry) != Phys_Int)
/* Must be same physical interface */
Return; /* Discard ARP Request */
If (ARP_Helper_Add(Entry) != NULL)
{
L_L_ARP_Helper_Add = Resolve(ARP_Helper_Add(Entry),Phys_Int,NULL);
If (L_L_ARP_Helper_Add != NULL)
Forward(ARP_Request,L_L_ARP_Helper_Add,Phys_Int);
/* Forward ARP_Request to ARP Helper Address */
Return;
}
else /* Do local address resolution. */
{
L_L_ARP_Req_Add =
Link_Level_ARP_Req_Add(Target_IP(ARP_Request),Phys_Int);
If (L_L_ARP_Req_Add != NULL)
{ /* Local address resolution procedure is ARP. */
/* Forward ARP_Request. */
Forward(ARP_Request,L_L_ARP_Req_Add,Phys_Int);
Return;
}
else
{ /* Local address resolution procedure is not ARP. */
/* Do "published ARP" on behalf of Target IP Address */
Target_Link_Level =
Local_Add_Res(Target_IP(ARP_Request),Phys_Int);
If (Target_Link_Level != NULL) /* Resolved Address */
{
Forward(ARP_Response,Source_Link_Level(ARP_Request),Phys_Int);
}
Return;
}
}
}
Figure 4: C Pseudo_Code for Directing ARP Requests.
3.4. フィルタリング手順
ディレクテッド ARP 手順を実行するルーターは、ARP リクエストパケットの伝播をフィルタリングして、不正な動作をするルーターやホストによって引き起こされる可能性のある「ARP フラッド」の範囲を制限し、ルーティングプロトコルの不安定期間中や不適切な手動設定の結果として発生する可能性のある ARP ループを終結させなければならない。ARP リクエストパケットの伝播をフィルタリングする具体的な手順は、本ドキュメントの範囲外である。以下の手順は、十分であると考えられる実装の候補として示唆されるものである。他の手順の方が特定の実装に適している場合もある。
「ARP フラッド」の伝播を制御するため、ディレクテッド ARP 手順を実行するルーターは、短い時間間隔あたりに転送する同一の ARP リクエスト(すなわち、送信元 IP アドレスおよびターゲット IP アドレスが同じもの)の数を制限してもよい(たとえば 1 秒あたり 1 件の ARP リクエスト以下)。これは、ARP フラッドを防止するために [5] で示唆されている手順と整合する。
ARP リクエストパケットの転送は、ARP ループの可能性を生じさせる。ARP フラッドの範囲を制御する手順により一部の ARP ループは終結するが、ARP フラッドの制御に用いるタイマーよりもループを巡回するのに要する時間が長い場合は、追加の手順が必要となる。ルーターは、T 分あたり N 件を超える同一の ARP リクエストを転送することを拒否してもよい。ここで N および T は管理された数値である。T および N が、T/N 分がループを巡回するのに要する最大時間よりも大きくなるように選ばれれば、このようなフィルタはループを終結させる。場合によっては、ホストが同一の送信元 IP アドレス、ターゲット IP アドレスの組を持つ ARP リクエストを複数送信することがある(すなわち、N は 1 より大きくすべきである)。たとえば、最初の ARP リクエストが失われる可能性がある。しかし、ARP 応答を受信すれば、ホストは通常関連する情報を保存するため、その結果、数分程度の期間は同一の ARP リクエストを生成しない。したがって、T は、T/N が任意のループを巡回する時間よりも十分に大きくなるように十分に大きくとることができる。
一部の実装では、ルーターへの ARP リクエストの伝送に用いられるフレームのリンクレベル宛先アドレスが、そのルーターのディレクテッド ARP フィルタリング処理から利用可能である。ルーターが、受信した ARP リクエストの宛先であったリンクレベルアドレスと同じリンクレベルアドレスへ ARP リクエストを決して転送しないようにすれば、単純な ARP ループの重要なクラスの発生を防止できる。もちろん、上の段落で説明したような他の手順はすべてのループを停止させるものであり、一部のループの発生を防ぐフィルタが実装されたとしても、それらは必要である。
ホスト要件 [5] では、「IP 層とリンク層の間のパケット受信インターフェースには、着信パケットがリンクレベルブロードキャストアドレス宛てであったかどうかを示すフラグを含めなければならない(MUST)」と規定されている。ルーターが、リンクレベルブロードキャストアドレス宛てであった ARP リクエストを決して転送しないようにすれば、単純な ARP フラッドの重要なクラスを排除できる。