實驗目的
通過本次試驗,可以掌握如下技能:
1.DCE端時鐘設置
2.路由表的概念
3.ip router命令使用
4.根據需求正確配置將臺路由
實驗拓撲
實驗步驟
我們要使PC0跟PC1網絡能夠相互通信,按如下所述操作。
步驟1:在各個路由器上配置IP地址,保證直連鏈路的連通性
R0設置ip地址
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R0
R0(config)#interface f0/0
R0(config-if)#ip add 192.168.1.1 255.255.255.0
R0(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
R0(config-if)#exit
R0(config)#interface serial 0/1/0
R0(config-if)#ip add 10.1.0.1 255.255.255.0
R0(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to down
R0(config-if)#end
R0#show controllers serial0/1/0 (查看DCE端命令)
Interface Serial0/1/0
Hardware is PowerQUICC MPC860
DCE V.35, TX and RX clocks detected (紅色表示爲DCE端)
idb at 0x81081AC4, driver data structure at 0x81084AC0
SCC Registers:
General [GSMR]=0x2:0x00000000, Protocol-specific [PSMR]=0x8
Events [SCCE]=0x0000, Mask [SCCM]=0x0000, Status [SCCS]=0x00
Transmit on Demand [TODR]=0x0, Data Sync [DSR]=0x7E7E
Interrupt Registers:
......
R0(config)#interface serial 0/1/0
R0(config-if)#clock rate 4800 (在DCE端配置時鐘)
R1配置如下
R1(config)#interface serial 0/1/0
R1(config-if)#ip add 10.1.0.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface serial 0/1/1
R1(config-if)#ip add 10.2.0.1 255.255.255.0
R1(config-if)#no shutdown
R2配置如下
R2(config)#interface serial 0/1/1
R2(config-if)#ip add 10.2.0.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface serial 0/1/0
R2(config-if)#clock rate 4800
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#no shutdown
步驟2:在R0路由器上配置靜態路由
R0(config)#ip route 10.2.0.0 255.255.255.0 10.1.0.2
(這裏是指R0路由器訪問10.2.0.0網段,下一跳IP地址是10.1.0.2)
R0(config)#ip route 192.168.2.0 255.255.255.0 Serial0/1/0
(這裏是指R0路由器訪問 192.168.2.0網段,下一跳接口是R0的Serial0/1/0)
步驟3:R1上配置靜態路由
R1(config)#ip route 192.168.1.0 255.255.255.0 10.1.0.1
R1(config)#ip route 192.168.2.0 255.255.255.0 10.2.0.2
步驟4:R2上配置靜態路由
R2(config)#ip route 10.1.0.0 255.255.255.0 10.2.0.1
R2(config)#ip route 192.168.1.0 255.255.255.0 Serial0/3/0
試驗調試
在R2上查看路由表
R2#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
10.0.0.0/24 is subnetted, 2 subnets
S 10.1.0.0 [1/0] via 10.2.0.1 (S表示靜態路由,C表示直連網絡)
C 10.2.0.0 is directly connected, Serial0/3/0
S 192.168.1.0/24 is directly connected, Serial0/3/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
在R1上查看路由表
R1#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
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.0.0 is directly connected, Serial0/1/0
C 10.2.0.0 is directly connected, Serial0/1/1
S 192.168.1.0/24 [1/0] via 10.1.0.1
S 192.168.2.0/24 [1/0] via 10.2.0.2
在R0上查看路由表
R0#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
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.0.0 is directly connected, Serial0/1/0
S 10.2.0.0 [1/0] via 10.1.0.2
C 192.168.1.0/24 is directly connected, FastEthernet0/0
S 192.168.2.0/24 is directly connected, Serial0/1/0
從PC0上pingPC1地址192.168.2.2
在PC1上ping PC0地址 192.168.1.1
實驗總結
1.在寫靜態路由時,如果是點對點鏈路(如PPP封裝的鏈路)採用網關地址和接口都是可以的
2.注意:如果是鏈路多路訪問鏈路(如以太網)只可採用網關地址,即不能用
R2(config)#ip route 192.168.1.0 255.255.255.0 Serial0/3/0