1.拓扑图
- 要求
- R4为ISP,其上只能配置IP地址;R4与其他所有直连设备间均使用公有IPR3-R5/6/7为 MGRE环境,R3为中小站点:
- 整个OSPF环境IP基于172.16..8/16划分;3
- 所有设备均可访问4的环回:
4.减少LSA的更新量,加快收敛,保障更新安全;全网可达
3.配置命令
R1配置命令
配置接口IP
[R1]interface LoopBack 0
[R1-LoopBack0]ip a 172.16.32.1 24
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip ad 172.16.35.1 29
启动ospf
[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.32.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]network 172.16.35.1 0.0.0.0
R2配置命令
配置接口IP
[R2]int l 0
[R2-LoopBack0]ip ad 172.16.33.1 24
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip ad 172.16.35.2 29
启动OSPF
[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.35.2 0.0.0.0
[R2-ospf-1-area-0.0.0.1]network 172.16.33.1 0.0.0.0
R3配置命令
配置接口IP
[R3-GigabitEthernet0/0/0]ip ad 172.16.35.3 29
[R3]int l 0
[R3-LoopBack0]ip ad 172.16.34.1 24
[R3-Serial3/0/0]ip ad 34.0.0.1 24
启动ospf
[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.34.1 0.0.0.0
[R3-ospf-1-area-0.0.0.1]network 172.16.35.3 0.0.0.0
[R3-Tunnel0/0/0]ospf network-type p2mp
[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.1 0.0.0.0
配置缺省
[R3]ip route-static 0.0.0.0 0 34.0.0.2
设置隧道
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ip ad 172.16.0.1 29
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source 34.0.0.1
[R3-Tunnel0/0/0]nhrp network-id 10
[R3-Tunnel0/0/0]nhrp entry multicast dynamic
[R3-ospf-1]default-route-advertise always
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.32.0 0.0.31.255
[R3-Serial3/0/0]nat outbound 2000
R4配置命令
接口配置
[R4]int s 2/0/0
[R4-Serial2/0/0]ip ad 34.0.0.2 24
[R4]int s2/0/1
[R4-Serial2/0/1]ip ad 45.0.0.2 24
[R4]int s 3/0/0
[R4-Serial3/0/0]ip ad 46.0.0.2 24
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip ad 47.0.0.2 24
[R4]int l 0
[R4-LoopBack0]ip ad 4.4.4.4 24
R5配置命令
接口配置
[R5]int s 3/0/0
[R5-Serial3/0/0]ip ad 45.0.0.1 24
[R5]interface LoopBack 0
[R5-LoopBack0]ip ad 172.16.1.1 24
配置缺省
[R5]ip route-static 0.0.0.0 0 45.0.0.2
设置隧道
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip ad 172.16.0.2 29
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source Serial 3/0/0
[R5-Tunnel0/0/0]nhrp network-id 10
[R5-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.1 register
[R5-Tunnel0/0/0]ospf network-type p2mp
[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.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
R6配置命令
[R6]int s 3/0/0
[R6-Serial3/0/0]ip 46.0.0.1 24
[R6]int l 0
[R6-LoopBack0]ip ad 172.16.2.1 24
[R6]ip route-static 0.0.0.0 0 46.0.0.2
[R6-Tunnel0/0/0]ip ad 172.16.0.3 29
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source Serial 3/0/0
[R6-Tunnel0/0/0]nhrp network-id 10
[R6-Tunnel0/0/0]nhrp entry 172.0.0.1 34.0.0.1 register
[R6-Tunnel0/0/0]ospf network-type p2mp
[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.3 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.2.1 0.0.0.0
[R6-GigabitEthernet0/0/0]ip address 172.16.64.1 29
[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.1 0.0.0.0
[R6-ospf-1]default-route-advertise always
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.64.0 0.0.31.255
[R6-Serial3/0/0]nat outbound 2000
R7配置命令
[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]ip ad 47.0.0.1 24
[R7]int l 0
[R7-LoopBack0]ip ad 172.16.3.1 24
配置缺省
[R7]ip route-static 0.0.0.0 0 47.0.0.2
[R7]int t 0/0/0
[R7-Tunnel0/0/0]ip ad 172.16.0.4 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 10
[R7-Tunnel0/0/0]nhrp entry 172.16.0.1 34.0.0.1 register
[R7-Tunnel0/0/0]ospf network-type p2mp
[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.4 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
R11
[R11]int g 0/0/0
[R11-GigabitEthernet0/0/0]ip ad 172.16.64.2 29
[R11]int l 0
[R11-LoopBack0]ip ad 172.16.65.1 24
[R11]int g 0/0/1
[R11-GigabitEthernet0/0/1]ip ad 172.16.64.9 29
[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.9 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.64.2 0.0.0.0
[R11-ospf-1-area-0.0.0.2]network 172.16.65.1 0.0.0.0
R12
[R12]int g 0/0/0
[R12-GigabitEthernet0/0/0]ip ad 172.16.64.10 29
[R12]int l 1
[R12-LoopBack1]ip ad 172.16.161 20
[R12]int l 2
[R12-LoopBack2]ip ad 172.16.176.1 20
[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.64.10 0.0.0.0
[R12]rip 1
[R12-rip-1]version 2
[R12-rip-1]network 172.16.0.0
[R12-ospf-1]import-route rip 1
区域三;四配置命令同上
区域汇总
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R9-ospf-1] asbr-summary 172.16.128.0 255.255.224.0
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
设置特殊区域
[R3-ospf-1-area-0.0.0.1]stub no-summary
[R2-ospf-1-area-0.0.0.1]stub
[R1-ospf-1-area-0.0.0.1]stub
[R6-ospf-1-area-0.0.0.2]nssa no-import-route
[R11-ospf-1-area-0.0.0.2]nssa
[R12-ospf-1-area-0.0.0.2]nssa
[R9-ospf-1-area-0.0.0.3]nssa
[R8-ospf-1-area-0.0.0.3]nssa
[R7-ospf-1-area-0.0.0.3]nssa no-summary
4.实现