一,实验要求
1、R4为ISP,所连接的所有物理接口为公有网段,任意指定ip即可
2、R1-2-3构建一个星型结构的MGRE结构,其中R1为中心点,假设R1的公有ip为固定地址
3、R1-5-6构建另一个全连网状的MGRE网络,其中R1/5均为中心区域;
4、使用OSPF实现整个私有网络的互通,同时所有pc可以正常访问R4的环回
二,实验分析
1、因为有ISP,内网与公网相互访问需要进行地址转换
2、星型结构是中心-站点
3、R1 R5 有公网地址所以MGRE为全网状结构
三,配置过程
1、R1
配置IP地址
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 41.1.1.1 24
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip add 14.1.1.1 24
[r1-GigabitEthernet0/0/1]int g 0/0/2
[r1-GigabitEthernet0/0/2]ip add 192.168.1.1 24
[r1]ip route-static 0.0.0.0 0 14.1.1.4
[r1]ip route-static 0.0.0.0 0 41.1.1.4
建立中心到站点MGRE结构
[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 14.1.1.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp network-id 100
建立全网状MGRE
[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]ip add 11.1.1.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source g 0/0/0
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r1-Tunnel0/0/1]nhrp network-id 200
[r1-Tunnel0/0/1]nhrp entry 11.1.1.2 54.1.1.5 register
[r1-Tunnel0/0/1]nhrp entry 11.1.1.3 64.1.1.6 register
建立OSPF
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[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 10.1.1.0 0.0.0.255
[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]ospf network-type broadcast
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 1
[r1-ospf-1-area-0.0.0.1]network 11.1.1.0 0.0.0.255
[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]ospf network-type broadcast
[r1]acl 2000
[r1-acl-basic-2000]rule permit source any
[r1-acl-basic-2000]q
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]nat outbound 2000
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]nat outbound 2000
2、R2
配置IP地址
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 24.1.1.2 24
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.2.1 24
[r2]ip route-static 0.0.0.0 0 24.1.1.4
建立中心到站点MGRE结构
[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]ip add 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source g0/0/0
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 14.1.1.1 register
[r2-Tunnel0/0/0]nhrp network-id 100
建立OSPF
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-Tunnel0/0/0]ospf network-type broadcast
[r2-Tunnel0/0/0]ospf dr-priority 0
[r2]acl 2000
[r2-acl-basic-2000]rule permit source any
[r2-acl-basic-2000]q
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]nat outbound 2000
3、R3
配置IP地址
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 34.1.1.3 24
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 192.168.3.1 24
[r3]ip route-static 0.0.0.0 0 34.1.1.4
建立中心到站点MGRE结构
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source g 0/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 14.1.1.1 register
[r3-Tunnel0/0/0]nh network-id 100
建立OSPF
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3-Tunnel0/0/0]ospf network-type broadcast
[r3-Tunnel0/0/0]ospf dr-priority 0
[r3]acl 2000
[r3-acl-basic-2000]rule permit source any
[r3-acl-basic-2000]q
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]nat outbound 2000
4、R4
配置IP地址
[ISP]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 41.1.1.4 24
[ISP-GigabitEthernet0/0/0]int g 0/0/1
[ISP-GigabitEthernet0/0/1]ip add 24.1.1.4 24
[ISP-GigabitEthernet0/0/1]int g 0/0/2
[ISP-GigabitEthernet0/0/2]ip add 34.1.1.4 24
[ISP-GigabitEthernet0/0/2]int g 4/0/2
[ISP-GigabitEthernet4/0/2]ip add 14.1.1.4 24
[ISP-GigabitEthernet4/0/2]int g 4/0/0
[ISP-GigabitEthernet4/0/0]ip add 64.1.1.4 24
[ISP-GigabitEthernet4/0/0]int g 4/0/1
[ISP-GigabitEthernet4/0/1]ip add 54.1.1.4 24
[ISP]int l0
[ISP-LoopBack0]ip add 4.4.4.4 24
建立全网状MGRE
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ip add 11.1.1.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source g 0/0/0
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
[r5-Tunnel0/0/0]nhrp network-id 200
[r5-Tunnel0/0/0]nhrp entry 11.1.1.1 41.1.1.1 register
[r5-Tunnel0/0/0]nhrp entry 11.1.1.3 64.1.1.6 register
建立OSPF
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.4.0 0.0.0.255
[r5-ospf-1-area-0.0.0.1]network 11.1.1.0 0.0.0.255
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcast
[r5]acl 2000
[r5-acl-basic-2000]rule permit source any
[r5-acl-basic-2000]q
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]nat outbound 2000
5、R5
配置IP地址
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 54.1.1.5 24
[r5-GigabitEthernet0/0/0]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.4.1 24
[r5]ip route-static 0.0.0.0 0 54.1.1.4
建立全网状MGRE
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ip add 11.1.1.2 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source g 0/0/0
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
[r5-Tunnel0/0/0]nhrp network-id 200
[r5-Tunnel0/0/0]nhrp entry 11.1.1.1 41.1.1.1 register
[r5-Tunnel0/0/0]nhrp entry 11.1.1.3 64.1.1.6 register
建立OSPF
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.4.0 0.0.0.255
[r5-ospf-1-area-0.0.0.1]network 11.1.1.0 0.0.0.255
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcast
[r5]acl 2000
[r5-acl-basic-2000]rule permit source any
[r5-acl-basic-2000]q
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]nat outbound 2000
6、R6
配置IP地址
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 64.1.1.6 24
[r6-GigabitEthernet0/0/0]int g 0/0/1
[r6-GigabitEthernet0/0/1]ip add 192.168.5.1 24
[r6]ip route-static 0.0.0.0 0 64.1.1.4
建立全网状MGRE
[r6]int Tunnel 0/0/0
[r6-Tunnel0/0/0]ip add 11.1.1.3 24
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source g 0/0/0
[r6-Tunnel0/0/0]nhrp entry multicast dynamic
[r6-Tunnel0/0/0]nhrp network-id 200
[r6-Tunnel0/0/0]nhrp entry 11.1.1.1 41.1.1.1 register
[r6-Tunnel0/0/0]nhrp entry 11.1.1.2 54.1.1.5 register
建立OSPF
在这里插入代码片[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 1
[r6-ospf-1-area-0.0.0.1]network 11.1.1.0 0.0.0.255
[r6-ospf-1-area-0.0.0.1]network 192.168.5.0 0.0.0.255
[r6]int Tunnel 0/0/0
[r6-Tunnel0/0/0]ospf network-type broadcast
[r6]acl 2000
[r6-acl-basic-2000]rule permit source any
[r6-acl-basic-2000]q
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]nat outbound 2000
测试
访问R4的环回