一、实验要求
1,R6为ISP只能配置IP地址,R1-R5的环回为私有网段
2、R1/4/5为全连的MGRE结构,R1/2/3为星型的拓扑结吉构,R1为中心站点
3、所有私有网段可以互相通讯,私有网段夜用OSPF完成。
二、实验分析、配置及结果
写缺省指向ISP
[r1]ip route-static 0.0.0.0 0 16.0.0.2
[r1]ip route-static 0.0.0.0 0 116.0.0.2
[r2]ip route-static 0.0.0.0 0 26.0.0.2
[r3]ip route-static 0.0.0.0 0 36.0.0.2
[r4]ip route-static 0.0.0.0 0 46.0.0.2
[r5]ip route-static 0.0.0.0 0 56.0.0.2
让R1、R4、R5在nhrp为100的域里面作为中心
[r1-Tunnel0/0/0]ip address 192.168.6.1 24-----配置隧道IP地址
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp---选择封装类型
[r1-Tunnel0/0/0]source 16.0.0.1-----定义源IP地址
[r1-Tunnel0/0/0]nhrp network-id 100----创建NHRP域
[r1-Tunnel0/0/0]nhrp entry multicast dynamic---开启伪广播
[r4-Tunnel0/0/0]ip address 192.168.6.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 46.0.0.1
[r4-Tunnel0/0/0]nhrp network-id 100
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r5-Tunnel0/0/0]ip address 192.168.6.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 56.0.0.1
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp entry multicast dynami
因为是全连的MGRE,所以分支要找中心注册
[r1-Tunnel0/0/0]nhrp entry 192.168.6.2 46.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry 192.168.6.3 56.0.0.1 register
[r4-Tunnel0/0/0]nhrp entry 192.168.6.1 16.0.0.1 register
Info: This peer protocol address conflicts with hub register peer protocol addre
ss.
[r4-Tunnel0/0/0]nhrp entry 192.168.6.3 56.0.0.1 register
[r5-Tunnel0/0/0]nhrp entry 192.168.6.1 16.0.0.1 register
Info: This peer protocol address conflicts with hub register peer protocol addre
ss.
[r5-Tunnel0/0/0]nhrp entry 192.168.6.2 46.0.0.1 r
结果:[r1]display nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.6.2 32 46.0.0.1 192.168.6.2 static hub
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:11:31
Expire time : --
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.6.3 32 56.0.0.1 192.168.6.3 static hub
R1为中心站点,R2、R3为分支
[r1-Tunnel0/0/1]ip address 192.168.7.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]nhrp network-id 110
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r3-Tunnel0/0/1]ip address 192.168.7.3 24
[r3-Tunnel0/0/1]tunnel-protocol gre p2mp
[r3-Tunnel0/0/1]nhrp network-id 110
[r3-Tunnel0/0/1]nhrp entry 192.168.7.1 116.0.0.1 register
[r3-Tunnel0/0/1]nhrp entry 192.168.7.1 116.0.0.1 register
[r2-Tunnel0/0/1]ip address 192.168.7.2 24
[r2-Tunnel0/0/1]tunnel-protocol gre p2mp
[r2-Tunnel0/0/1]source GigabitEthernet 0/0/0
[r2-Tunnel0/0/1]nhrp network-id 110
[r2-Tunnel0/0/1]nhrp entry 192.168.7.1 116.0.0.1
[r2-Tunnel0/0/1]nhrp entry 192.168.7.1 116.0.0.1 register
结果:
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.7.2 32 26.0.0.1 192.168.7.2 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/1
Created time : 00:15:17
Expire time : 01:44:43
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.7.3 32 36.0.0.1 192.168.7.3 dynamic route tunnel
进OSPF,宣告私网网段
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
全连的MGRE三个路由器都是中心,所以将每个Tunnel口改为broadcast
[r1-Tunnel0/0/0]ospf network-type broadcast
[r2-Tunnel0/0/0]ospf network-type broadcast
[r3-Tunnel0/0/0]ospf network-type broadcast
结果:
[r1-Tunnel0/0/0]display ospf peer brief
OSPF Process 1 with Router ID 16.0.0.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Tunnel0/0/0 4.4.4.4 Full
0.0.0.0 Tunnel0/0/0 5.5.5.5 Full
0.0.0.0 Tunnel0/0/1 2.2.2.2 Full
结果:
Neighbors
Area 0.0.0.0 interface 192.168.7.1(Tunnel0/0/1)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.7.2
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.7.1 BDR: 192.168.7.2 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 4
Neighbor is up for 00:04:26
Authentication Sequence: [ 0 ]
Router ID: 3.3.3.3 Address: 192.168.7.3
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.7.1 BDR: 192.168.7.3 MTU: 0
Dead timer due in 39 sec
Retrans timer interval: 4
Neighbor is up for 00:03:20
Authentication Sequence: [ 0 ]
[r1]display ip routing-table protocol ospf
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.2.1/32 OSPF 10 1562 D 192.168.7.2 Tunnel0/0/1
192.168.3.1/32 OSPF 10 1562 D 192.168.7.3 Tunnel0/0/1
192.168.4.1/32 OSPF 10 1562 D 192.168.6.2 Tunnel0/0/0
192.168.5.1/32 OSPF 10 1562 D 192.168.6.3 Tunnel0/0/0