实验目的

通过本次试验,可以掌握如下技能:

1.DCE端时钟设置

2.路由表的概念

3.ip router命令使用

4.根据需求正确配置将台路由

 实验拓扑

 

静态路由_第1张图片

实验步骤

我们要使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

静态路由_第2张图片

在PC1上ping PC0地址 192.168.1.1

静态路由_第3张图片

实验总结

1.在写静态路由时,如果是点对点链路(如PPP封装的链路)采用网关地址和接口都是可以的

2.注意:如果是链路多路访问链路(如以太网)只可采用网关地址,即不能用

R2(config)#ip route 192.168.1.0 255.255.255.0 Serial0/3/0