配置IP地址
配置左边区域的ospf路由
[R1]ospf 10 router-id 1.1.1.1
[R1-ospf-10]area 0
[R1-ospf-10-area-0.0.0.0]network 123.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R2]ospf 10 router-id 2.2.2.2
[R2-ospf-10]area 0
[R2-ospf-10-area-0.0.0.0]network 123.1.1.20.0.0.0
[R2-ospf-10-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R3]ospf 10 router-id 3.3.3.3
[R3-ospf-10]area 0
[R3-ospf-10-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-10-area-0.0.0.0]network 123.1.1.3 0.0.0.0
配置缺省指向ISP:[R3]IP route-static 0.0.0.0 0 34.0.0.2
实现私网可以上网,需要在边界设备做一个nat:
[R3]acl 2000
[R3-acl-basic-2000]rule permit source any
[R3-acl-basic-2000]int g 0/0/1
[R3-GigabitEthernet0/0/1]nat outbound 2000
搭建MGRE隧道
[R6-Tunnel0/0/0]ip add 10.0.0.6 24
[R6-Tunnel0/0/0]tunnel-protocol gre p2mp
[R6-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R6-Tunnel0/0/0]nhrp entry multicast dynamic
[R8-Tunnel0/0/0]ip add 10.0.0.8 24
[R8-Tunnel0/0/0]tunnel-protocol gre p2mp
[R8-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R8-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.1 register
[R10-Tunnel0/0/0]ip add 10.0.0.10 24
[R10-Tunnel0/0/0]tunnel-protocol gre p2mp
[R10-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R10-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.1 register
[R12-Tunnel0/0/0]ip add 10.0.0.12 24
[R12-Tunnel0/0/0]tunnel-protocol gre p2mp
[R12-Tunnel0/0/0]source GigabitEthernet 0/0/0
[R12-Tunnel0/0/0]nhrp entry 10.0.0.6 67.0.0.1 register
配置MGRE环境中的静态路由
[R6]ip route-static 78.0.0.0 24 67.0.0.2
[R6]ip route-static 117.0.0.0 24 67.0.0.2
[R6]ip route-static 107.0.0.0 24 67.0.0.2
[R8]ip route-static 67.0.0.0 24 78.0.0.1
[R8]ip route-static 107.0.0.0 24 78.0.0.1
[R8]ip route-static 117.0.0.0 24 78.0.0.1
[R10]ip route-static 67.0.0.0 24 107.0.0.1
[R10]ip route-static 117.0.0.0 24 107.0.0.1
[R10]ip route-static 78.0.0.0 24 107.0.0.1
[R12]ip route-static 67.0.0.0 24 117.0.0.1
[R12]ip route-static 78.0.0.0 24 117.0.0.1
[R12]ip route-static 107.0.0.0 24 117.0.0.1
查看R6的注册表信息
启动右边区域的ospf协议
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 56.0.0.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 56.0.0.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 10.0.0.6 0.0.0.0
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 0
[R8-ospf-1-area-0.0.0.0]network 89.0.0.1 0.0.0.0
[R8-ospf-1-area-0.0.0.0]network 8.8.8.8 0.0.0.0
[R8-ospf-1-area-0.0.0.0]network 10.0.0.8 0.0.0.0
[R9]ospf 1 router-id 9.9.9.9
[R9-ospf-1]area 0
[R9-ospf-1-area-0.0.0.0]network 89.0.0.2 0.0.0.0
[R9-ospf-1-area-0.0.0.0]network 9.9.9.9 0.0.0.0
[R10]ospf 1 router-id 10.10.10.10
[R10-ospf-1]area 0
[R10-ospf-1-area-0.0.0.0]network 110.0.0.1 0.0.0.0
[R10-ospf-1-area-0.0.0.0]network 10.10.10.10 0.0.0.0
[R10-ospf-1-area-0.0.0.0]network 10.0.0.10 0.0.0.0
[R12]ospf 1 router-id 12.12.12.12
[R12-ospf-1]area 0
[R12-ospf-1-area-0.0.0.0]network 112.0.0.1 0.0.0.0
[R12-ospf-1-area-0.0.0.0]network 12.12.12.12 0.0.0.0
[R12-ospf-1-area-0.0.0.0]network 10.0.0.12 0.0.0.0
[R11]ospf 1 router-id 11.11.11.11
[R11-ospf-1]area 0
[R11-ospf-1-area-0.0.0.0]network 110.0.0.2 0.0.0.0
[R11-ospf-1-area-0.0.0.0]network 11.11.11.11 0.0.0.0
[R11-ospf-1]area 1
[R11-ospf-1-area-0.0.0.1]network 114.0.0.1 0.0.0.0
[R14]ospf 1 router-id 14.14.14.14
[R14-ospf-1]area 1
[R14-ospf-1-area-0.0.0.1]network 14.14.14.14 0.0.0.0
[R14-ospf-1-area-0.0.0.1]network 145.0.0.1 0.0.0.0
[R14-ospf-1-area-0.0.0.1]network 114.0.0.2 0.0.0.0
[R15]ospf 1 router-id 15.15.15.15
[R15-ospf-1]area 1
[R15-ospf-1-area-0.0.0.1]network 145.0.0.2 0.0.0.0
[R15-ospf-1-area-0.0.0.1]network 15.15.15.15 0.0.0.0
[R13]ospf 1 router-id 13.13.13.13
[R13-ospf-1]area 0
[R13-ospf-1-area-0.0.0.0]network 112.0.0.2 0.0.0.0
[R13-ospf-1-area-0.0.0.0]network 13.13.13.13 0.0.0.0
[R13-ospf-1]area 2
[R13-ospf-1-area-0.0.0.2]network 136.0.0.1 0.0.0.0
[R16]ospf 1 router-id 16.16.16.16
[R16-ospf-1]area 2
[R16-ospf-1-area-0.0.0.2]network 136.0.0.2 0.0.0.0
[R16-ospf-1-area-0.0.0.2]network 16.16.16.16 0.0.0.0
修改隧道接口类型为p2mp(因为该网络接口类型的hello时间过长,修改hello时间为10s)
[R6-Tunnel0/0/0]ospf network-type p2mp
[R8-Tunnel0/0/0]ospf network-type p2mp
[R10-Tunnel0/0/0]ospf network-type p2mp
[R12-Tunnel0/0/0]ospf network-type p2mp
[R6-Tunnel0/0/0]ospf timer hello 10
[R8-Tunnel0/0/0]ospf timer hello 10
[R10-Tunnel0/0/0]ospf timer hello 10
[R12-Tunnel0/0/0]ospf timer hello 10
查看邻居表
R5下发缺省
[R5-ospf-1]default-route-advertise always
实现私网可以上网,需要在边界设备R5做一个nat:
[R5]acl 2000
[R5-acl-basic-2000]rule permit source any
[R5-acl-basic-2000]int g 0/0/0
[R5-GigabitEthernet0/0/0]nat outbound 2000
模拟上网,使用环回测试:
让ISP两边的区域进行互通:
R3和R5之间做一个GRE隧道
[R3-Tunnel0/0/1]ip add 20.0.0.3 24
[R3-Tunnel0/0/1]tunnel-protocol gre
[R3-Tunnel0/0/1]source 34.0.0.1
[R3-Tunnel0/0/1]destination 45.0.0.2
[R5-Tunnel0/0/1]ip add 20.0.0.5 24
[R5-Tunnel0/0/1]tunnel-protocol gre
[R5-Tunnel0/0/1]source 45.0.0.2
[R5-Tunnel0/0/1]destination 34.0.0.1
再添加静态路由(只写了两个)
[R3]ip route-static 15.15.15.15 32 20.0.0.5
[R3]ip route-static 16.16.16.16 32 20.0.0.5
[R5]ip route-static 123.1.1.0 24 20.0.0.3