Routing is the process of selecting a path to forward data that originated from one network and is destined for a different network. Routers gather and maintain routing information to enable the transmission and receipt of such data packets.
路由是選擇路徑,將源自某個網路、目的地為另一個網路的資料轉送出去的程序。路由器會收集並維護路由資訊,以便傳送與接收這類資料封包。
Conceptually, routing information takes the form of entries in a routing table, with one entry for each identified route. You can manually configure the entries in the routing table or the router can use a routing protocol to create and maintain the routing table dynamically to accommodate network changes when they occur.
概念上,路由資訊會以路由表中的項目呈現,每條已識別的路由對應一筆項目。你可以手動設定路由表中的項目,或者由路由器使用路由協定,在網路發生變化時動態建立並維護路由表。
The router relies on the routing table when deciding which interfaces to use when forwarding packets. The figure shows that R2 uses the GigabitEthernet 0/0 interface to get to the 172.16.1.0/24 subnet. In the routing table of R2, the 172.16.1.0/24 network is known because it is directly connected. The route source is the method in which the router learns the subnet.
路由器在決定要用哪個介面轉送封包時,會依賴路由表。圖中顯示 R2 使用 GigabitEthernet 0/0 介面連往 172.16.1.0/24 子網路。在 R2 的路由表中,172.16.1.0/24 網路是已知的,因為它是直接連接的。路由來源就是路由器學得該子網路的方式。
There are three major types of sources:
路由來源主要有三種類型:
- Routers can learn the directly connected network based on the IP address and subnet mask configured on the local interface.路由器可以根據本機介面上設定的 IP 位址與子網路遮罩,學到直接連接的網路。
- You can manually configure network information also known as a static route.你也可以手動設定網路資訊,這就是所謂的靜態路由。
- Routers can dynamically learn destination network information by using a routing protocol enabled on the router.路由器可以透過在路由器上啟用的路由協定,動態學到目的網路資訊。
If the destination network is directly connected, the router already knows which interface to use when forwarding packets. If destination networks are not directly connected, the router must learn which route to use when forwarding packets.
若目的網路是直接連接的,路由器已經知道要使用哪個介面轉送封包。若目的網路不是直接連接的,路由器就必須學習轉送封包時要使用哪條路由。
In general, all routers should know all network subnets. But the route source and exit interface vary based on the router's topology position.
一般而言,所有路由器都應該知道所有網路子網路,但路由來源與出口介面會因路由器在拓樸中的位置而不同。
