2007/6/2

TCP/IP是如何工作的(二)


TCP/IP是如何工作的(二)

If the destination IP address is local, the router searches an internal store of IP addresses and local-device Media Access Control(MAC)addresses. This store is known as the Address Resolution Protocol(ARP)cache. ARP is the universal tool for matching IP addresses to MAC addresses. If the destination\''s MAC address appears, the router installs that MAC address in the packet header(removing its own MAC address because that\''s no longer needed)and sends the packet to the destination end station.

  In the event that the destination MAC address does not appear in the ARP cache ―it might have timed out, for instance― the router must broadcast an ARP request to the subnet referenced by the packet\''s destination IP address. The end station with that IP address responds, sending back its MAC address .The router updates its cache, installs the new MAC address into the packet header and launches the packet.

   If the route table lookup shows that the packet is destined for a non-local subnet, the router forwards the packet to the next-hop router using the next-hop router\''s MAC address. Routing tables are continuously built and rebuilt by intelligent discovery protocols, such as Routing Information Protocol or Open Shortest Path First(OSPF). Each router\''s routing table shows the best route to the destination address; for addresses that may be several hops away, it shows the best next-hop router.(the end)

  如果目的IP地址为本地的,该路由器就搜寻存储着IP地址和本地设备介质访问控制(MAC)地址的内部存储器,这个存储器叫作地址分辨协议(ARP) 高速缓存。ARP是把IP地址映射到MAC地址的通用工具。如果目的地的MAC地址出现了,该路由器就把这个MAC地址装进包的报头中(取掉自己的MAC 地址,因为不再需要它了),把该包送到目的端站。

  万一目的地的MAC地址没有出现在ARP高速缓存中(例如,有可能超时了),路由器必须向与包的目的IP地址有关的子网广播一个ARP请求,拥有此IP地址的端站就作出响应,把MAC地址发送回去,路由器因此更新高速缓存,把新的MAC地址装进包的报头并发送该包。

  如果查找路由表显示包的目的地不在本地子网,路由器就利用下一跳路由器的MAC地址把包转发给下一跳路由器。路由表由智能发现协议,如路由信息协议或者开放最短路径优先协议,不断地被建立和再建立。每个路由器的路由表显示了到达目的地址的最佳路径,对于要有几跳的地址,它显示出最佳的下一跳路由器。

标签:

0 条评论:

发表评论

订阅 博文评论 [Atom]

<< 主页