18 · Configuring Static Routing設定靜態路由

Default Routes預設路由

Use a default route when the route from a source to a destination is not known or when it is not feasible for the router to maintain many routes in its routing table.

當來源到目的地的路由未知,或路由器不適合在路由表中維護大量路由時,就使用預設路由。

A default static route is a route that matches the destination address of all packets that don’t match any other more specific routes in the routing table. Default static routes are used in these instances:

預設靜態路由是一種路由,用來比對路由表中所有不符合其他更精確路由的封包目的位址。預設靜態路由常用於下列情況:

  • When no other routes in the routing table match the destination IP address of the packet or when a more specific match does not exist. A common use for a default static route is to connect the edge router of a company to an ISP network.當路由表中沒有其他路由與封包的目的 IP 位址相符,或不存在更精確的比對時。預設靜態路由常見的用途,是將公司的邊界路由器連接到 ISP 網路。
  • When a router has only one other router to which it is connected. This condition is known as a stub router.當路由器只連接到另一台路由器時,這種情況稱為末端路由器(stub router)。

The syntax for a default static route is like the one that is used for any other static route, except that the network address is 0.0.0.0 and the subnet mask is 0.0.0.0.

預設靜態路由的語法與其他靜態路由相同,差別在於網路位址是 0.0.0.0,子網路遮罩也是 0.0.0.0。

RouterB(config)# ip route 0.0.0.0 0.0.0.0 172.16.2.2

Or

或者

RouterB(config)# ip route 0.0.0.0 0.0.0.0 serial0/0/1

The 0.0.0.0 network address and 0.0.0.0 subnet mask are called a quad-zero route.

0.0.0.0 網路位址與 0.0.0.0 子網路遮罩合稱為四零(quad-zero)路由。

In the figure, router B is configured to forward to router A all packets for which there is no route for the destination network in the router B routing table.

圖中,路由器 B 已設定為:路由表中若沒有目的網路的路由,就將所有這類封包轉送給路由器 A。

This table lists the ip route command parameters for this example.

此表列出此範例中 ip route 指令的參數。

Command Parameters
指令參數
Description
說明
ip route
ip route
Identifies the static route
識別靜態路由
0.0.0.0
0.0.0.0
Matches all destination addresses that do not match any other route in the routing table
比對路由表中沒有其他路由相符的所有目的位址
0.0.0.0
0.0.0.0
Matches all subnet masks
比對所有子網路遮罩
172.16.2.2
172.16.2.2
IPv4 address of the next-hop router to be used as the default for packet forwarding
作為封包轉送預設值的下一跳路由器 IPv4 位址
What is a common use for a default static route?預設靜態路由常見的用途是什麼?