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-h(huán)op router using the next-h(huán)op 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-h(huán)op router.
    在過去幾年中,寫得最多的網(wǎng)絡(luò)題目之一就是IP。但是,即使引起了這么多的注意,仍很少有(如果有的話)文章介紹此協(xié)議的基本工作原理,即路由器和第三層交換器是如何對IP信息起作用,以便在整個(gè)網(wǎng)絡(luò)中傳遞以太網(wǎng)包的。
    作為參考,請記住,IP是TCP/IP整套協(xié)議中的一個(gè)協(xié)議。
    TCP完成開放系統(tǒng)互連(OSI)模型中傳輸層,即第四層的功能。它的主要責(zé)任是確保端至端之間的可靠連接。IP位于下一層,在OSI的網(wǎng)絡(luò)層,即第三層,把每個(gè)包的發(fā)送者和接收者地址告訴一路上各個(gè)路由器。路由器和第三層交換器可以讀出IP和其他的第三層協(xié)議。這些信息與路由表以及其他網(wǎng)絡(luò)智能結(jié)合在一起,能通過TCP/IP在整個(gè)房間或圍繞地球進(jìn)行傳遞。
    路由過程始于對發(fā)送端站而言是的一個(gè)IP地址,端站可以被分配永久的IP地址,或者按需要從動(dòng)態(tài)主機(jī)配置協(xié)議(DHCP)服務(wù)器或其他服務(wù)中借用。