網路規劃與管理技術第 七章 路由規劃與設定 上一頁    下一頁

7-3 靜態繞路設定

內容:

  • 7-3-1 僅設定預設閘門

  • 7-3-2 靜態路由表設定

7-3-1 僅設定預設閘門

(A) 預設閘門規劃

(請匯入自治系統網路()_介面設定.pkt實作演練)

 

7-5 自治系統網路()_介面設定

預設閘門是指:『不在路由表內網路位址,皆轉送的下一個埠口位址』。從 7-2-3 節得到結果是:僅設定路由表介面後,當封包進入路由器,它由 IP 封包標頭得知目的位址,如果是本路由器介面的 IP 位址,則轉送該埠口上,如果都不是的話,便將它拋棄。接下來,我們來驗證如果設定預設閘門是否可以順利轉送封包,吾人規劃各路由器的預設閘門如下:

Router

Default Route

備註

R1

192.168.100.2

往外部網路方向傳送

R2

192.168.101.2

往外部網路方向傳送

R3

192.168.102.2

往外部網路方向傳送

R4

202.168.1.2

往外部網路方向傳送

R_R5

202.168.1.1

內部網路方向傳送

(B) 預設閘門設定

R1 預設閘門設定

R1#config ter

R1(config)#ip routing

R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.100.2

R1(config)#do show ip route

Gateway of last resort is 192.168.100.2 to network 0.0.0.0

 

C 192.168.0.0/24 is directly connected, FastEthernet1/0

C 192.168.100.0/24 is directly connected, FastEthernet0/1

S* 0.0.0.0/0 [1/0] via 192.168.100.2

R2 預設閘門設定

R2#config ter

R2(config)#ip routing

R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.101.2

R3 預設閘門設定

R3#config ter

R3(config)#ip routing

R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.102.2

R4 預設閘門設定

R4#config ter

R4(config)#ip routing

R4(config)#ip route 0.0.0.0 0.0.0.0 202.168.1.2

R_R5 預設閘門設定

R_R51#config ter

R_R5(config)#ip routing

R_R5(config)#ip route 0.0.0.0 0.0.0.0 202.168.1.1

(C) 測試連線:(完成後檔案:自治系統網路()預設閘門.pkt)

PC1 測試(192.168.0.1)

C:\>ping 192.168.100.1      [OK]

C:\>ping 192.168.100.2      [NO]

PC2 測試(192.168.1.1)

C:\>ping 192.168.100.2      [OK]

C:\>ping 192.168.101.1      [OK]

C:\>ping 192.168.101.2      [NO]

PC4 測試(192.168.3.1)

C:\>ping 192.168.102.2      [OK]

C:\>ping 192.168.2.254      [NO]

C:\>ping 202.168.1.1        [OK]

C:\>ping 202.168.1.2        [OK]

C:\>ping 120.118.166.254    [OK]

C:\>ping 120.118.166.1      [OK]

R_PC1 測試(120.118.166.1)

C:\>ping 120.118.166.254    [OK]

C:\>ping 202.168.1.2        [OK]

C:\>ping 202.168.1.1        [OK]

C:\>ping 192.168.3.1        [OK]

C:\>ping 192.168.102.2      [OK]

C:\>ping 192.168.102.1      [OK]

C:\>ping 192.168.2.254      [NO]

C:\>ping 192.168.101.2      [NO]

結果討論:

吾人僅設定預設閘門,對某些路由還是無法完全達成。

7-3-2 靜態路由表設定

(A) 路由表規劃

(請匯入『自治系統網路()_介面設定.pkg』再實際演練)

 

7-5 自治系統網路()介面設定

靜態路由表的規劃要領是:『由本路由器出去,要到某一個網路區段的下一個路由器埠口位址』。譬如,由 R1 出去,要到 192.168.0.1 網路區段的下個路由器(R2) 埠口,它的 IP 位址(192.168.100.2)。另外,預設路由是指:『不在路由表內網路位址,皆轉送的下一個埠口位址』。我們依照圖 7-14 自治系統網路()規劃靜態路由表如下:

Router

Destination AD

Network Mask

Net Hop

R1

192.168.1.0

255.255.255.0

192.168.100.2

192.168.2.0

255.255.255.0

192.168.100.2

192.168.3.0

255.255.255.0

192.168.100.2

0.0.0.0

0.0.0.0

192.168.100.2

R2

192.168.0.0

255.255.255.0

192.168.100.1

192.168.2.0

255.255.255.0

192.168.101.2

192.168.3.0

255.255.255.0

192.168.101.2

0.0.0.0

0.0.0.0

192.168.101.2

R3

192.168.0.0

255.255.255.0

192.168.101.1

192.168.1.0

255.255.255.0

192.168.101.1

192.168.3.0

255.255.255.0

192.168.102.2

0.0.0.0

0.0.0.0

192.168.102.2

R4

192.168.0.0

255.255.255.0

192.168.102.1

192.168.1.0

255.255.255.0

192.168.102.1

192.168.2.0

255.255.255.0

192.168.102.1

0.0.0.0

0.0.0.0

202.168.1.2

R_R5

0.0.0.0

0.0.0.0

202.168.1.1

(B) 路由表設定

R1 設定靜態路由:

R1(config)#ip routing

R1(config)#ip route 192.168.1.0 255.255.255.0 192.168.100.2

R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.100.2

R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.100.2

R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.100.2

R1(config)#do show ip route

Gateway of last resort is 192.168.100.2 to network 0.0.0.0

 

C 192.168.0.0/24 is directly connected, FastEthernet1/0

S 192.168.1.0/24 [1/0] via 192.168.100.2

S 192.168.2.0/24 [1/0] via 192.168.100.2

S 192.168.3.0/24 [1/0] via 192.168.100.2

C 192.168.100.0/24 is directly connected, FastEthernet0/1

S* 0.0.0.0/0 [1/0] via 192.168.100.2

R2 設定靜態路由:

R2(config)#ip routing

R2(config)#ip route 192.168.0.0 255.255.255.0 192.168.100.1

R2(config)#ip route 192.168.2.0 255.255.255.0 192.168.101.2

R2(config)#ip route 192.168.3.0 255.255.255.0 192.168.101.2

R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.101.2

R2(config)#do show ip route

Gateway of last resort is 192.168.101.2 to network 0.0.0.0

 

S 192.168.0.0/24 [1/0] via 192.168.100.1

C 192.168.1.0/24 is directly connected, FastEthernet1/0

S 192.168.2.0/24 [1/0] via 192.168.101.2

S 192.168.3.0/24 [1/0] via 192.168.101.2

C 192.168.100.0/24 is directly connected, FastEthernet0/0

C 192.168.101.0/24 is directly connected, FastEthernet0/1

S* 0.0.0.0/0 [1/0] via 192.168.101.2

R3 設定靜態路由:

R3(config)#ip routing

R3(config)#ip route 192.168.0.0 255.255.255.0 192.168.101.1

R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.101.1

R3(config)#ip route 192.168.3.0 255.255.255.0 192.168.102.2

R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.102.2

R3(config)#do show ip route

Gateway of last resort is 192.168.102.2 to network 0.0.0.0

 

S 192.168.0.0/24 [1/0] via 192.168.101.1

S 192.168.1.0/24 [1/0] via 192.168.101.1

C 192.168.2.0/24 is directly connected, FastEthernet1/0

S 192.168.3.0/24 [1/0] via 192.168.102.2

C 192.168.101.0/24 is directly connected, FastEthernet0/0

C 192.168.102.0/24 is directly connected, FastEthernet0/1

S* 0.0.0.0/0 [1/0] via 192.168.102.2

R4 設定靜態路由:

R4(config)#ip routing

R4(config)#ip route 192.168.0.0 255.255.255.0 192.168.102.1

R4(config)#ip route 192.168.1.0 255.255.255.0 192.168.102.1

R4(config)#ip route 192.168.2.0 255.255.255.0 192.168.102.1

R4(config)#ip route 0.0.0.0 0.0.0.0 202.168.1.2

R4(config)#do show ip route

Gateway of last resort is 202.168.1.2 to network 0.0.0.0

 

S 192.168.0.0/24 [1/0] via 192.168.102.1

S 192.168.1.0/24 [1/0] via 192.168.102.1

S 192.168.2.0/24 [1/0] via 192.168.102.1

C 192.168.3.0/24 is directly connected, FastEthernet1/0

C 192.168.102.0/24 is directly connected, FastEthernet0/0

C 202.168.1.0/24 is directly connected, Serial0/2/0

S* 0.0.0.0/0 [1/0] via 202.168.1.2

R_R5 設定靜態路由:

R_R5(config)#ip routing

R_R5(config)#ip route 0.0.0.0 0.0.0.0 202.168.1.1

R_R5(config)#do show ip route

Gateway of last resort is 202.168.1.1 to network 0.0.0.0

 

120.0.0.0/24 is subnetted, 1 subnets

C 120.118.166.0 is directly connected, FastEthernet0/0

C 202.168.1.0/24 is directly connected, Serial0/2/0

S* 0.0.0.0/0 [1/0] via 202.168.1.1

(C) 路由器繞路測試

(完成後『自治系統網路()_靜態繞路設定.pkg)

PC1 (192.168.0.1) 繞路測試:

C:\>ping 192.168.1.1     [OK]

C:\>ping 192.168.2.1     [OK]

C:\>ping 192.168.3.1     [OK]

C:\>ping 120.118.166.1   [OK]

PC2 (192.168.1.1) 繞路測試:

C:\>ping 192.168.0.1     [OK]

C:\>ping 192.168.2.1     [OK]

C:\>ping 192.168.3.1     [OK]

C:\>ping 120.118.166.1   [OK]

PC3 (192.168.2.1) 繞路測試:(PC4 略過測試)

C:\>ping 192.168.0.1     [OK]

C:\>ping 192.168.1.1     [OK]

C:\>ping 192.168.3.1     [OK]

C:\>ping 120.118.166.1   [OK]

R_PC5 (120.118.166.1) 繞路測試:

C:\>ping 192.168.0.1     [OK]

C:\>ping 192.168.1.1     [OK]

C:\>ping 192.168.2.1     [OK]

C:\>ping 192.168.3.0     [OK]

 

翻轉工作室:粘添壽

 

網路規劃與管理技術:

 

 

翻轉電子書系列: