实验拓扑图
1.划分网段
172.16.0.0/16 6区域
area0 172.16.000 00000.0 /19
1~30
area1 172.16.32.0
33~62
area2 172.16.64.0
65~64
area3 172.16.96.0
97~126
area4 172.16.128.0
129~158
rip 172.16.160.0
161~190
预留:
172.16.192.0
172.16.224.0
2.画图配置IP
3.路由器配置
R1:
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 172.16.1.65 255.255.255.192
#
interface LoopBack0
ip address 172.16.1.1 255.255.255.192
# 启动OSPF宣告所有接口
ospf 1 router-id 1.1.1.1
area 0.0.0.1
network 172.16.1.0 0.0.0.255
R2:
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 172.16.1.66 255.255.255.192
#
interface LoopBack0
ip address 172.16.128.1 255.255.252.0
# 启动OSPF进程宣告所有接口
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 172.16.1.0 0.0.0.255
R3:
# 配置接口IP
interface Serial4/0/0
link-protocol ppp
ip address 34.1.1.1 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/0
ip address 172.16.1.67 255.255.255.192
#
interface LoopBack0
ip address 172.16.1.193 255.255.255.192
# 创建tunnel口,搭建MGRE环境
interface Tunnel0/0/0
ip address 172.16.0.1 255.255.255.192
tunnel-protocol gre p2mp
source 34.1.1.1
ospf network-type p2mp
nhrp entry multicast dynamic
nhrp network-id 100
# 启动OSPF进程
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 172.16.0.0 0.0.0.255
area 0.0.0.1
abr-summary 172.16.1.0 255.255.255.0
network 172.16.1.0 0.0.0.255
stub no-summary
# 缺省路由指向ISP
ip route-static 0.0.0.0 0.0.0.0 34.1.1.2
ip route-static 172.16.1.0 255.255.255.0 null0
R4:
# R4上只配置接口IP
interface Serial2/0/0
link-protocol ppp
ip address 34.1.1.2 255.255.255.0
#
interface Serial2/0/1
link-protocol ppp
ip address 54.1.1.2 255.255.255.0
#
interface Serial3/0/0
link-protocol ppp
ip address 64.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 74.1.1.2 255.255.255.0
#
interface LoopBack0
ip address 8.8.8.8 255.255.255.0
R5:
# 配置接口IP
interface Serial4/0/0
link-protocol ppp
ip address 54.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 172.16.0.65 255.255.255.192
# 创建tunne口,搭建MGRE环境
interface Tunnel0/0/0
ip address 172.16.0.2 255.255.255.192
tunnel-protocol gre p2mp
source Serial4/0/0
ospf network-type p2mp
nhrp network-id 100
nhrp entry 172.16.0.1 34.1.1.1 register
# 启动ospf进程
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 172.16.0.0 0.0.0.255
# 缺省路由和空接口路由
ip route-static 0.0.0.0 0.0.0.0 54.1.1.2
R6:
# 使用acl抓取私网流量
acl number 2000
rule 5 permit source 172.16.0.0 0.0.255.255
# 配置接口IP
interface Serial4/0/0
link-protocol ppp
ip address 64.1.1.1 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/0
ip address 172.16.2.1 255.255.255.192
#
interface LoopBack0
ip address 172.16.0.129 255.255.255.192
# 创建tunne口,搭建MGRE环境
interface Tunnel0/0/0
ip address 172.16.0.3 255.255.255.192
tunnel-protocol gre p2mp
source Serial4/0/0
ospf network-type p2mp
nhrp network-id 100
nhrp entry 172.16.0.1 34.1.1.1 register
# 启动OSPF进程
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 172.16.0.0 0.0.0.255
area 0.0.0.2
abr-summary 172.16.2.0 255.255.255.0
network 172.16.2.0 0.0.0.255
nssa no-summary
# 缺省路由和空接口路由
ip route-static 0.0.0.0 0.0.0.0 64.1.1.2
ip route-static 172.16.2.0 255.255.255.0 null0
R7:
# 使用acl抓取私网流量
acl number 2000
rule 5 permit source 172.16.0.0 0.0.255.255
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 74.1.1.1 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 172.16.3.1 255.255.255.192
#
interface LoopBack0
ip address 172.16.0.193 255.255.255.192
#配置接口IP
interface Tunnel0/0/0
ip address 172.16.0.4 255.255.255.192
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf network-type p2mp
nhrp network-id 100
nhrp entry 172.16.0.1 34.1.1.1 register
# 启动OSPF进程
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 172.16.0.0 0.0.0.255
area 0.0.0.3
abr-summary 172.16.3.0 255.255.255.0
network 172.16.3.0 0.0.0.255
nssa no-summary
# 缺省路由和空接口路由
ip route-static 0.0.0.0 0.0.0.0 74.1.1.2
ip route-static 172.16.3.0 255.255.255.0 null0
R8:
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 172.16.3.2 255.255.255.192
#
interface GigabitEthernet0/0/1
ip address 172.16.3.129 255.255.255.192
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 172.16.3.65 255.255.255.192
# 启动OSPF进程
ospf 1 router-id 8.8.8.8
area 0.0.0.3
network 172.16.3.0 0.0.0.255
R9:
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 172.16.3.130 255.255.255.192
#
interface GigabitEthernet0/0/1
ip address 172.16.4.65 255.255.255.192
#
interface LoopBack0
ip address 172.16.4.1 255.255.255.192
# 启动OSPF进程1
ospf 1 router-id 9.9.9.9
asbr-summary 172.16.4.0 255.255.255.0
import-route ospf 2
area 0.0.0.3
network 172.16.3.0 0.0.0.255
nssa --- 配置该区域为NSSA
# 启动OSPF进程2
ospf 2 router-id 9.9.9.9
asbr-summary 0.0.0.0 0.0.0.0
import-route ospf 1
area 0.0.0.4
network 172.16.4.0 0.0.0.255
R10:
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 172.16.4.66 255.255.255.192
#
interface LoopBack0
ip address 172.16.4.129 255.255.255.192
# 启动OSPF进程
ospf 1 router-id 10.10.10.10
area 0.0.0.4
network 172.16.4.0 0.0.0.255
R11:
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 172.16.2.2 255.255.255.192
#
interface GigabitEthernet0/0/1
ip address 172.16.2.129 255.255.255.192
#
interface LoopBack0
ip address 172.16.2.65 255.255.255.192
# 启动OSPF进程
ospf 1 router-id 11.11.11.11
area 0.0.0.2
network 172.16.2.0 0.0.0.255
R12:
# 配置接口IP
interface GigabitEthernet0/0/0
ip address 172.16.2.130 255.255.255.192
#
interface LoopBack1
ip address 172.16.128.1 255.255.255.0
#
interface LoopBack2
ip address 172.16.129.1 255.255.255.0
# 启动OSPF进程
ospf 1 router-id 12.12.12.12
asbr-summary 172.16.128.0 255.255.192.0
import-route rip 1
area 0.0.0.2
network 172.16.2.0 0.0.0.255
nssa
# 启动RIP
rip 1
undo summary
version 2
network 172.16.0.0
import-route ospf 1
4.测试
[R12]ping 172.16.1.1
PING 172.16.1.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.1: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 172.16.1.1: bytes=56 Sequence=2 ttl=255 time=50 ms
Reply from 172.16.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 172.16.1.1: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 172.16.1.1: bytes=56 Sequence=5 ttl=255 time=50 ms