ospf实验

要求:

1、R4为ISP,其上只配置IP地址;R4与其他所直连设备间均使用公有IP;
2、R3-R5、R6、R7为MGRE环境,R3为中心站点;
3、整个OSPF环境IP基于172.16.0.0/16划分;除了R12有两个环回,其他路由器均有一个环回IP
4、所有设备均可访问R4的环回;
5、减少LSA的更新量,加快收敛,保障更新安全;
6、全网可达;

1.R1上的IP配置

int g	
[R1]int GigabitEthernet 0	
[R1]int GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip add 172.16.33.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 172.16.34.1 24

R2上的IP配置

[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 172.16.33.2 24 
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip add 172.16.35.2 24

R3上的IP配置

[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.33.3 24
[R3-Serial4/0/0]ip add 34.0.0.3 24
[R3-LoopBack0]ip add 172.16.36.3 24

R4上的IP配置

[R4]int s4/0/0
[R4-Serial4/0/0]ip add 34.0.0.4 24
[R4-Serial4/0/0]int s4/0/1
[R4-Serial4/0/1]ip add 45.0.0.4 24
[R4-Serial4/0/1]int s3/0/0
[R4-Serial3/0/0]ip add 46.0.0.4 24
[R4-Serial3/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 47.0.0.4 24
[R4-GigabitEthernet0/0/0]int l0
[R4-LoopBack0]ip add 172.16.2.4 24

R5上配置ip

[R5]int s4/0/0
[R5-Serial4/0/0]ip add 45.0.0.5 24 
[R5-Serial4/0/0]
Apr 16 2024 18:17:03-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol PPP
 IPCP on the interface Serial4/0/0 has entered the UP state. 
[R5-Serial4/0/0]int l0
[R5-LoopBack0]ip add 172.16.3.5 24

R6

[R6-Serial4/0/0]ip add 46.0.0.6 24
[R6-Serial4/0/0]q

[R6]int l0
[R6-LoopBack0]ip add 172.16.4.6 24
[R6-GigabitEthernet0/0/0]ip add 172.16.65.1 30

R7:

[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 47.0.0.7 24
[R7-GigabitEthernet0/0/1]int l0
[R7-LoopBack0]ip add 172.16.5.7 24
[R7-LoopBack0]int 0/0/1g
[R7-GigabitEthernet0/0/1]ip add 172.16.97.1 30

R8:

[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 172.16.97.2 30
[R8-GigabitEthernet0/0/0]int g0/0/1
[R8-GigabitEthernet0/0/1]ip add 172.16.97.5 30
[R8-GigabitEthernet0/0/1]int l0
[R8-LoopBack0]ip add 172.16.98.8 24

R9

[R9]int g0/0/0
[R9-GigabitEthernet0/0/0]ip add 172.16.97.6 30
[R9-GigabitEthernet0/0/0]int g0/0/1
[R9-GigabitEthernet0/0/1]ip ad 172.16.129.1 30
[R9-GigabitEthernet0/0/1]int l0
[R9-LoopBack0]ip add 172.16.130.9 24

R10

[R10]int g0/0/0
[R10-GigabitEthernet0/0/0]ip add 172.16.129.2 30
[R10-GigabitEthernet0/0/0]
Apr 16 2024 18:32:02-08:00 R10 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R10-GigabitEthernet0/0/0]int l0
[R10-LoopBack0]ip ad 172.16.131.10 24

R11

[R11]int g0/0/0
[R11-GigabitEthernet0/0/0]ip ad 172.16.65.2 30
Apr 16 2024 18:33:58-08:00 R11 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R11-GigabitEthernet0/0/0]int g0/0/1
[R11-GigabitEthernet0/0/1]ip add 172.16.65.5 30
[R11-GigabitEthernet0/0/1]
Apr 16 2024 18:34:07-08:00 R11 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R11-GigabitEthernet0/0/1]int l0
[R11-LoopBack0]ip add 172.16.66.11 24

R12

[R12-GigabitEthernet0/0/0]ip add 172.16.65.6 30
[R12-GigabitEthernet0/0/0]
Apr 16 2024 18:36:06-08:00 R12 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R12-GigabitEthernet0/0/0]int l0
[R12-LoopBack0]ip add 172.16.160.12 24
[R12-LoopBack0]int l1
[R12-LoopBack1]ip ad 172.16.161.12 24

二:

公网通

4个区域

R3上的公网通

静态缺省

[R3]ip route-static 0.0.0.0 0 34.0.0.4
[R5]ip route-static 0.0.0.0 0 45.0.0.4
[R6]ip route-static 0.0.0.0 0 46.0.0.4 

[R7]ip route-static 0.0.0.0 0 47.0.0.4 

测试公网是否通畅

私网通通过ospf实现这一操作

区域1

R1

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 1
[R1-ospf-1-area-0.0.0.1]network 172.16.33.1 0.0.0.0

R2

[R2]ospf router-id 2.2.2.2
[R2-ospf-1]a 2
[R2-ospf-1-area-0.0.0.2]ne 0.0.0.0 255.255.255.255
[R2-ospf-1-area-0.0.0.2]q

网段宣告

R3

[R3]ospf router-id 3.3.3.3
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]ne 172.16.33.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]ne 172.16.36.0 0.0.0.255

R5

[R5]ospf 1 r	
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.3.3 0.0.0.255

R6的区域0

[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]ne 172.16.4.0 0.0.0.255

R7的区域0

[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.5.0 0.0.0.255

R6的区域2

[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]ne 172.16.65.1 0.0.0.0
[R6-ospf-1-area-0.0.0.2]q

R11区域2 

[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]a 2
[R11-ospf-1-area-0.0.0.2]ne 172.16.65.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]ne 172.16.65.5 0.0.0.0

R12区域2

[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]a 2
[R12-ospf-1-area-0.0.0.2]ne 172.16.65.6 0.0.0.0
[R12]rip 1
[R12-rip-1]v 2
[R12-rip-1]undo s	
[R12-rip-1]undo summary
[R12-rip-1]ne	
[R12-rip-1]network 172.16.0.0

路由引入

在ospf下做路由引入

[R12]ospf 1
[R12-ospf-1]im	
[R12-ospf-1]import-route r	
[R12-ospf-1]import-route rip 

查看R6的ospf表

然后去R7上配置3区域

[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]ne 172.16.97.1 0.0.0.0

R8

[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 3
[R8-ospf-1-area-0.0.0.3]ne 172.16.97.2 0.0.0.0
[R8-ospf-1-area-0.0.0.3]ne 172.16.97.5 0.0.0.0

R9一半属于区域3一半属于区域4

[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]a 3
[R9-ospf-1-area-0.0.0.3]ne 172.16.97.6 0.0.0.0
[R9]ospf 2 router-id 9.9.9.9
[R9-ospf-2] a 4
[R9-ospf-2-area-0.0.0.4]ne 172.16.129.1 0.0.0.0
[R9-ospf-2-area-0.0.0.4]ne 172.16.130.0 0.0.0.255

R10权属于区域4

[R10]ospf 2 router-id 10.10.10.10
[R10-ospf-2]a 4
[R10-ospf-2-area-0.0.0.4]ne 172.16.129.2 0.0.0.0

检查是否建立邻居关系

R3为中心站点进行隧道配置

[R3-Tunnel0/0/0]ip add 172.16.6.3 24
[R3-Tunnel0/0/0]tu	
[R3-Tunnel0/0/0]tunnel-protocol g	
[R3-Tunnel0/0/0]tunnel-protocol gre p2	
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic 

然后是R5

[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip add 172.16.6.5 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R5-Tunnel0/0/0]source s4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register 

因为中心站点都是同一台

所以注册的代码一致

[R5-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register 

R6

[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0]ip add 172.16.6.6 24
[R6-Tunnel0/0/0]tu	
[R6-Tunnel0/0/0]tunnel-protocol g	
[R6-Tunnel0/0/0]tunnel-protocol gre p	
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R6-Tunnel0/0/0]so	
[R6-Tunnel0/0/0]source s4/0/0
Apr 16 2024 19:57:30-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R6-Tunnel0/0/0]
[R6-Tunnel0/0/0]nh	
[R6-Tunnel0/0/0]nhrp n	
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register 

R7

[R7]int Tunnel 0/0/0
[R7-Tunnel0/0/0]ip add 172.16.6.7 24
[R7-Tunnel0/0/0]tu	
[R7-Tunnel0/0/0]tunnel-protocol g	
[R7-Tunnel0/0/0]tunnel-protocol gre p	
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R7-Tunnel0/0/0]sou	
[R7-Tunnel0/0/0]source g0/0/0
Apr 16 2024 19:58:42-08:00 R7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R7-Tunnel0/0/0]nh	
[R7-Tunnel0/0/0]nhrp n	
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.6.3 34.0.0.3 register

起路由协议

更改类型

R3

[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255

R6

[R6]ospf 1
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255

R5

[R5]ospf 1
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255

R7

[R7]ospf 1
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]ne 172.16.6.0 0.0.0.255

选举权可能混乱,需要更改隧道类型

R3

[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf n	
[R3-Tunnel0/0/0]ospf network-type b	
[R3-Tunnel0/0/0]ospf network-type broadcast 

 R5

[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]os	
[R5-Tunnel0/0/0]ospf n	
[R5-Tunnel0/0/0]ospf network-type b	
[R5-Tunnel0/0/0]ospf network-type broadcast 

R6

[R6-Tunnel0/0/0]ospf n	
[R6-Tunnel0/0/0]ospf network-type b	
[R6-Tunnel0/0/0]ospf network-type broadcast 

R7

[R7]int t0/0/0
[R7-Tunnel0/0/0]osp	
[R7-Tunnel0/0/0]ospf n	
[R7-Tunnel0/0/0]ospf network-type b	
[R7-Tunnel0/0/0]ospf network-type broadcast 

第二个问题,DR,BDR选举权

取消分支站点的选举权

[R5-Tunnel0/0/0]ospf dr-priority 0

[R6-Tunnel0/0/0]ospf dr-priority 0

[R7-Tunnel0/0/0]ospf dr-priority 0

查看路由器1是否学到其他路段的路由信息

R9引入路由信息

[R9-ospf-1]im	
[R9-ospf-1]import-route os	
[R9-ospf-1]import-route ospf 12
[R9-ospf-1]import-route ospf 2
[R9-ospf-1]os	
[R9-ospf-1]q
[R9]osp	
[R9]ospf 2
[R9-ospf-2]im	
[R9-ospf-2]import-route o	
[R9-ospf-2]import-route ospf 1

4.所有设备均可访问R4的环回

easy ip

R3

[R3]acl 2000
[R3-acl-basic-2000]ru	
[R3-acl-basic-2000]rule p	
[R3-acl-basic-2000]rule permit s	
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]q
[R3]int s	
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat	
[R3-Serial4/0/0]nat o	
[R3-Serial4/0/0]nat outbound 2000
[R5]acl 2000
[R5-acl-basic-2000]ru	
[R5-acl-basic-2000]rule p	
[R5-acl-basic-2000]rule permit s	
[R5-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R5-acl-basic-2000]q
[R5]na	
[R5]int s4/0/0
[R5-Serial4/0/0]nat	
[R5-Serial4/0/0]nat o	
[R5-Serial4/0/0]nat outbound 2000
[R5-Serial4/0/0]q
[R7-acl-basic-2000]q
[R7]int g0/0/0
[R7-GigabitEthernet0/0/0]nat	
[R7-GigabitEthernet0/0/0]nat o	
[R7-GigabitEthernet0/0/0]nat outbound 2000
[R7-GigabitEthernet0/0/0]rule permit source 172.16.0.0 0.0.255.255
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]int s4/0/0
[R6-Serial4/0/0]nat o	
[R6-Serial4/0/0]nat outbound 2000

减少LSA更新量,加快收敛,保障更新安全

路由聚合:ABR聚合

区域1的聚合

[R3]ospf 1
[R3-ospf-1]a 1
[R3-ospf-1-area-0.0.0.1]ab	
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0

R5只有一个地址不用聚合

R6

[R6]osp	
[R6]ospf 1
[R6-ospf-1]a 2
[R6-ospf-1-area-0.0.0.2]abr	
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0

R7

[R7]ospf 1
[R7-ospf-1]a 3
[R7-ospf-1-area-0.0.0.3]ab	
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0

asbr聚合

R12:

[R12]osp	
[R12]ospf 1
[R12-ospf-1]as	
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0

R9:

[R9]OSP	
[R9]ospf 1
[R9-ospf-1]as	
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0

查看R2的路由信息表是否变化

R5的路由表也发生了变化

 做区域验证看是否能进行网通

[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456

[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456

[R5-ospf-1-area-0.0.0.0] authentication-mode md5 1 cipher 123456

[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456

[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456

[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456

[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R9-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123456

[R10-ospf-2-area-0.0.0.4]authentication-mode md5 1 cipher 123456

[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456

[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456

 

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值