1. 程式人生 > >Cisco Packet Tracer 靜態路由配置

Cisco Packet Tracer 靜態路由配置

5.0 sha ext ecc 路由 protocol sta trac pack

一、拓撲圖

技術分享圖片

二、配置PC、路由器

PC0:

技術分享圖片

PC1:

技術分享圖片

route0:

Router>en
Router#conf t
Router(config)#hostname route0
route0(config)#int f0/0
route0(config-if)#ip ad 192.168.10.1 255.255.255.0
route0(config-if)#no sh
route0(config)#int s2/0
route0(config-if)#ip ad 192.168.20.1 255.255.255.0
route0(config-if)#no sh

route0(config)#int s2/0
route0(config-if)#clock rate 64000
因為路由器是背對背連接的,所以把兩個背對背連接的串口其中一個設置為DCE

route1:

Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname route1
route1(config)#int s2/0
route1(config-if)#ip ad 192.168.20.2 255.255.255.0
route1(config-if)#no sh

%LINK-5-CHANGED: Interface Serial2/0, changed state to up

route1(config-if)#int s3/0
route1(config-if)#ip ad 192.168.30.1 255.255.255.0
route1(config-if)#no sh

%LINK-5-CHANGED: Interface Serial3/0, changed state to down


route2:

Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname route2
route2(config)#int s3/0

route2(config-if)#ip ad 192.168.30.2 255.255.255.0
route2(config-if)#no sh

%LINK-5-CHANGED: Interface Serial3/0, changed state to up

route2(config-if)#int f0/0
route2(config-if)#ip ad 192.168.40.1 255.255.255.0
route2(config-if)#no sh

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up


配置route0靜態路由:

route0自己的網絡192.168.10.0和192.168.20.0(直接相連),所以route0的路由表必須加入192.168.30.0和192.168.40.0的信息,註意下一跳接口(數據包經過的下一個接口),配置如下:
route0(config-if)#exit
route0(config)#ip route 192.168.30.0 255.255.255.0 192.168.20.2
說的通俗點就是要去192.168.30.0網絡就要去找192.168.20.2接口發送數據包
route0(config)#ip route 192.168.40.0 255.255.255.0 192.168.20.2
要去192.168.40.0網絡就要去找192.168.20.2接口發送數據包

配置route1靜態路由:

route1要學習到的網絡應該是192.168.10.0和192.168.40.0,配置如下:
route1(config-if)#exit
route1(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1
要去192.168.10.0這個網段的網絡就要去找192.168.20.1接口發送數據包
route1(config)#ip route 192.168.40.0 255.255.255.0 192.168.30.2
要去192.168.40.0這個網段的網絡就要去找192.168.30.2接口發送數據包

配置route2靜態路由:

route2要學習到的網絡應該是192.168.10.10和192.168.20.0,配置如下:
route2(config)#ip route 192.168.10.0 255.255.255.0 192.168.30.1
要去192.168.10.0這個網段的網絡就要去找192.168.30.1接口發送數據包
route2(config)#ip route 192.168.20.0 255.255.255.0 192.168.30.1
要去192.168.20.0這個網段的網絡就要去找192.168.30.1接口發送數據包

測試連接:

PC0 ping PC1
技術分享圖片
可以ping通說明網絡沒問題。

路由信息:

route0#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.10.0/24 is directly connected, FastEthernet0/0
C 192.168.20.0/24 is directly connected, Serial2/0
S 192.168.30.0/24 [1/0] via 192.168.20.2
S 192.168.40.0/24 [1/0] via 192.168.20.2
上面輸出中S代表靜態路由,C代表直接相連,[1/0]分布為管理距離和度,via代表下一跳。

Cisco Packet Tracer 靜態路由配置