要求:
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.全网可达
IP规划
Area 0 172.16.0.0/19
Area 1 172.16.32.0/19
Area 2 172.16.64.0/19
Area 3 172.16.96.0/19
Area 4 172.16.128.0/19
域外 172.16.160.0/19
1.更改设备名称,配置IP地址
R1
<Huawei>system-view
[Huawei]sys
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 172.16.32.1 24
[R1-GigabitEthernet0/0/0]quit
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 172.16.33.1 24
R2
<Huawei>system-view
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 172.16.32.2 24
[R2-GigabitEthernet0/0/0]quit
[[R2]interface LoopBack 0
[R2-LoopBack0]ip address 172.16.34.1 24
R3
<Huawei>system-view
[Huawei]sys
[Huawei]sysname R3
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.32.3 24
[R3-GigabitEthernet0/0/0]quit
[R3]interface Serial 4/0/0
[R3-Serial4/0/0]ip address 34.1.1.1 24
[R3-Serial4/0/0]quit
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 172.16.35.1 24
R4
<Huawei>system-view
[Huawei]sysname R4
[R4]interface Serial 4/0/0
[R4-Serial4/0/0]ip address 34.1.1.2 24
[R4-Serial4/0/0]quit
[R4]interface Serial 3/0/0
[R4-Serial3/0/0]ip address 45.1.1.2 24
[R4-Serial3/0/0]quit
[R4]interface Serial 3/0/1
[R4-Serial3/0/1]ip address 46.1.1.2 24
[[R4-Serial3/0/1]quit
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 47.1.1.2 24
[R4-GigabitEthernet0/0/0]quit
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 4.4.4.4 24
R5
<Huawei>system-view
[Huawei]sys
[Huawei]sysname R5
[R5]interface Serial 4/0/0
[R5-Serial4/0/0]ip address 45.1.1.1 24
[R5-Serial4/0/0]quit
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 172.16.1.1 24
[R5]ip route-static 0.0.0.0 0 45.1.1.2
R6
<Huawei>system-view
[Huawei]sysname R6
[R6]interface Serial 4/0/0
[R6-Serial4/0/0]ip address 46.1.1.1 24
[R6-Serial4/0/0]quit
[R6]interface GigabitEthernet 0/0/0
[R6-GigabitEthernet0/0/0]ip address 172.16.64.1 24
[R6-GigabitEthernet0/0/0]quit
[R6]interface LoopBack 0
[R6-LoopBack0]ip address 172.16.2.1 24
[R6]ip route-static 0.0.0.0 0 46.1.1.2
R7
<Huawei>system-view
[Huawei]sysname R7
[R7]interface GigabitEthernet 0/0/0
[R7-GigabitEthernet0/0/0]ip address 47.1.1.1 24
[R7-GigabitEthernet0/0/0]quit
[R7]interface GigabitEthernet 0/0/1
[R7-GigabitEthernet0/0/1]ip address 172.16.96.1 24
[R7-GigabitEthernet0/0/1]quit
[R7]interface LoopBack 0
[R7-LoopBack0]ip address 172.16.3.1 24
R8
<Huawei>system-view
[Huawei]sysname R8
[R8]interface GigabitEthernet 0/0/0
[R8-GigabitEthernet0/0/0]ip address 172.16.96.2 24
[R8-GigabitEthernet0/0/0]quit
[R8]interface GigabitEthernet 0/0/1
[R8-GigabitEthernet0/0/1]ip address 172.16.98.1 24
[R8-GigabitEthernet0/0/1]quit
[R8]interface LoopBack 0
[R8-LoopBack0]ip address 172.16.97.1 24
R9
<Huawei>system-view
[Huawei]sysname R9
[R9]interface GigabitEthernet 0/0/0
[R9-GigabitEthernet0/0/0]ip address 172.16.98.2 24
[R9-GigabitEthernet0/0/0]quit
[R9]interface GigabitEthernet 0/0/1
[R9-GigabitEthernet0/0/1]ip address 172.16.128.1 24
[R9-GigabitEthernet0/0/1]quit
[R9]interface LoopBack 0
[R9-LoopBack0]ip address 172.16.129.1 24
R10
<Huawei>system-view
[Huawei]sysname R10
[R10]interface GigabitEthernet 0/0/0
[R10-GigabitEthernet0/0/0]ip address 172.16.128.2 24
[R10-GigabitEthernet0/0/0]quit
[R10]interface LoopBack 0
[R10-LoopBack0]ip address 172.16.130.1 24
R11
<Huawei>system-view
[Huawei]sysname R11
[R11]interface GigabitEthernet 0/0/0
[R11-GigabitEthernet0/0/0]ip address 172.16.64.2 24
[R11-GigabitEthernet0/0/0]quit
[R11]interface GigabitEthernet 0/0/1
[R11-GigabitEthernet0/0/1]ip address 172.16.65.1 24
[R11-GigabitEthernet0/0/1]quit
[R11]interface LoopBack 0
[R11-LoopBack0]ip address 172.16.66.1 24
R12
<Huawei>system-view
[Huawei]sysname R12
[R12]interface GigabitEthernet 0/0/0
[R12-GigabitEthernet0/0/0]ip address 172.16.65.2 24
[[R12-GigabitEthernet0/0/0]quit
[R12]interface LoopBack 0
[R12-LoopBack0]ip address 172.16.160.1 20
[R12-LoopBack0]quit
[R12]interface LoopBack 1
[R12-LoopBack1]ip address 172.16.176.1 20
2.R3-R5/6/7为MGRE环境,R3为中心站点
R3
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ip address 172.16.0.129 29
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.1.1.1
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
R5
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]ip address 172.12.0.130 29
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 4/0/0
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp entry 172.16.0.29 34.1.1.1 register
R6
[R6]interface Tunnel 0/0/0
[R6-Tunnel0/0/0]ip address 172.16.0.131 29
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source Serial 4/0/0
[R6-Tunnel0/0/0]nhrp network-id 100
[R6-Tunnel0/0/0]nhrp entry 172.16.0.129 34.1.1.1 register
R7
[R7]interface Tunnel 0/0/0
[R7-Tunnel0/0/0]ip address 172.16.0.132 29
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp
[R7-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp entry 172.16.0.129 34.1.1.1 register
3.Area 0区域写缺省
R3
[R3]ip route-static 0.0.0.0 0 34.1.1.2
R5
[R5]ip route-static 0.0.0.0 0 45.1.1.2
R6
[R6]ip route-static 0.0.0.0 0 46.1.1.2
R7
[R7]ip route-static 0.0.0.0 0 47.1.1.2
4.配置OSPF
Area 0
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.128 0.0.0.7
R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 172.16.0.128 0.0.0.7
[R5-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.255
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 172.16.0.128 0.0.0.7
[R6-ospf-1-area-0.0.0.0]network 172.16.2.0 0.0.0.255
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 172.16.0.128 0.0.0.7
[R7-ospf-1-area-0.0.0.0]network 172.16.3.0 0.0.0.255
更改网络类型,让中心点R3为DR,不要BDR
MGRE默认的网络类型是P2P,不能发送组播,而OSPF是以组播的形式传递信息,所以将网络类型改为broadcast ,将R5 R6 R7的DR优先级改为0
R3
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
R5
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
[R5-Tunnel0/0/0]ospf dr-priority 0
R6
[R6]interface Tunnel 0/0/0
[R6-Tunnel0/0/0]ospf network-type broadcast
[R6-Tunnel0/0/0]ospf dr-priority 0
R7
[R7]interface Tunnel 0/0/0
[R7-Tunnel0/0/0]ospf network-type broadcast
[R7-Tunnel0/0/0]ospf dr-priority 0
Area 1
R1
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.0.255
Area 2
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.0.255
R11
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]network 172.16.64.0 0.0.0.255
[R11-ospf-1-area-0.0.0.2]network 172.16.66.0 0.0.0.255
R12
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]network 172.16.65.0 0.0.0.255
Area 3
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.0.255
R8
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]network 172.16.97.0 0.0.0.255
[R8-ospf-1-area-0.0.0.3]network 172.16.96.0 0.0.0.255
[R8-ospf-1-area-0.0.0.3]network 172.16.98.0 0.0.0.255
R9
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]network 172.16.98.0 0.0.0.255
Area 4
R9
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.0.255
[R9-ospf-1-area-0.0.0.4]network 172.16.129.0 0.0.0.255
[R9-ospf-1-area-0.0.0.4]network 172.16.130.0 0.0.0.255
R10
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]area 4
[R10-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.0.255
[R10-ospf-1-area-0.0.0.4]network 172.16.130.0 0.0.0.255
[R10-ospf-1-area-0.0.0.4]network 172.16.129.0 0.0.0.255
5.域外区域配置
R12
[R12]rip 1
[R12-rip-1]version 2
[R12-rip-1]network 172.16.0.0
6.Area 0 配置NAT网络地址转换
R3
[R3]acl 2000
[R3-acl-basic-2000]rule 1 permit source any
[R3-acl-basic-2000]quit
[R3]interface Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000
R6
[R6]acl 2000
[R6-acl-basic-2000]rule 1 permit source any
[R6-acl-basic-2000]quit
[R6]interface Serial 4/0/0
[R6-Serial4/0/0]nat outbound 2000
R7
[R7]acl 2000
[R7-acl-basic-2000]rule 1 permit source any
[R7-acl-basic-2000]quit
[R7]interface GigabitEthernet 0/0/0
[R7-GigabitEthernet 0/0/0]nat outbound 2000
7.不规则区域重发布
R9
[R9]ospf 1
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]undo network 172.16.128.0 0.0.0.255
[R9-ospf-1-area-0.0.0.4]undo network 172.16.129.0 0.0.0.255
[R9-ospf-1-area-0.0.0.4]undo network 172.16.130.0 0.0.0.255
(不规则区域重发布,让Area 4的LSA到OSPF进程2)
创建OSPF 2
[R9]ospf 2
[R9-ospf-2]area 4
[R9-ospf-2-area-0.0.0.4]network 172.16.128.0 0.0.0.255
[R9-ospf-2-area-0.0.0.4]network 172.16.129.0 0.0.0.255
[R9-ospf-2-area-0.0.0.4]network 172.16.130.0 0.0.0.255
双向重发布
[R9]ospf 1
[R9-ospf-1]import-route ospf 2
[R9]ospf 2
[R9-ospf-2]import-route ospf 1
R12
RIP重发布到OSPF 1
[R12]ospf 1
[R12-ospf-1]import-route rip
8.制作特殊区域(非骨干),减少LSA的更新量
Area 1
目前LSA
制作完全末梢区域(Totally Stub),R1 R2三类(R3的除外)四类五类LSA都不学,R3默认下发缺省
R1
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub
R2
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub
R3
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
此时的LSA
R3下发缺省
Area 2
目前LSA
完全的非完全未梢区域 (Totally NSSA)通过七类LSA发送到ABR转换成5类LSA,R6默认下发缺省
R6
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
R11
[R11]ospf 1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]nssa
R12
[R12]ospf 1
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]nssa
此时的LSA
R6下发缺省
Area 3
此时的LSA
完全的非完全未梢区域 (Totally NSSA),将区域 Area 4 以7类LSA传递通过ABR转换为五类LSA,R7下发取省
R7
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
R8
[R8]ospf 1
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa
R9
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa
此时的LSA
R7下发缺省
此时R10只有Area 3 的路由
在Area 3成为完全的非完全未梢区域 (Totally NSSA)之前,有其它区域的路由,Area 4 通过双向重发布到OSPF 1,Area 3成为完全的非完全未梢区域 (Totally NSSA)没有了其它区域路由,Area 4 也就没有了其他区域的路由
重发布不发送缺省,所以需要R9下发缺省,在OSPF 2 中删除单向的重发布,并下发缺省
R9
[R9-ospf-2]undo import-route ospf 1
[R9-ospf-2]default-route-advertise
不要其它区域路由,只要有缺省就能通
9.骨干区域汇总,减少LSA的更新量
此时的LSA
R3
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
R6
[R6]ospf 1
[R6-ospf-1]area 2
[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]area 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
空接口防环
[R3]ip route-static 172.16.32.0 19 NULL 0
[R6]ip route-static 172.16.64.0 19 NULL 0
[R7]ip route-static 172.16.96.0 19 NULL 0
此时的LSA
10.加快收敛,改变更新时间(默认10s这里可以不用写)
R3
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf timer hello 10
R5
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf timer hello 10
R6
[R6]interface Tunnel 0/0/0
[R6-Tunnel0/0/0]ospf timer hello 10
R7
[R7]interface Tunnel 0/0/0
[R7-Tunnel0/0/0]ospf timer hello 10
11.保障更新安全,OSPF协议加密
R1
[R1]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
R2
[R2]ospf 1
[R2-ospf-1]area 1
[r2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
R3
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R3-ospf-1-area-0.0.0.0]quit
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
R5
[R2]ospf 0
[R2-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
R6
[R6]ospf 1
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R6-ospf-1-area-0.0.0.0]quit
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
R7
[R7]ospf 1
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher 123456
[R7-ospf-1-area-0.0.0.0]quit
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
R8
[R8]ospf 1
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
R9
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]authentication-mode md5 1 cipher 123456
[R9-ospf-1-area-0.0.0.3]quit
[R9-ospf-1]area 4
[R9-ospf-1-area-0.0.0.4]authentication-mode md5 1 cipher 123456
R10
[R10]ospf 1
[R10-ospf-1]area 4
[R10-ospf-1-area-0.0.0.4]authentication-mode md5 1 cipher 123456
R11
[R11]ospf 1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
R12
[R12]ospf 1
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]authentication-mode md5 1 cipher 123456
12.测试
R1 ping R4环回
R1 ping R10环回
R5 ping R4环回
R12 ping R4环回
R8 ping R4环回
R10 ping R4环回
全网可达