网络必备——动态路由(默认路由+静态+OSPF+RIP综合实验)

本章目的:全网互通,R2设置静态路由,R2和R3在AREA1区域中使用OSPF协议 ,R3设置默认路由回来,R4和R5使用RIP协议

本章环境:GNS3,5台路由器,4台主机,1个外部网.

实验图:

  1. 路由器接口地址
R1:
f0/0(192.168.10.1/24)
f0/1(192.168.20.1/24)
R2:
f0/1(192.168.20.2/24)
f0/0(192.168.30.1/24)
R3:
f0/0(192.168.30.2/24)
f0/1(192.168.40.1/24)
f1/0(12.0.0.1/24)
f2/0(192.168.70.1/24)
R4:
f0/1(192.168.50.1/24)
f0/0(192.168.40.2/24)
R6:
f0/1(192.168.60.1/24)
f0/0(192.168.50.2/24)

2.外部网地址:

R5:
f0/0(12.0.0.2/24)
f0/1(13.0.0.1/24)

3.客户端地址:

PC机1:(192.168.10.2/24)
PC机2:(192.168.70.2/24)
PC机3:(13.0.0.13/24)
PC机4:(192.168.60.2/24)

R3的路由器要多加一块单板

1.配置R1路由器

R1#conf t   //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0  //进入接口
R1(config-if)#ip add 192.168.10.1 255.255.255.0   //设置地址
R1(config-if)#no shut   //开启
R1(config-if)#ex
R1(config)#int f0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#ex
R1(config)#do show ip route  //查看路由表
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 192.168.20.2 to network 0.0.0.0

C    192.168.10.0/24 is directly connected, FastEthernet0/0  //直连网段
C    192.168.20.0/24 is directly connected, FastEthernet0/1  //直连网段
S*   0.0.0.0/0 [1/0] via 192.168.20.2    //默认网络

2.配置R2路由器接口地址

R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/1
R2(config-if)#ip add 192.168.20.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#ex
R2(config)#int f0/0
R2(config-if)#ip add 192.168.30.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#ex

3.配置R2静态路由和OSPF协议

R2(config)#router ospf 1  //进入OSPF协议1进程  在协议里一定要在同一个进程
R2(config-router)#router-id 2.2.2.2   //设置路由器router-id
R2(config-router)#network 192.168.30.0 0.0.0.255 area 1  //宣告30网段再骨干区域area1中
R2(config-router)#redistribute connected subnets    //将R2直连的网段注入进来
R2(config-router)#redistribute static subnets          //将 静态路由的10网段注入进来
R2(config-router)#ex
R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1  //设置静态路由 网段,子网掩码,下一跳地址
R2(config)#do show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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.30.0/24 is directly connected, FastEthernet0/0
S    192.168.10.0/24 [1/0] via 192.168.20.1
C    192.168.20.0/24 is directly connected, FastEthernet0/1

4.配置R3接口地址

R3
R3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R3(config)#int f0/0
R3(config-if)#ip add 192.168.30.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f0/1
R3(config-if)#ip add 192.168.40.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f1/0
R3(config-if)#ip add 12.0.0.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f2/0
R3(config-if)#ip add 192.168.70.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#ex

5.配置R3默认路由和OSPF协议

R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2  将R3设置成默认路由
R3(config)#router ospf 1   //开启OSPF进程1
R3(config-router)#router-id 3.3.3.3  //设置路由router-id
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1  宣告30网段在area 1区域中
R3(config-router)#network 192.168.40.0 0.0.0.255 area 0 宣告40网段在area 0区域中
R3(config-router)#network 192.168.70.0 0.0.0.255 area 0宣告70网段在area 0区域中
R3(config-router)#ex
R3(config)#do show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 12.0.0.2 to network 0.0.0.0

C    192.168.30.0/24 is directly connected, FastEthernet0/0
O E2 192.168.10.0/24 [110/20] via 192.168.30.1, 00:00:49, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/1
O E2 192.168.20.0/24 [110/20] via 192.168.30.1, 00:00:49, FastEthernet0/0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet1/0
C    192.168.70.0/24 is directly connected, FastEthernet2/0
S*   0.0.0.0/0 [1/0] via 12.0.0.2

6.配置R4接口地址

R4#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R4(config)#int f0/0
R4(config-if)#ip add 192.168.40.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int f0/1
R4(config-if)#ip add 192.168.50.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#ex

7.配置R4RIP协议,注入OSPF协议

R4(config)#router rip  //进入rip协议
R4(config-router)#ver 2    //使用2版本协议
R4(config-router)#no auto-summary   //关闭路由汇总
R4(config-router)#network 192.168.50.0   //宣告网段
R4(config-router)#redistribute ospf 1 metric 5  //在rip协议中注入OSPF协议
R4(config-router)#router ospf 1    //开启OSPF进程1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 192.168.40.0 0.0.0.255 area 0
R4(config-router)#redistribute rip subnets
R4(config-router)#ex
R4(config)#do show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 192.168.40.1 to network 0.0.0.0

O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:00:18, FastEthernet0/0
O E2 192.168.10.0/24 [110/20] via 192.168.40.1, 00:00:18, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/0
O E2 192.168.20.0/24 [110/20] via 192.168.40.1, 00:00:18, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1
O    192.168.70.0/24 [110/11] via 192.168.40.1, 00:00:18, FastEthernet0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.40.1, 00:00:18, FastEthernet0/0

8.配置R6接口地址

R6#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R6(config)#int f0/0
R6(config-if)#ip add 192.168.50.2 255.255.255.0
R6(config-if)#no shut
R6(config-if)#int f0/1
R6(config-if)#ip add 192.168.60.1 255.255.255.0
R6(config-if)#no shut
R6(config-if)#ex

9.配置R6RIP协议

R6(config)#router rip
R6(config-router)#ver 2
R6(config-router)#no auto-summary
R6(config-router)#network 192.168.50.0
R6(config-router)#network 192.168.60.0
R6(config-router)#ex
R6(config)#do show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 192.168.50.1 to network 0.0.0.0

R    192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0
C    192.168.60.0/24 is directly connected, FastEthernet0/1
R    192.168.10.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0
R    192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0
R    192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/0
R    192.168.70.0/24 [120/5] via 192.168.50.1, 00:00:21, FastEthernet0/0
R*   0.0.0.0/0 [120/1] via 192.168.50.1, 00:00:22, FastEthernet0/0

10.配置R5外部网默认路由,和接口地址

R5R5#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R5(config)#ip route 192.168.0.0 255.255.0.0 12.0.0.1  //设置成默认路由
R5(config)#int f0/0
R5(config-if)#ip add 12.0.0.2 255.255.255.0
R5(config-if)#no shut
R5(config-if)#int f0/1
R5(config-if)#ip add 13.0.0.1 255.255.255.0
R5(config-if)#no shut
R5(config-if)#ex
R5(config)#do show ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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

     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/1
S    192.168.0.0/16 [1/0] via 12.0.0.1

11.给四台主机配好地址

PC1> ip 192.168.10.2 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1

PC2> ip 192.168.70.2 192.168.70.1
Checking for duplicate address...
PC1 : 192.168.70.2 255.255.255.0 gateway 192.168.70.1

PC3> ip 13.0.0.13 13.0.0.1
Checking for duplicate address...
PC1 : 13.0.0.13 255.255.255.0 gateway 13.0.0.1

PC号主机> ip 192.168.60.2 192.168.60.1
Checking for duplicate address...
PC1 : 192.168.60.2 255.255.255.0 gateway 192.168.60.1

12.验证一下是不是全网互通

PC1> ping 192.168.70.2
192.168.70.2 icmp_seq=1 timeout
192.168.70.2 icmp_seq=2 timeout
84 bytes from 192.168.70.2 icmp_seq=3 ttl=61 time=62.159 ms
84 bytes from 192.168.70.2 icmp_seq=4 ttl=61 time=62.159 ms
84 bytes from 192.168.70.2 icmp_seq=5 ttl=61 time=66.171 ms

PC1> ping 13.0.0.13
13.0.0.13 icmp_seq=1 timeout
13.0.0.13 icmp_seq=2 timeout
84 bytes from 13.0.0.13 icmp_seq=3 ttl=60 time=92.298 ms
84 bytes from 13.0.0.13 icmp_seq=4 ttl=60 time=92.248 ms
84 bytes from 13.0.0.13 icmp_seq=5 ttl=60 time=94.935 ms

PC1> ping 192.168.60.2
192.168.60.2 icmp_seq=1 timeout
84 bytes from 192.168.60.2 icmp_seq=2 ttl=59 time=112.913 ms
84 bytes from 192.168.60.2 icmp_seq=3 ttl=59 time=110.144 ms
84 bytes from 192.168.60.2 icmp_seq=4 ttl=59 time=116.545 ms
84 bytes from 192.168.60.2 icmp_seq=5 ttl=59 time=116.432 ms

以上就是我们的综合实验了,下一章OSPF最后一个实验虚链路。

原文地址:https://blog.51cto.com/14449524/2438438

时间: 2024-08-09 11:40:02

网络必备——动态路由(默认路由+静态+OSPF+RIP综合实验)的相关文章

IT菜鸟之路由器基础配置(静态、动态、默认路由)

路由器:连接不同网段的设备 企业级路由和家用级路由的区别: 待机数量不同(待机量) 待机量:同时接通的终端设备的数量 待机量的值越高,路由的性能越好 别墅级路由,表示信号好,和性能无关 交换机:背板带宽(专业术语)是内部的传输速度 网关:是用来处理不同网段数据通信 网关地址一般是路由器的地址 no 任何生效性的操作都可以使用no使其失效 rip Routing Information Protocol 路由信息协议 destination host unreachable 目标主机不可达 sho

路由的几个基本概念-直连路由/网关路由/主机路由/网络路由/动态路由/静态路由/默认路由

1.动态路由/静态路由 动态路由 路由选择器自动共享路由信息 自动构造路由表,需要一个路由协议,如RIP或OSPF 静态路由 路由选择器不共享路由信息(单方向路由) 手工构造路由表 2.直连路由/网关路由(间接路由) 其区别在于,发往直连路由的设备中不但具有指明目的端的I P地址,还具有其mac地址. 当报文被发往一个间接路由时,I P地址指明的是最终的目的地,但是mac地址指明的是网关(即下一跳路由器). 3.主机路由/网络路由 直连路由和网关路由是由下一跳区分的,而主机路由和网络路由是由目的

网络必备——动态路由之OSPF协议(超详细理论)

动态路由之OSPF协议 一.路由概述之内部和外部网关协议 内部网关协议和外部网关协议 1.区域划分管理,自治系统(AS) 这么多路由. 2.内部网关协议(IGP)RIP OSPF ISIS 在各自的内部区域去跑 但是不同的区域没法通信 3.外部网关协议(EGP) BGP 只有一个协议 比如阿里巴巴飞天 想通信通过外部协议 BGP ECS是阿里巴巴的云主机 2.ospf是链路状态路由协议 OSPF是链路状态路由协议 每条链路都是一个路由器的直连网段 它自己知道所有数据包信息,他们会相互交换信息,会

静态路由--------默认路由和路由汇总

前言:默认路由和路由汇总的存在都是为了极大的简化路由器的路由表. 1>在给路由器添加路由时,子网掩码中1的位数越少,该条路由涵盖的网络越多.那么,极限是什么呢?就是网络地址和子网掩码都为零,如下所示配置: Router(config) #ip route 0.0.0.0 0.0.0.0 10.0.0.2 这就意味着到任何网络下一跳转发给10.0.0.2.网络地址和子网掩码均为零的路由就是默认路由. 2>通过合理地规划IP地址即通过将连续的IP地址指派给物理位置较为集中的网络,在路由器上配置路由

MSTP+OSPF+VRRP综合实验指导书

(一)拓扑描述: 本次实验采用MSTP+OSPF+VRRP技术,提供网络高可靠性.稳定性.MSTP(多生成树实例)主要解决网络中(SW5-SW4-SW6)设备间的环路问题,对接入交换机双上行链路进行备份:对业务流进行负载分担.OSPF(开放最短路径优先协议)动态路由技术,处理(SW5-SW4-SW7)之间的路由学习,计算出多条路径,实现出口链路负载:vrrp(虚拟网关路由协议)通过将两台核心交换机上面的地址虚拟出来一个虚拟IP地址作为用户提供网关服务.核心层交换机任意一台出现故障不会影响用户网络

路由基础及静态路由

路由介绍: 什么是路由: 路由就是寻径,是指路由器在收到IP包后,去查找自已的路由信息进行转发的过程. 路由信息就是去往目的地的一条信息,它指明了去往目的地的方向,通常也把路由信息简称为路由. 要完成对数据包的传输,路由器必须知道并处理哪些信息: 目的地址 相邻路由器,并且能够从邻居处获得远程网络的信息 到远程网络的所有可能的路径 能计算出到达远程网络的最佳路径 要能够维护并验证路由信息,在路径发生改变时,要能很快的知道 什么是路由表: 路由器使用一个路由表来保存去往目的地的路由信息,路由表中的

静态默认路由 可以在网络边缘通过一个路由器端口访问每一个pc机

本实验的目的是:给路由器配置静态的默认路由 思路:1 手动配置4个PC的IP地址,网关 2 依次配置每个路由器每个端口的IP地址 3  配置左右两边的   静态默认路由 4  配置中间路由器的   静态路由 具体操作: 1 配置终端IP地址和网关略过 2 配置左边路由器的IP地址 路由器改名称,对接口gig0/0配置IP地址 Router>en Router#configure terminal Router(config)#hostname R1 R1(config)#interface gi

GNS3路由配置综合实验(OSPF协议、RIP协议、静态路由、默认路由)

实验环境: 理论之前的博客已经写过,这次直接实验.具体拓扑图如下,注意R3接口不够,需要添加两个NM-1FE-TX单板. 实际操作: 1.配置R1. R1#conf t //进入全局模式 Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int f0/0 //进入接口模式 R1(config-if)#ip add 192.168.10.1 255.255.255.0 //设置IP地址与子网掩码 R1(c

9、网络知识(路由交换和ARP协议)+配置单网卡多ip和配置默认路由

网络知识详解 提问:网络到底是什么?我们在电缆中传输的都是电信号(高电压或者是低电压),所以高电压就是1,低电压就是0,所以规定一定的时间传输固定的高低电压来当做是接收的数据我们所谓的10Mbps:每秒中可以传输10M个bit所以别人说你的是4M的带宽,指的就是4Mbps,要除以8才是实际的速率那就是4Mbps=4/8MBs=0.5MBs=0.51024KBs=(41024)Kbps=512KB/s的下载速率我们平时说的下载速度就是以KB/s为单位的1KB/S=8Kbps 512KB/S=8K*