欢迎光临散文网 会员登陆 & 注册

路由与交换技术

2023-03-30 19:41 作者:沐笙--ms  | 我要投稿


路由器静态路由配置

一、 实验目的

1. 理解路由表

2. 掌握静态路由的配置

二、 应用环境

1. 在小规模环境里,静态路由是最佳的选择

2. 静态路由开销小,但不灵活,适用于相对稳定的网络

三、 实验设备

1. DCR-1751 三台

2. CR-V35FC 一条

3. CR-V35MT 一条

四、 实验拓扑

 

    

五、 实验要求

配置表


六、 实验步骤

第一步:添加相对应的模块:NM-4A/S参照实验三,按照上表配置所有接口的IP 地址,保证所有接口全部是up 状态,测试连通性。

Router-A配置:

Router>enable

Router#config

Configuring from terminal, memory, or network [terminal]? t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#hostname Router-A                //设置路由器名称

Router-A(config)#interface f0/0

Router-A(config-if)#ip address 192.168.0.1 255.255.255.0

Router-A(config-if)#no shutdown

Router-A(config-if)#exit

Router-A(config)#interface s1/1

Router-A(config-if)#ip address 192.168.1.1 255.255.255.0

Router-A(config-if)#no shutdown

Router-A(config-if)#clock rate 64000             //在DCE端设置时钟频率为64000

Router-A(config-if)#exit

Router-A(config)#exit

Router-A#write

Building configuration...

[OK]

Router-A#

Router-B配置:

Router>enable

Router#config t

Router(config)#hostname Router-B

Router-B(config)#interface s1/0

Router-B(config-if)#ip address 192.168.1.2 255.255.255.0

Router-B(config-if)#no shutdown

Router-B(config-if)#exit

Router-B(config)#interface f0/0

Router-B(config-if)#ip ad 192.168.2.1 255.255.255.0

Router-B(config-if)#no shutdown

Router-B(config-if)#exit

Router-B(config)#exit

Router-B#write

Building configuration...

[OK]

Router-B#

Router-C配置:

Router>enable

Router#config t

Router(config)#hostname Router-C

Router-C(config)#interface f0/0

Router-C(config-if)#ip address 192.168.2.2 255.255.255.0

Router-C(config-if)#no shutdown

Router-C(config-if)#exit

Router-C(config)#interface f0/1

Router-C(config-if)#ip address 192.168.3.1 255.255.255.0

Router-C(config-if)#no shutdown

Router-C(config-if)#exit

Router-C(config)#exit

Router-C#write

Building configuration...

[OK]

Router-C#

第二步:查看ROUTER-A 的路由表

Router-A#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.0.0/24 is directly connected, FastEthernet0/0

C    192.168.1.0/24 is directly connected, Serial1/1

Router-A#

第三步:查看ROUTER-B 的路由表

Router-B#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.1.0/24 is directly connected, Serial1/0

C    192.168.2.0/24 is directly connected, FastEthernet0/0

Router-B#

第四步:查看ROUTER-C 的路由表

 

 

Router-C#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.2.0/24 is directly connected, FastEthernet0/0

C    192.168.3.0/24 is directly connected, FastEthernet0/1

Router-C#

第五步:在ROUTER-A 上PING 路由器C

Router-A#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:

.....                //ping 不通

Success rate is 0 percent (0/5)

第六步:在路由器A 上配置静态路由

Router-A(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2  //配置目标网段和下一跳

Router-A(config)#ip route 192.168.3.0 255.255.255.0 192.168.1.2  //配置目标网段和下一跳

第七步:查看Router-A的路由表

Router-A#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.0.0/24 is directly connected, FastEthernet0/0

C    192.168.1.0/24 is directly connected, Serial1/1

S    192.168.2.0/24 [1/0] via 192.168.1.2              //注意静态路由的管理距离是1

S    192.168.3.0/24 [1/0] via 192.168.1.2

Router-A#

第八步:配置路由器B 的静态路由并查看路由表

 

 

Router-B(config)#ip route 192.168.0.0 255.255.255.0 192.168.1.1

Router-B(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2

Router-B(config)#exit

Router-B#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

 

S    192.168.0.0/24 [1/0] via 192.168.1.1

C    192.168.1.0/24 is directly connected, Serial1/0

C    192.168.2.0/24 is directly connected, FastEthernet0/0

S    192.168.3.0/24 [1/0] via 192.168.2.2

Router-B#

第九步:配置路由器C 的静态路由并查看路由表

Router-C(config)#ip route 192.168.0.0 255.255.255.0 192.168.2.1

Router-C(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

Router-C(config)#exit

Router-C#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

 

S    192.168.0.0/24 [1/0] via 192.168.2.1

S    192.168.1.0/24 [1/0] via 192.168.2.1

C    192.168.2.0/24 is directly connected, FastEthernet0/0

C    192.168.3.0/24 is directly connected, FastEthernet0/1

Router-C#

 

第十步:测试

//路由器A   ping     路由器C要能通

Router-A#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 = 47/59/63 ms

 

Router-A#

//路由器C   ping     路由器A要能通

 

Router-C#ping 192.168.0.1

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms

 

Router-C#

最后用计算机PC1  ping  PC2看结果是否能通?


路由与交换技术的评论 (共 条)

分享到微博请遵守国家法律