实验需求
实验拓扑与与IP规划
MGRE结构
实验分析
R1,R2,R3为星型拓扑结构,R1为中心点,R2,R3为分支点需要向R1进行注册。
R1,R4,R5为全连拓扑结构,R1,R4,R5都为中心配置点需要相互注册。
MGRE:多路VPN技术,属于NBMA网络,MGRE环境为NBMA环境,再NBMA环境不支持广播,洪范机制;若需要进行广播消息转发,可以借鉴为广播规则,向该网段所有节点进行单播转发。
R1的tunnel0/0/0口用于走星型MGRE环境。
R1的tunnel0/0/1用于走全连网状MGRE环境。
配置内容
R1
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.1 255.255.255.0
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 16.1.1.1 255.255.255.0
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip address 16.1.2.1 255.255.255.0
[r1]interface Tunnel 0/0/0 //星型MGRE环境
[r1-Tunnel0/0/0]ip address 192.168.6.1 255.255.255.0
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.1.1.1
[r1-Tunnel0/0/0]ospf network-type broadcast //更改tunnel口的链路类型
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp network-id 100
[r1]interface Tunnel 0/0/1 //全连网状MGRE环境
[r1-Tunnel0/0/1]
[r1-Tunnel0/0/1]ip address 192.168.7.1 255.255.255.0
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 16.1.2.1
[r1-Tunnel0/0/1]ospf network-type broadcast //更改tunnel口的链路类型
[r1-Tunnel0/0/1]ospf dr-priority 2 //更改DR/BDR选举
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r1-Tunnel0/0/1]nhrp network-id 200
[r1-Tunnel0/0/1]nhrp entry 192.168.7.2 46.1.1.1 register
[r1-Tunnel0/0/1]nhrp entry 192.168.7.3 56.1.1.1 register
[r1]ospf //宣告两个tunnel口与环回
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.6.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.7.1 0.0.0.0
[r1]ip route-static 0.0.0.0 0.0.0.0 16.1.1.2 //缺省路由
[r1]ip route-static 0.0.0.0 0.0.0.0 16.1.2.2
R2
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.2.1 255.255.255.0
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 26.1.1.1 255.255.255.0
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip address 192.168.6.2 255.255.255.0
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source GigabitEthernet0/0/0
[r2-Tunnel0/0/0]ospf network-type broadcast
[r2-Tunnel0/0/0]ospf dr-priority 0 //取消OSPF的DR/BDR的选举
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 192.168.6.1 16.1.1.1 register
[r2]ospf
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.6.2 0.0.0.0
[r2]ip route-static 0.0.0.0 0.0.0.0 26.1.1.2
R3
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.3.1 255.255.255.0
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 36.1.1.1 255.255.255.0
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 192.168.6.3 255.255.255.0
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source GigabitEthernet0/0/0
[r3-Tunnel0/0/0]ospf network-type broadcast
[r3-Tunnel0/0/0]ospf dr-priority 0
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 192.168.6.1 16.1.1.1 register
[r3]ospf
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0] network 192.168.3.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0] network 192.168.6.3 0.0.0.0
[r3]ip route-static 0.0.0.0 0.0.0.0 36.1.1.2
R4
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.4.1 255.255.255.0
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip address 46.1.1.1 255.255.255.0
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.7.2 255.255.255.0
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 46.1.1.1
[r4-Tunnel0/0/0]ospf network-type broadcast
[r4-Tunnel0/0/0]ospf dr-priority 2
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r4-Tunnel0/0/0]nhrp network-id 200
[r4-Tunnel0/0/0]nhrp entry 192.168.7.1 16.1.2.1 register
[r4-Tunnel0/0/0]nhrp entry 192.168.7.3 56.1.1.1 register
[r4]ospf
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 192.168.7.2 0.0.0.0
[r4]ip route-static 0.0.0.0 0.0.0.0 46.1.1.2
R5
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.5.1 255.255.255.0
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip address 56.1.1.1 255.255.255.0
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ip address 192.168.7.3 255.255.255.0
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 56.1.1.1
[r5-Tunnel0/0/0]ospf network-type broadcast
[r5-Tunnel0/0/0]ospf dr-priority 0
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
[r5]ospf
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 192.168.5.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 192.168.7.3 0.0.0.0
[r5]ip route-static 0.0.0.0 0.0.0.0 56.1.1.2
ISP
[isp]interface LoopBack 0
[isp-LoopBack0]ip address 4.4.4.4 255.255.255.0
[isp]interface g0/0/0
[isp-GigabitEthernet0/0/0]ip address 16.1.1.2 255.255.255.0
[isp]interface g0/0/1
[isp-GigabitEthernet0/0/1]ip address 16.1.2.2 255.255.255.0
[isp]interface g0/0/2
[isp-GigabitEthernet0/0/2]ip address 26.1.1.2 255.255.255.0
[isp]interface g2/0/0
[isp-GigabitEthernet2/0/0]ip address 36.1.1.2 255.255.255.0
[isp]interface g3/0/0
[isp-GigabitEthernet3/0/0]ip address 46.1.1.2 255.255.255.0
[isp]interface g4/0/0
[isp-GigabitEthernet4/0/0]ip address 56.1.1.2 255.255.255.0
实验结果