高级路由实验

高级路由实验

-----路由器静态路由和动态路由的配置

  • 实验目的
  1. 理解路由表
  2. 掌握静态路由和动态路由的配置
  3. 理解RIP和OSPF协议的工作过程

路由表是路由器中的一种数据结构,用于存储路由器所知道的网络地址与下一跳路由器的映射关系。它告诉路由器如何将数据包从源主机传输到目标主机。路由表中的每一项包含了目标网络的IP地址、子网掩码、下一跳路由器的IP地址或出接口等信息。当路由器收到一个数据包时,它会查找路由表,根据目标IP地址找到最匹配的路由项,然后转发数据包到下一跳路由器或者出接口。

静态路由和动态路由的配置:

静态路由:静态路由是由网络管理员手动配置的路由信息,不会自动学习或更新。在路由器上配置静态路由时,需要指定目标网络的IP地址、子网掩码以及下一跳路由器的IP地址或者出接口。静态路由的优点是配置简单,适用于小型网络或者对网络流量有较高控制要求的场景。

动态路由:动态路由是由路由器之间通过路由协议交换学习到的路由信息,能够自动适应网络拓扑的变化。常见的动态路由协议包括RIP、OSPF、EIGRP等。在配置动态路由时,需要在路由器上启用相应的路由协议,并且邻居路由器之间会交换路由信息,根据协议规则更新路由表。动态路由的优点是能够自适应网络拓扑变化,减少了管理员的配置工作量,适用于大型复杂网络环境。

RIP和OSPF协议的工作过程:

RIP协议(Routing Information Protocol):RIP是一种距离矢量路由协议,基于跳数(Hop Count)来衡量路径的优劣。RIP协议工作过程包括路由器之间周期性地交换路由更新信息,每个路由器维护一个路由表,并根据接收到的路由更新信息更新路由表。RIP协议中还包括毒化逆转和触发更新等机制,用于避免环路和快速传播路由变化。

OSPF协议(Open Shortest Path First):OSPF是一种链路状态路由协议,基于Dijkstra算法来计算最短路径。OSPF协议的工作过程包括路由器之间建立邻居关系、交换链路状态信息、计算最短路径并生成路由表。OSPF协议支持分层区域结构,能够减少路由器之间的路由更新负载,提高网络的可扩展性和稳定性。

  • 应用环境
  1. 在小规模环境里,静态路由是最佳的选择
  2. 静态路由开销小,但不灵活,使用于相对稳定的网络
  • 实验设备
  1. DCR路由器3台
  2. CR-V35FC 1条
  3. CR-V35MT 1条

四、实验拓扑

五、实验要求

配置表

|-----------|-------------|------------|-------------|------|-------------|
| Router-A || Router-B || Router-C ||
| S1/1(DCE) | 192.168.1.1 | S/1/0(DTE) | 192.168.1.2 | F0/0 | 192.168.2.2 |
| F0/0 | 192.168.0.1 | F0/0 | 192.168.2.1 | E1/0 | 192.168.3.1 |

六、实验步骤

(一)静态路由的配置

第一步:参照前面的实验方法,按照上表配置所有接口的IP地址,保证所有接口全部是up状态,测试连通性

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

Router-A#show ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1, OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

C 192.168.0.0/24 is directly connected,FastEthernet0/0 //直连的路由

C 192.168.1.0/24 is directly connected,Serial1/1 //直连的路由

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

Router-B#show ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1, OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

C 192.168.1.0/24 is directly connected,Serial1/0

C 192.168.2.0/24 is directly connected, FastEthernet0/0

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

Router-C#show ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1, OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

C 192.168.1.0/24 is directly connected,Serial1/0

C 192.168.2.0/24 is directly connected, FastEthernet0/0

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

Router-A#ping 192.168.2.2

PING 192.168.2.2(192.168.2.2):56 data bytes

.....

--- 192.168.2.2 ping statistics ---

5 packet transmitted,0 packets received,100% packet loss //不通

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

Router-A#config

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#show ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1, OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

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

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

Router-B#config

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#^Z

Router-B#show ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1, OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

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

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

Router-C#config

Router-C_config#ip route 192.168.0.0 255.255.0.0 192.168.2.1 //采用超网的方法

Router-C_config#^Z

Router-C#show ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1, OE2-OSPF external type 2

DHCP-DHCP type

S 192.168.0.0/16 [1.0] via 192.168.2.1 //注意掩码是16位

C 192.168.2.0/24 is directly connected,FastEthernet0/0

C 192.168.3.0/24 is directly connected,Ethernet1/0

第十步:测试

Router-C#ping 192.168.0.1

PING 192.168.0.1(192.168.0.1):56 data bytes

!!!!!

---192.168.0.1 ping statistics---

5 packets transmitted ,5 packets received ,0% packet loss

round-trip min/avg/max=30/32/42 m

(二)RIP协议的配置

第一步:配置好所有的接口的IP地址,保证扬有接口全部都是UP状态。

第二步:分别查看router-A、router-B、router-C的路由表。/

第三步:在router-A上PING路由器C

Router-A#ping 192.168.2.2 //不通

第四步:在路由器A上配置RIP协议并查看路由表

Router-A-config#router rip

Router-A-config-rip#network 192.168.0.0

Router-A-config-rip#network 192.168.1.0

Router-A-config-rip#^Z

Router-A#show ip router

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OEI-OSPF external type 1,OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

C 192.168.0.0/24 is directly connected, FastEthernet0/0

C 192.168.1.0/24 is directly connected,Serial1/1

注意到并没有发现RIP学习到的路由。

第五步:在路由器B上配置RIP协议并查看路由表

Router-B_config#router rip

Router-B_config_rip#network 192.168.1.0

Router-B_config_rip#network 192.168.2.0

Router-B_config_rip#^Z

Router-B#2004-1-1 00:15:58 Configgured from console 0 by DEFAULT

Router-B#show ip route

Codes: C-connected, S-statc, R-RIP, B-BGP, BC-BGP connected

D-DEIGRP, DEX-external DEIGRP,O-OSPF, OIA-OSPF inter area

ONI-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1,OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

R 192.168.0.0/16 [120,1] via 192.168.1.1(on Seriall/0) //从A学习到的路由

C 192.168.1.0/24 is directly connected, Seriall/0

C 192.168.2.0/24 is directly connected,FastEthernet0/0

第六步: 在路由器C上配置RIP协议并查看路由表

Router-C_config#router rip

Router-C_config_rip#network 192.168.2.0

Router-C_config_rip#network 192.168.3.0

Router-C_config_rip#^Z

Router-C#show ip route

Codes: C-connected,S-static,R-RIP,B-BGP

D-DEIGRP, DEX-external DEIGRP, O-OSPF,OIA-OSPF inter area

ONI-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1,OE2-OSPF external type 2

R 193.168.0.0/16 [120,2] via 192.168.2.1 (on FastEthernet0/0)

R 192.168.1.0/24 [120,2] via 192.168.2.1 (on FastEthernet0/0)

C 192.168.2.0/24 is directly connected,FastEthernet0/0

C 192.168.3.0/24 is directly connected,FastEthernet1/0

第七步: 再次查看A和B的路由表

Rourer-B#show ip route

Codes: C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP, DEX-external DEIGRP, O-OSPF,OIA-OSPF inter area

ONI-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1,OE2-OSPF external type 2

DHCP-DPCH type

VRF ID:0

R 192.168.0.0/16 [120,1] via 192.168.1.1(on Seriall/0)

C 192.168.1.0/24 is directly connected, Seriall/0

C 192.168.2.0/24 is directly connected,FastEthernet0/0

R 192.168.3.0/24 [120,1] via 192.168.2.2(on FastEthernet0/0)

Rourer-A#show ip route

Codes: C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP, DEX-external DEIGRP, O-OSPF,OIA-OSPF inter area

ONI-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1,OE2-OSPF external type 2

DHCP-DPCH type

VPF ID:0

C 192.168.0.0/24 is directly connected,FastEthernet0/0

C 192.168.1.0/24 is directly connected, Seriall/1

R 192.168.2.0/24 [120,1] via 192.168.1.1(on Seriall/1)

R 192.168.3.0/24 [120,1] via 192.168.1.1(on Seriall/1)

//注意到所有网段都学习到了路由

第八步:相关的查看命令

Rourer-A#show ip route

RIP protocol: Enabled

Global version: default(Decided on the interface version control)

Update:30, Expire:180,Holddown:120

Input-queue:50

Validate-update-source enable

No neightbor

Rourer-A#show ip route

RIP is Active

Sending update every 30 seconds,next due in 30 seconds //注意定时器的值

Invailid after 180 seconds,holddown 120

Update filter list for all interface is:

Update offser list for all interface is:

Redistributing:

Default version control: sent version 1,receive version 1 2

Interface Send Recv

FasrEthernet0/0 1 1 2

Serial1/1 1 1 2

Automatic network summarization is in effect

Router for Nerwork :

192.168.1.0/24

192.168.0.1/16

Distance: 120(default is 120)

Maximum route count :1024 Router count:6

Rourer-A#show ip route

193.168.0.0/24 directly FastEthernet0/0

192.168.0.0/24 auto-summary

192.168.1.0/24 directly connected Serial1/1

192.168.1.0/24 auto-summary

192.168.2.0/24 [120,1] via 192.168.1.2(on Seriall/1) 00:00:13 //收到RIP广播的时间

192.168.3.0/24 [120,1] via 192.168.1.1(on Seriall/1) 00:00:13

Rourer-A#show ip route rip

R 192.168.2.0/24 [120,1] via 192.168.1.2(on Seriall/1)

R 192.168.3.0/24 [120,1] via 192.168.1.2(on Seriall/1)

(三)OSPF协议的配置

实验拓扑

实验要求

ROUTER-A ROUTER-B

S1/1 192.168.1.1/24 S1/0 192.168.1.2/24

Loopback() 10.10.10.1/24 Loopback() 10.10.11.1/24

第一步:路由器环路接口的配置(其他接口配置请参见相关实验)

路由器 A:

Router-A_config# interface Loopback()

Router-A_10# ip address 10.10.10.1 255.255.255.0

路由器B:

Router-B #config

Router-B_config# interface Loopback()

Router-B_10# ip address 10.10.11.1 255.255.255.0

第二步:验证接口配置

Router-B# sh interface Loopback()

Loopback() is up,line protocol is up

Hardware is Loopback

Interface address is 10.10.11.1/24

MUT 1514 bytes,BW 8000000 kbit,DLY 500 usec

Encapsulation LOOPBACK

第三步:路由器的OSPF配置

A的配置:

Router-A_config#router ospf 2 //启动OSPF进程,进程号为2

Router-A_config_ospf_1#network 10.10.10.0 255.255.255.0 area 0//注意要写掩码和区域码

Router-A_config_ospf_1#network 192.168.1.0 255.255.255.0 area 0

B的配置

Router-B_config#router ospf 1

Router-B_config_ospf_1#network 10.10.11.0 255.255.255.0 area 0

Router-B_config_ospf_1#network 192.168.1.0 255.255.255.0 area 0

第四步:查看路由表

路由器A

Router-A#sh ip route

Codes: C - connected, S - static, R -- RIP, B - BGP, BC - BGP connected

D - DEIGRP, DEX - external DEIGRP, O -- OSPF, OIA - OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1,OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

C 10.10.10.0/24 is directly connected,Loopback0

O 10.10.11.1/32 [110,1600] via 192.168.1.2(on Serial 1/1)

//注意到环回接口产生的是主机路由

C 192.168.1.0/24 is directly connected, Serial 1/1

路由器B:

Router-B#show ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1,OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

O 10.10.11.1/32 [110,1600] via 192.168.1.1(on Serial 1/0)//注意管理距离为110

C 10.10.10.0/24 is directly connected,Loopback0

C 192.168.1.0/24 is directly connected, Serial 1/0

第五步: 其他验证命令

Router-B#sh ip ospf 1 //显示该OSPF进程的信息

OSPF process:1,Router ID:192.168.2.1

Distance:intra-area 110,inter-area 110,external 150

SPF schedule delay 5 secs,Hold time between two SPFs 10 secs

SPFTY:11(1),TOs:24,SCHDs:27

ALL Rtrs support Demand-Circuit

Number of areas is 1

AREA:0

Number of interface in this area is 2(UP:3)

Area authentication type: None

All Rtrs in this area support Demand-Circuit

Router-A#show ip ospf interace //显示OSPF接口状态和类型

Serial 1/1 is up,line protocol is up

Internet Address:192.168.1.1/24

Nettye:Point-to- Point

OSPF process is 2,AREA:0,Router ID:192,168.1.1

Cost:1600,Transmit Delay is 1 sec,Priority 1

Hello interval is 10,Dead timer is 40,Reransmit is 5

OSPF INTF State is IPOINT-TO-POINT

Neighbor Count is 1,Adjacent neighbor count is 1

Adjacent with neighbor 192.168.1.1

Loopback0 is up,line protocol is up

Internet Address:10.10.10.1/24

Nettype:Broadcast //环回接口的网络类型默认为广播

OSPF process is 2, AREA:0,Router ID:192.168.1.1

Cost: 1,Transmit Delay is 1 sec,Priority 1

Hello interval is 10,Dead timer is 40,Retransmit is 5

OSPF INTF State is ILOOPBACK

Neighbor Count is 0,Adjacent neighbor count is 0

Router-A#sh ip ospf neighbor //显示OSPF邻居


OSPF process:2

AREA:0

Neighbor ID Pri State DeadTime Neighbor Addr Interface

192.168.2.1 1 FULL/- 31 162.168.1.2 Serial 1/1

第六步:修改环回接口的网络类型

Router-A#conf

Router-A_config#interfance lookbanck 0

Router-A_config_10#ip ospf network point-to-point //将类型改为点到点

第七步:查看接口状态和路由器B的路由表

Router-A#sh ip ospf interface

Serial 1/1 is up,line protocol is up

Internet Address:192.168.1.1

Nettype:Point-to-Point

OSPF process is 2, AREA:0,Router ID:192.168.1.1

Cost:1600,Transmit Delay is 1 sec,Priority 1

Hello interval is 10,Dead timer is 40,Retransmit is 5

OSPF INTF State is IPOINT_TO_POINT

Neighbor Count is 1,Adjacent neghbor count is 1

Adjacent with neghbor 192.168.1.2

Loopback0 is up,line protocol is up

Internet Address:10.10.10.1/24

Nettype:Point-to-Point

OSPF process is 2, AREA:0,Router ID:192.168.1.1

Cost:1,Transmit Delay is 1 sec,Priority 1

Hello interval is 10,Dead timer is 40,Retransmit is 5

OSPF INTF State is IPOINT_TO_POINT

Neighbor Count is 0,Adjacent neghbor count is 0

Router-B#sh ip route

Codes:C-connected,S-static,R-RIP,B-BGP,BC-BGP connected

D-DEIGRP,DEX-external DEIGRP,O-OSPF,OIA-OSPF inter area

ON1-OSPF NSSA external type 1,ON2-OSPF NSSA external type 2

OE1-OSPF external type 1,OE2-OSPF external type 2

DHCP-DHCP type

VRF ID:0

O 10.10.11.1/32 [110,1600] via 192.168.1.1(on Serial 1/0)//注意管理距离为110

C 10.10.10.0/24 is directly connected,Loopback0

C 192.168.1.0/24 is directly connected, Serial 1/0

相关推荐
低头不见29 分钟前
tcp的粘包拆包问题,如何解决?
网络·网络协议·tcp/ip
SKYDROID云卓小助手2 小时前
三轴云台之相机技术篇
运维·服务器·网络·数码相机·音视频
yuzhangfeng4 小时前
【云计算物理网络】从传统网络到SDN:云计算的网络演进之路
网络·云计算
TDengine (老段)4 小时前
TDengine 中的关联查询
大数据·javascript·网络·物联网·时序数据库·tdengine·iotdb
zhu12893035565 小时前
网络安全的现状与防护措施
网络·安全·web安全
zhu12893035567 小时前
网络安全与防护策略
网络·安全·web安全
zhuyixiangyyds7 小时前
day21和day22学习Pandas库
笔记·学习·pandas
每次的天空7 小时前
Android学习总结之算法篇四(字符串)
android·学习·算法
沫夕残雪7 小时前
HTTP,请求响应报头,以及抓包工具的讨论
网络·vscode·网络协议·http
π2707 小时前
爬虫:网络请求(通信)步骤,http和https协议
网络·爬虫