手机版 欢迎访问it开发者社区(www.mfbz.cn)网站

当前位置: > 开发

OSPF综合实验

时间:2021/6/1 2:57:15|来源:|点击: 次

1.R4为ISP,其上自能配置IP地址;R4与其他所有直连设备间使用公有IP
2.R3---R5/6/7为MGRE环境,R3为中心站点
3.整个OSPF环境IP地址为172.16.0.0/16
4.所有设备均可访问R4环回;
5.减少LSA的更新量,加快收敛,保障更新安全
6.全网可达

第一步,配置interface地址(包括loopback地址)

R1

<Huawei>display current-configuration interface 
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 172.16.48.1 255.255.255.248 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.32.1 255.255.255.0 
 ospf network-type broadcast
#
return

R2

<Huawei>display current-configuration interface
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 172.16.48.2 255.255.255.248 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.40.1 255.255.255.0 
 ospf network-type broadcast
#
return

R3

<Huawei>display current-configuration interface
[V200R003C00]
#
interface Serial4/0/0
 link-protocol ppp
 ip address 34.1.1.1 255.255.255.0 
#
interface Serial4/0/1
 link-protocol ppp
#
interface GigabitEthernet0/0/0
 ip address 172.16.48.3 255.255.255.248 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.0.1 255.255.255.0 
 ospf network-type broadcast

return

R4

<Huawei>display current-configuration interface 
[V200R003C00]
#
interface Serial3/0/0
 link-protocol ppp
 ip address 34.1.1.2 255.255.255.0 
#
interface Serial3/0/1
 link-protocol ppp
 ip address 45.1.1.2 255.255.255.0 
#
interface Serial4/0/0
 link-protocol ppp
 ip address 46.1.1.2 255.255.255.0 
#
interface Serial4/0/1
 link-protocol ppp
 ip address 47.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 4.4.4.4 255.255.255.255 
#
return

R5

<Huawei>display current-configuration interface
[V200R003C00]
#
interface Serial4/0/0
 link-protocol ppp
 ip address 45.1.1.1 255.255.255.0 
#
interface Serial4/0/1
 link-protocol ppp
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.4.1 255.255.255.0 
 ospf network-type broadcast
#
return

R6

<Huawei>display current-configuration interface 
[V200R003C00]
#
interface Serial4/0/0
 link-protocol ppp
 ip address 46.1.1.1 255.255.255.0
#
interface Serial4/0/1
 link-protocol ppp
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
 ip address 172.16.72.1 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.8.1 255.255.255.0
 ospf network-type broadcast
#
return

R7

<Huawei>display current-configuration interface
[V200R003C00]
#
interface Serial4/0/0
 link-protocol ppp
 ip address 47.1.1.1 255.255.255.0 
#
interface Serial4/0/1
 link-protocol ppp
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
 ip address 172.16.104.1 255.255.255.252 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.12.1 255.255.255.0 
 ospf network-type broadcast
#
return

R8

<Huawei>display current-configuration interface
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 172.16.104.2 255.255.255.252 
#
interface GigabitEthernet0/0/1
 ip address 172.16.104.129 255.255.255.252 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.96.1 255.255.255.0 
 ospf network-type broadcast
#
return

R9

<Huawei>display current-configuration interface
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 172.16.104.130 255.255.255.252 
#
interface GigabitEthernet0/0/1
 ip address 172.16.144.1 255.255.255.252 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.128.1 255.255.255.0 
 ospf network-type broadcast
#
return

R10

<Huawei>display current-configuration interface
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 172.16.144.2 255.255.255.252 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.136.1 255.255.255.0 
#
return

R11

<Huawei>display current-configuration interface 
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 172.16.72.2 255.255.255.252 
#
interface GigabitEthernet0/0/1
 ip address 172.16.72.129 255.255.255.252 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.64.1 255.255.255.0 
 ospf network-type broadcast
#
return

R12

<Huawei>display current-configuration interface
[V200R003C00]
#
interface GigabitEthernet0/0/0
 ip address 172.16.72.130 255.255.255.252 
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 172.16.160.1 255.255.255.0 
#
interface LoopBack1
 ip address 172.16.168.1 255.255.255.0 
#
return

switch不做配置

第二步,处理area0区域

1.配置R3/5/6/7缺省路由条目,指向R4

分别在R3/R5/R6/R7上配置

[Huawei]ip route-static 0.0.0.0 0.0.0.0 34.1.1.2

[Huawei]ip route-static 0.0.0.0 0.0.0.0 45.1.1.2

[Huawei]ip route-static 0.0.0.0 0.0.0.0 46.1.1.2

[Huawei]ip route-static 0.0.0.0 0.0.0.0 47.1.1.2

2.配置Tunnel隧道,为OSPF通过tunnel传递LSA做准备

R3

[Huawei]int Tunnel 0/0/0
[Huawei-Tunnel0/0/0]ip add 172.16.16.1 29 
[Huawei-Tunnel0/0/0]tunnel-protocol gre p2mp    
[Huawei-Tunnel0/0/0]source 34.1.1.1 
[Huawei-Tunnel0/0/0]nhrp network-id 100 
[Huawei-Tunnel0/0/0]nhrp entry multicast dynamic

R5

[Huawei]interface Tunnel 0/0/0
[Huawei-Tunnel0/0/0]ip add 172.16.16.2 29
[Huawei-Tunnel0/0/0]tunnel-protocol gre p2mp 
[Huawei-Tunnel0/0/0]source 45.1.1.1
[Huawei-Tunnel0/0/0]nhrp network-id 100
[Huawei-Tunnel0/0/0]nhrp entry 172.16.16.1 34.1.1.1 register 

R6

[Huawei]interface Tunnel 0/0/0
[Huawei-Tunnel0/0/0]ip add 172.16.16.3 29
[Huawei-Tunnel0/0/0]tunnel-protocol gre p2mp 
[Huawei-Tunnel0/0/0]source 46.1.1.1
[Huawei-Tunnel0/0/0]nhrp network-id 100 
[Huawei-Tunnel0/0/0]nhrp entry 172.16.16.1 34.1.1.1 register 

R7

[Huawei]int Tunnel 0/0/0
[Huawei-Tunnel0/0/0]ip add 172.16.16.4 29
[Huawei-Tunnel0/0/0]tunnel-protocol gre p2mp 
[Huawei-Tunnel0/0/0]source 47.1.1.1
[Huawei-Tunnel0/0/0]nhrp network-id 100
[Huawei-Tunnel0/0/0]nhrp entry 172.16.16.1 34.1.1.1 register 

3.开启OSPF服务,宣告网段

R3

[Huawei]ospf 10 router-id 93.3.3.3
[Huawei-ospf-10]area 0
[Huawei-ospf-10-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[Huawei-ospf-10-area-0.0.0.0]network 172.16.16.1 0.0.0.0

R5

[Huawei]ospf 10 router-id 95.5.5.5
[Huawei-ospf-10]area 0
[Huawei-ospf-10-area-0.0.0.0]network 172.16.16.2 0.0.0.0 
[Huawei-ospf-10-area-0.0.0.0]network 172.16.4.0 0.0.0.255

R6

[Huawei]ospf 10 router-id 96.6.6.6
[Huawei-ospf-10]area 0
[Huawei-ospf-10-area-0.0.0.0]network 172.16.16.3 0.0.0.0
[Huawei-ospf-10-area-0.0.0.0]network 172.16.8.0 0.0.0.255

R7

[Huawei]ospf 10 router-id 97.7.7.7
[Huawei-ospf-10]area 0  
[Huawei-ospf-10-area-0.0.0.0]network 172.16.16.4 0.0.0.0
[Huawei-ospf-10-area-0.0.0.0]network 172.16.12.0 0.0.0.255

4.更改area0中的ospf网络类型

在R3/R5/R6/R7中配置如下

[Huawei]interface Tunnel 0/0/0   
[Huawei-Tunnel0/0/0]ospf network-type p2mp

 第三步,处理area1/area2/area3/area4区域

1.处理area1区域

R1

[Huawei]ospf 10 router-id 91.1.1.1    
[Huawei-ospf-10]area 1
[Huawei-ospf-10-area-0.0.0.1]network 172.16.32.0 0.0.0.255
[Huawei-ospf-10-area-0.0.0.1]network 172.16.48.1 0.0.0.0

R2

[Huawei]ospf 10 router-id 92.2.2.2
[Huawei-ospf-10]area 1
[Huawei-ospf-10-area-0.0.0.1]network 172.16.40.0 0.0.0.255
[Huawei-ospf-10-area-0.0.0.1]network 172.16.48.2 0.0.0.0

R3

[Huawei]ospf 10
[Huawei-ospf-10]area 1
[Huawei-ospf-10-area-0.0.0.1]network 172.16.48.3 0.0.0.0

2.处理area2区域

R6

[Huawei]ospf 10 router-id 96.6.6.6 
[Huawei-ospf-10]area 2
[Huawei-ospf-10-area-0.0.0.2]network 172.16.72.1 0.0.0.0

R11

[Huawei]ospf 10 router-id 101.11.11.11
[Huawei-ospf-10]area 2
[Huawei-ospf-10-area-0.0.0.2]network 172.16.64.0 0.0.0.255
[Huawei-ospf-10-area-0.0.0.2]network 172.16.72.129 0.0.0.0
[Huawei-ospf-10-area-0.0.0.2]network 172.16.72.2 0.0.0.0

R12

[Huawei]ospf 10 router-id 102.12.12.12
[Huawei-ospf-10]area 2
[Huawei-ospf-10-area-0.0.0.2]network 172.16.72.130 0.0.0.0

3.处理area3区域

R7

[Huawei]ospf 10 
[Huawei-ospf-10]area 3
[Huawei-ospf-10-area-0.0.0.3]network 172.16.104.1 0.0.0.0

R8

[Huawei]ospf 10 router-id 98.8.8.8
[Huawei-ospf-10]area 3
[Huawei-ospf-10-area-0.0.0.3]network 172.16.104.2 0.0.0.0
[Huawei-ospf-10-area-0.0.0.3]network 172.16.104.129 0.0.0.0
[Huawei-ospf-10-area-0.0.0.3]network 172.16.96.0 0.0.0.255

R9

[Huawei]ospf 10 router-id 99.9.9.9
[Huawei-ospf-10]area 3
[Huawei-ospf-10-area-0.0.0.3]network 172.16.104.130 0.0.0.0

4.处理area4区域及加快收敛,保障更新安全

不规则区域问题在后面处理

R9

[Huawei]ospf 10 
[Huawei-ospf-10]area 4
[Huawei-ospf-10-area-0.0.0.4]network 172.16.128.0 0.0.0.255
[Huawei-ospf-10-area-0.0.0.4]network 172.16.144.1 0.0.0.0

[Huawei-GigabitEthernet0/0/1]ospf timer hello 5
[Huawei-GigabitEthernet0/0/1]ospf timer dead 15

[Huawei-GigabitEthernet0/0/1]ospf authentication-mode md5 10 cipher huawei123

R10

[Huawei]ospf 10 router-id 100.10.10.10
[Huawei-ospf-10]area 4
[Huawei-ospf-10-area-0.0.0.4]network 172.16.136.0 0.0.0.255
[Huawei-ospf-10-area-0.0.0.4]network 172.16.144.2 0.0.0.0

[Huawei-GigabitEthernet0/0/0]ospf timer hello 5
[Huawei-GigabitEthernet0/0/0]ospf timer dead 15

[Huawei-GigabitEthernet0/0/0]ospf authentication-mode md5 10 cipher huawei123

第四步,汇总减少LSA条目及不规则区域处理

1.解决不规则区域问题

采用双进程重发布处理

[Huawei]ospf 10
[Huawei-ospf-10]area 4
[Huawei-ospf-10-area-0.0.0.4]undo network 172.16.128.0 0.0.0.255
[Huawei-ospf-10-area-0.0.0.4]undo network 172.16.144.1 0.0.0.0
[Huawei-ospf-10-area-0.0.0.4]q
[Huawei-ospf-10]undo area 4
[Huawei-ospf-10]ospf 20
[Huawei-ospf-20]area 4
[Huawei-ospf-20-area-0.0.0.4]network 172.16.128.0 0.0.0.255
[Huawei-ospf-20-area-0.0.0.4]network 172.16.144.1 0.0.0.0
[Huawei-ospf-20-area-0.0.0.4]q
[Huawei-ospf-20]ospf 10
[Huawei-ospf-10]import-route ospf 20

2.路由条目汇总

R3

[Huawei]ospf 10 
[Huawei-ospf-10]area 2 
[Huawei-ospf-10-area-0.0.0.2]abr-summary 172.16.32.0 255.255.224.0

R6

[Huawei]ospf 10 
[Huawei-ospf-10]area 2 
[Huawei-ospf-10-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0

R12

[Huawei]ospf 10  
[Huawei-ospf-10]import-route direct 
[Huawei-ospf-10]asbr-summary 172.16.160.0 255.255.224.0

R7

[Huawei]ospf 10
[Huawei-ospf-10]area 3
[Huawei-ospf-10-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0

R9

[Huawei]ospf 10
[Huawei-ospf-10]asbr-summary 172.16.129.0 255.255.224.0

3.创建特殊区域,减少LSA

R3

[Huawei]ospf 10
[Huawei-ospf-10]area 1
[Huawei-ospf-10-area-0.0.0.1]stub no-summary 

R1 R2

[Huawei]ospf 10 
[Huawei-ospf-10]area 1
[Huawei-ospf-10-area-0.0.0.1]stub 

R6

[Huawei]ospf 10
[Huawei-ospf-10]area 2
[Huawei-ospf-10-area-0.0.0.2]nssa no-summary 

R11 R12

[Huawei]ospf 10
[Huawei-ospf-10]area 2
[Huawei-ospf-10-area-0.0.0.2]nssa

R7

[Huawei]ospf 10
[Huawei-ospf-10]area 3
[Huawei-ospf-10-area-0.0.0.3]nssa no-summary 

R8 R9

[Huawei]ospf 10
[Huawei-ospf-10]area 3
[Huawei-ospf-10-area-0.0.0.3]nssa

R9

解决R10 访问其他路由问题

[Huawei-ospf-20]default-route-advertise 

4.全网可达

配置nat

R3 R5 R6 R7

[Huawei]acl 2000
[Huawei-acl-basic-2000]ru permit source 172.16.0.0 0.0.255.255
[Huawei-acl-basic-2000]in s4/0/0 
[Huawei-Serial4/0/0]nat outbound 2000

Copyright © 2002-2019 某某自媒体运营 版权所有