CCNA 配置試驗之一 靜態路由

靜態路由的應用場合
           一個小型到中型的網絡,而且沒有或只有較小的擴充計劃時。
           靜態路由要手工輸入,手工管理;管理開銷對於動態路由來說是一個大大的負擔。
靜態路由優缺點
           優點:
             1.對路由器CPU沒有管理性開銷
             2.在路由器間沒有帶寬佔用
             3.增加安全性
           缺點:
             1.必須真正瞭解網絡
             2.對於新添網絡配置繁瑣
             3.對於大型網絡工作量巨大
靜態路由的配置
Router(config)#ip route network  [mask] {address interface}[distance] [permanent]
Routerconfig#ip route 目標網段 目標網段的網絡掩碼 直連鄰居的接口IP地址
(直連鄰居的接口IP地址=下一跳的IP地址=網關)
 
下面我們通過試驗來驗證靜態路由的配置
CCNA試驗我使用的是模擬器
試驗環境如下:
試驗環境說明:
R1ip地址爲 192.168.1.1S0/0 網絡掩碼爲255.255.255.0
R2ip地址爲 192.168.1.2(S0/0)  192.168.2.1(S0/1) 網絡掩碼爲255.255.255.0
R3ip地址爲 192.168.2.2 (S0/1)  192.168.3.1S0/2) 網絡掩碼爲255.255.255.0
R4ip地址爲 192.168.3.2(S0/2) 網絡掩碼爲255.255.255.0
R1S0/0端口、R2S0/1端口、R3S0/2端口爲DCE
試驗要求:
要求在路由器間配置靜態路由使路由器間相互ping通。實現全網全通。
好了,開始工作
R1
en
conf  t
host r1                                    定義路由器名稱
enable password cisco                        定義特權口令
line vty 0 4                                 定義telne口令
pass cisco      
login
exit
int s0/0                                     定義接口信息
ip addr 192.168.1.1 255.255.255.0
clock rate 64000                              設置時鐘頻率
no shut
exit 
ip route 192.168.2.0 255.255.255.0 192.168.1.2     R1中配置靜態路由
ip route 192.168.3.0 255.255.255.0 192.168.1.2
 
 
R2
en
conf  t
host r2                                    定義路由器名稱
enable password cisco                        定義特權口令
line vty 0 4                                 定義telne口令
pass cisco      
login
exit
int s0/0                                     定義接口信息
ip addr 192.168.1.2 255.255.255.0
no shut
exit
int s0/1
ip addr 192.168.2.1 255.255.255.0
clock rate 64000                              設置時鐘頻率
no shut
exit 
ip route 192.168.3.0 255.255.255.0 192.168.2.2      R2 中配置靜態路由
 
 
R3
en
conf  t
host r3                                     定義路由器名稱
enable password cisco                         定義特權口令
line vty 0 4                                  定義 telne 口令
pass cisco      
login
exit
int s0/1                                      定義接口信息
ip addr 192.168.2.2 255.255.255.0
no shut
exit
int s0/2
ip addr 192.168.3.1 255.255.255.0
clock rate 64000                               設置時鐘頻率
no shut
exit 
ip route 192.168.1.0 255.255.255.0 192.168.2.1      R3 中配置靜態路由
 
R4
 
en
conf  t
host r4                                     定義路由器名稱
enable password cisco                         定義特權口令
line vty 0 4                                  定義 telne 口令
pass cisco      
login
exit
int s0/2                                      定義接口信息
ip addr 192.168.3.2 255.255.255.0
no shut
exit
ip route 192.168.1.0 255.255.255.0 192.168.3.1      R4 中配置靜態路由
ip route 192.168.2.0 255.255.255.0 192.168.3.1
R1 ping R2 R3 R4   如下圖所示,全網全通啦
 
如下是在路由器 R1  R2  R3  R4  裏做出的配置   紅色字體爲配置內容
R1
Router>en
Router#conf  t
Enter configuration commands, .e per line.  End with CNTL/Z.
Router(config)#host r1
r1(config)#enable password cisco
r1(config)#line vty 0 4
r1(config-line)#pass cisco
r1(config-line)#login
r1(config-line)#exit
r1(config)#int s0/0
r1(config-if)#ip addr 192.168.1.1 255.255.255.0
r1(config-if)#clock rate 64000
r1(config-if)#no shut
r1(config-if)#exit
*Mar  1 00:05:14.311: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:05:15.311: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/0,
 changed state to up
r1(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
r1(config)#
*Mar  1 00:05:43.055: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/0,
 changed state to down
r1(config)#ip route 192.168.3.0 255.255.255.0 192.168.1.2
 
R2
 
Router>en
Router#conf t
Enter configuration commands, .e per line.  End with CNTL/Z.
Router(config)#host r2
r2(config)#enable password cisco
r2(config)#line vty 0 4
r2(config-line)#pass cisco
r2(config-line)#login
r2(config-line)#exit
r2(config)#int s0/0
r2(config-if)#ip addr 192.168.1.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#
*Mar  1 00:05:21.035: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:05:22.035: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/0,
 changed state to upexit
r2(config)#int s0/1
r2(config-if)#ip addr 192.168.2.1 255.255.255.0
r2(config-if)#clock rate 64000
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#
*Mar  1 00:25:35.283: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
 changed state to down%LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
*Mar  1 00:25:45.267: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
 changed state to up: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
 changed state to down
r2(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
 
 
R3 
 
Router>en
Router#conf t
Enter configuration commands, .e per line.  End with CNTL/Z.
Router(config)#host r3
r3(config)#enable password cisco
r3(config)#line vty 0 4
r3(config-line)#password cisco
r3(config-line)#login
r3(config-line)#exit
r3(config)#int s0/1
r3(config-if)#ip addr 192.168.2.2 255.255.255.0
r3(config-if)#no shut
r3(config-if)#exit
r3(config)#
*Mar  1 00:03:39.899: %LINK-3-UPDOWN: Interface Serial0/1, changed state to upi
*Mar  1 00:03:40.903: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/1,
 changed state to u
r3(config)#int s0/2
r3(config-if)#ip addr 192.168.3.1 255.255.255.0
r3(config-if)#clock rate 64000
r3(config-if)#no shut
r3(config-if)#
*Mar  1 00:04:24.839: %LINK-3-UPDOWN: Interface Serial0/2, changed state to up
*Mar  1 00:04:25.839: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/2,
 changed state to up
*Mar  1 00:04:53.839: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/2,
 changed state to down
r3(config-if)#exit
r3(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
 
 
.
R4
 
Router>en
Router#conf t
Enter configuration commands, .e per line.  End with CNTL/Z.
Router(config)#host r4
r4(config)#enable pass cisco
r4(config)#line vty 0 4
r4(config-line)#pass cisco
r4(config-line)#login
r4(config-line)#exit
r4(config)#int s0/2
r4(config-if)#ip addr 192.168.3.2 255.255.255.0
r4(config-if)#no shut
r4(config-if)#
*Mar  1 00:03:04.871: %LINK-3-UPDOWN: Interface Serial0/2, changed state to up
*Mar  1 00:03:05.871: %LINEPROTO-5-UPDOWN: Line protocol . Interface Serial0/2,
 changed state to up
r4(config-if)#exit
r4(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
r4(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
 
下面是在 R1 上分別 ping R2  R3  R4  的結果,
 
r1>ping 192.168.1.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/298/540 ms
r1>ping 192.168.2.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 140/218/376 ms
r1>ping 192.168.2.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 304/447/644 ms
r1>ping 192.168.3.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 140/460/804 ms
r1>ping 192.168.3.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 664/739/936 ms
哈哈   全網全通了!試驗宣告成功!!!!!
 
附:靜態路由的刪除:
(config)#no ip route 目標網段 目標網段的網絡掩碼 直連鄰居的接口IP地址









本文轉自 範琳琳 51CTO博客,原文鏈接:http://blog.51cto.com/fanlinlin/132177,如需轉載請自行聯繫原作者