思科rip与ospf配置

拓扑图

在这里插入图片描述

  • 黄色区域为rip
  • 红色区域为ospf

ip地址划分

  • 进口子
  • ip add 地址 子网掩码

网络直连

rip

  • router rip
  • version 2
  • no auto
  • net 分别需要rip的地址网段

ospf

  • router ospf 1
  • net 需要ospf的地址网段 0.0.0.255 area 0

rip与ospf的路由重发布

需要重发布的路由条件是左右两边分别为rip和ospf协议的交接处需要进行进行rip和ospf的重发布。

  • router rip
  • redistribute ospf 1 metric 10
  • exit
  • router ospf 1
  • redistribute rip subnets

案例

#OSPF多区域配置(三)
拓扑图:

1.两个区域:area0和area1

2.route ID规划

(1)R1:1.1.1.1

(2)R2:2.2.2.2

(3)R3:3.3.3.3

(4)R4:4.4.4.4

3.目的:验证最终两台客户机之间能否互通

具体操作:

一、给路由器不同端口配置相应IP地址

1.路由器R1

R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f1/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
*Mar  1 00:08:25.447: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 00:08:26.447: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
R1(config-if)#int f0/0
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
*Mar  1 00:09:07.287: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:09:08.287: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.50.2 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
*Mar  1 00:09:33.911: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:09:34.911: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.20.1    YES manual up                    up      
FastEthernet0/1            192.168.50.2    YES manual up                    up      
FastEthernet1/0            192.168.10.1    YES manual up                    up      
R1(config-if)#

2.路由器R2

R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#int f0/0
R2(config-if)#ip add 192.168.20.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
*Mar  1 00:10:40.915: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:10:41.915: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#int f0/1
R2(config-if)#ip add 192.168.30.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#
*Mar  1 00:11:04.627: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:11:05.627: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.20.2    YES manual up                    up      
FastEthernet0/1            192.168.30.1    YES manual up                    up      
R2(config-if)#

3…路由器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)#
*Mar  1 00:12:01.899: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:12:02.899: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R3(config-if)#int f1/0
R3(config-if)#ip add 192.168.60.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#
*Mar  1 00:12:25.667: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
*Mar  1 00:12:26.667: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up
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)#
*Mar  1 00:12:50.071: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:12:51.071: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R3(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.30.2    YES manual up                    up      
FastEthernet0/1            192.168.40.1    YES manual up                    up      
FastEthernet1/0            192.168.60.1    YES manual up                    up      
R3(config-if)#

4…路由器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)#
*Mar  1 00:13:59.079: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:14:00.079: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
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)#
*Mar  1 00:14:21.227: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:14:22.227: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R4(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.40.2    YES manual up                    up      
FastEthernet0/1            192.168.50.1    YES manual up                    up      
R4(config-if)#

二、在路由器回环网卡上配置route ID

1.路由器R1

R1(config-if)#ex
R1(config)#int loopback 0
R1(config-if)#
*Mar  1 00:25:10.767: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no shut
R1(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.20.1    YES manual up                    up      
FastEthernet0/1            192.168.50.2    YES manual up                    up      
FastEthernet1/0            192.168.10.1    YES manual up                    up      
Loopback0                  1.1.1.1         YES manual up                    up      
R1(config-if)#

2.路由器R2

R2(config-if)#ex
R2(config)#int lo 0
R2(config-if)#
*Mar  1 00:28:05.027: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#no shut
R2(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.20.2    YES manual up                    up      
FastEthernet0/1            192.168.30.1    YES manual up                    up      
Loopback0                  2.2.2.2         YES manual up                    up      
R2(config-if)#

3.路由器R3

R3(config-if)#ex
R3(config)#int lo 0
R3(config-if)#
*Mar  1 00:28:53.939: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#no shut
R3(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.30.2    YES manual up                    up      
FastEthernet0/1            192.168.40.1    YES manual up                    up      
FastEthernet1/0            192.168.60.1    YES manual up                    up      
Loopback0                  3.3.3.3         YES manual up                    up      
R3(config-if)#

4.路由器R4

    
R4(config-if)#ex
R4(config)#int lo 0
R4(config-if)#
*Mar  1 00:29:42.383: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R4(config-if)#ip add 4.4.4.4 255.255.255.255
R4(config-if)#no shut  
R4(config-if)#do show ip int b
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.40.2    YES manual up                    up      
FastEthernet0/1            192.168.50.1    YES manual up                    up      
Loopback0                  4.4.4.4         YES manual up                    up      
R4(config-if)#

三、启动OSPF路由协议,并宣告路由ID以及所属网段

1.路由器R1

    
R1(config-if)#ex
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.10.0 0.0.0.255 area 0
R1(config-router)#network 192.168.20.0 0.0.0.255 area 0
R1(config-router)#network 192.168.50.0 0.0.0.255 area 0
R1(config-router)#ex
R1(config)#

2.路由器R2

R2(config-if)#ex
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.20.0 0.0.0.255 area 0
R2(config-router)#
*Mar  1 00:43:17.799: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R2(config-router)#network 192.168.30.0 0.0.0.255 area 1
R2(config-router)#
*Mar  1 00:45:49.619: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/1 from LOADING to FULL, Loading Done
R2(config-router)#ex
R2(config)#

3.路由器R3

R3(config-if)#ex
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 192.168.30.0 0.0.0.255 area 1
R3(config-router)#
*Mar  1 00:45:49.651: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on FastEthernet0/0 from LOADING to FULL, Loading Done
R3(config-router)#network 192.168.40.0 0.0.0.255 area 1
R3(config-router)#network 192.168.60.0 0.0.0.255 area 1
R3(config-router)#ex
R3(config)#
*Mar  1 00:48:56.483: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on FastEthernet0/1 from LOADING to FULL, Loading Done
R3(config)#

4.路由器R4

R4(config-if)#ex
R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 192.168.40.0 0.0.0.255 area 1
R4(config-router)#
*Mar  1 00:48:56.479: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on FastEthernet0/0 from LOADING to FULL, Loading Done
R4(config-router)#network 192.168.50.0 0.0.0.255 area 0
R4(config-router)#ex
R4(config)#
*Mar  1 00:49:09.523: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on FastEthernet0/1 from LOADING to FULL, Loading Done
R4(config)#

四、查看路由表

1.路由器R1

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 not set

     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
O IA 192.168.30.0/24 [110/20] via 192.168.20.2, 00:20:36, FastEthernet0/0
O IA 192.168.60.0/24 [110/21] via 192.168.50.1, 00:01:34, FastEthernet0/1
                     [110/21] via 192.168.20.2, 00:01:34, FastEthernet0/0
C    192.168.10.0/24 is directly connected, FastEthernet1/0
O IA 192.168.40.0/24 [110/20] via 192.168.50.1, 00:14:46, FastEthernet0/1
C    192.168.20.0/24 is directly connected, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1
R1(config)#

2.路由器R2

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

     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
C    192.168.30.0/24 is directly connected, FastEthernet0/1
O    192.168.60.0/24 [110/11] via 192.168.30.2, 00:02:17, FastEthernet0/1
O    192.168.10.0/24 [110/11] via 192.168.20.1, 00:03:18, FastEthernet0/0
O    192.168.40.0/24 [110/20] via 192.168.30.2, 00:18:42, FastEthernet0/1
C    192.168.20.0/24 is directly connected, FastEthernet0/0
O    192.168.50.0/24 [110/20] via 192.168.20.1, 00:21:24, FastEthernet0/0
R2(config)#

3.路由器R3

Enter configuration commands, one per line.  End with CNTL/Z.
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 not set

     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
C    192.168.30.0/24 is directly connected, FastEthernet0/0
C    192.168.60.0/24 is directly connected, FastEthernet1/0
O IA 192.168.10.0/24 [110/21] via 192.168.40.2, 00:03:54, FastEthernet0/1
                     [110/21] via 192.168.30.1, 00:03:54, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/1
O IA 192.168.20.0/24 [110/20] via 192.168.30.1, 00:19:31, FastEthernet0/0
O IA 192.168.50.0/24 [110/20] via 192.168.40.2, 00:16:19, FastEthernet0/1
R3(config)#

4.路由器R4

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 not set

O    192.168.30.0/24 [110/20] via 192.168.40.1, 00:16:46, FastEthernet0/0
O    192.168.60.0/24 [110/11] via 192.168.40.1, 00:03:14, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
C       4.4.4.4 is directly connected, Loopback0
O    192.168.10.0/24 [110/11] via 192.168.50.2, 00:04:15, FastEthernet0/1
C    192.168.40.0/24 is directly connected, FastEthernet0/0
O    192.168.20.0/24 [110/20] via 192.168.50.2, 00:16:31, FastEthernet0/1
C    192.168.50.0/24 is directly connected, FastEthernet0/1
R4(config)#

分析路由表信息:

1.负载均衡,可以通过两种当值去获得IP

2.没有负载均衡的说明自身就是负载均衡

五、给客户机配置IP地址

1.PC1

PC1> 
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

2.CP2

PC2> 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

六、验证客户机之间是否互通


PC1> ping 192.168.60.2 -t
192.168.60.2 icmp_seq=1 timeout
84 bytes from 192.168.60.2 icmp_seq=2 ttl=61 time=57.082 ms
84 bytes from 192.168.60.2 icmp_seq=3 ttl=61 time=57.879 ms
84 bytes from 192.168.60.2 icmp_seq=4 ttl=61 time=63.043 ms
84 bytes from 192.168.60.2 icmp_seq=5 ttl=61 time=56.809 ms

结果表明:互通

  • 4
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Re:CCNA_CCNP 思科网络认证 动态路由 EIGRP 和 OSPF 协议======================# EIGRP协议特点(CISCO产品专用独家协议) 使用Hello消息发现邻居,然后交换路由信息,使用Hello包维持邻居表 代替其它动态协议周期性更新而消耗资源。 有备用路径,当最佳路径不可用,立即使用备用路径 备用路径比动态获取新路径效率更高。 度量值默认为带宽和延迟,也可以添加负载和可靠性以及最大传输单元(MTU) rip只是hops跳数为依据,使用带宽和延时为指标更合理 还可以负载、可靠性和MTU为依据,选择最佳路径。 默认支持4条链路的不同代价的负载均衡,可以更改为最多6条 最大跳数为255(默认是100跳) rip只有15hops,所有只能够使用在小型网络中。 触发式更新路由表,即网络发生变化时,增量更新 hello包和触发式结合,消耗设置资源更低 支持路由的自动汇总。 支持大的网络,可以使用自制系统号来区别可共享路由信息的路由器集合,路由信息只可以在拥有相同自制系统号的路由器间共享。 (即一片路由和另一片路由,不计划发布沟通的情况下,可以以系统号区分) 如同VLAN方式 管理距离是90 直连0静态路由1;rip协议120;EIGRP协议90(比rip优先级高) # EIGRP度量值 EIGRP度量值 带宽 延迟 可靠性 负载 最大路径和跳数 默认支持4条等价路径 最大跳数100,也可以设置成255 # EIGRP三张表 邻居关系表 拓扑表 路由表 # EIGRP专业术语 可行距离(FD)                :A到E最小开销的路径(最佳路径) 被通告距离(AD)            :A的前一个路由器,到E的开销 继任者(最佳路径)          :可行路径下一跳的路由器 可行的继任者(备用路径):被通告距离 ---------------------------------------------------------------------------------------# 介绍OSPF协议 开放最短路径优先(OSPF)是一个开放标准的路由选择协议,它被各种网络开发商所广泛使用。 即无厂家边界 # OSPF协议具有下列特性: 由区域和自治系统组成 最小化的路由更新的流量(触发式更新,平时hello包打招呼,类eigrp协议) 允许可缩放性 支持变VLSM和CIDR(五类间路由/23) 拥有不受限的跳数 允许多销售商的设备集成(开放的标准) 度量值是带宽 # OSPF术语 Router-ID(网络中的身份:取ip最大值) 网络中运行OSPF协议的路由器都要有一个唯一的标识,这就是Router-ID,并且Router-ID在网络中绝对不可以有重复。 COST(开销) OSPF协议选择最佳路径的标准是带宽,带宽越高计算出来的开销越低。到达目标网络的各个链路累计开销最低的,就是最佳路径。 链路(Link) 就是路由器上的接口,在这里,应该指运行在OSPF进程下的接口。 链路状态(Link-State) 链路状态(LSA)就是OSPF接口上的描述信息,例如接口上的IP地址,子网掩码,网络类型,Cost值等等,OSPF路由器之间交换的并不是路由表,而是链路状态(LSA)。 邻居(Neighbor) 两台或多台运行OSPF路由器在一个公共的网络上形成的基本关系。 但是不一定交换信息 邻接(Adjacency) OSPF只有邻接状态才会交换LSA。 只有发生交换数据关系的设备间叫做邻接 邻居间选择一个交通站DR,负责邻居间交换数据--------------------------------------------------------------------------------------- # 在边界路由器通过再发布方式向内部网段传递默认路由 两个不同协议自治区:RIP 和 EIGRP 路由再发布 两个不同协议自治区:OSPF 和 EIGRP 路由再发布 两个不同协议自治区:OSPFRIP 路由再发布------------------------------------------------------------------                

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值