一、实验拓扑:
二、实验要求:
1、R6为ISP只能配置IP地址,R1-5的环回为私有网段;
2、R1/4/5为全连的MGRE结构,R1/2/3为星型的拓扑结构,R1为中心站点;
3、所有私有网段可以互相通讯,私有网段使用OSPF协议完成;
三、实验配置:
R1:
//IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int l0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 16.1.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 16.1.2.1 24
//缺省路由配置
[R1-GigabitEthernet0/0/1]q
[R1]ip route-static 0.0.0.0 0 16.1.1.2
[R1]ip route-static 0.0.0.0 0 16.1.2.2
//NAT配置
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 1.1.1.0 0.0.0.255
[R1-acl-basic-2000]int g0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000
//MGRE配置
//全连网状
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 16.1.1.1
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R1-Tunnel0/0/0]nhrp network-id 100
[R1-Tunnel0/0/0]
//星型拓扑
[R1]int Tunnel 0/0/1
[R1-Tunnel0/0/1]ip add 192.168.2.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
[R1-Tunnel0/0/1]source 16.1.2.1
[R1-Tunnel0/0/1]nhrp entry multicast dynamic
[R1-Tunnel0/0/1]nhrp network-id 101
//OSPF配置
//全连网状
[R1]ospf 1 router-id 7.7.7.7
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255
[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]q
[R1-ospf-1]q
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]ospf network-type broadcast
//星型拓扑
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]q
[R1-ospf-1]q
[R1]int tu 0/0/1
[R1-Tunnel0/0/1]ospf network-type broadcast
[R1-Tunnel0/0/1]
R2:
//IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]int l0
[R2-LoopBack0]ip add 2.2.2.2 24
[R2-LoopBack0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 26.1.1.1 24
//缺省路由配置
[R2]ip route-static 0.0.0.0 0 26.1.1.2
//NAT配置
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 2.2.2.0 0.0.0.255
[R2-acl-basic-2000]int g0/0/0
[R2-GigabitEthernet0/0/0]nat outbound 2000
//MGRE配置
[R2]int tu 0/0/0
[R2-Tunnel0/0/0]ip add 192.168.2.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source g0/0/0
[R2-Tunnel0/0/0]nhrp entry 192.168.2.1 16.1.2.1 register
[R2-Tunnel0/0/0]nhrp network-id 101
[R2-Tunnel0/0/0]q
//OSPF配置
[R2]ospf 1 router-id 10.10.10.10
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 2.2.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]q
[R2-ospf-1]q
[R2]int tu 0/0/0
[R2-Tunnel0/0/0]ospf network-type broadcast
[R2-Tunnel0/0/0]ospf dr-priority 0
[R2-Tunnel0/0/0]
R3:
//IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]int l0
[R3-LoopBack0]ip add 3.3.3.3 24
[R3-LoopBack0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 36.1.1.1 24
//缺省路由配置
[R3]ip route-static 0.0.0.0 0 36.1.1.2
//NAT配置
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 3.3.3.0 0.0.0.255
[R3-acl-basic-2000]int g0/0/0
[R3-GigabitEthernet0/0/0]nat outbound 2000
//MGRE配置
[R3]int tu 0/0/0
[R3-Tunnel0/0/0]ip add 192.168.2.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source g0/0/0
[R3-Tunnel0/0/0]nhrp entry 192.168.2.1 16.1.2.1 register
[R3-Tunnel0/0/0]nhrp network-id 101
[R3-Tunnel0/0/0]q
//OSPF配置
[R3]ospf 1 router-id 11.11.11.11
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 3.3.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1]q
[R3-ospf-1]int tu 0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
[R3-Tunnel0/0/0]ospf dr-priority 0
[R3-Tunnel0/0/0]
R4:
//IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R4
[R4]int l0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-LoopBack0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 46.1.1.1 24
//缺省路由配置
[R4]ip route-static 0.0.0.0 0 46.1.1.2
//NAT配置
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 4.4.4.0 0.0.0.255
[R4-acl-basic-2000]int g0/0/0
[R4-GigabitEthernet0/0/0]nat outbound 2000
//MGRE配置
[R4]int Tunnel 0/0/0
[R4-Tunnel0/0/0]ip add 192.168.1.2 24
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]source 46.1.1.1
[R4-Tunnel0/0/0]nhrp entry 192.168.1.1 16.1.1.1 register
[R4-Tunnel0/0/0]nhrp entry multicast dynamic
[R4-Tunnel0/0/0]nhrp network-id 100
//OSPF配置
[R4]ospf 1 router-id 8.8.8.8
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1]q
[R4]interface Tunnel 0/0/0
[R4-Tunnel0/0/0]ospf network-type broadcast
R5:
//IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R5
[R5]int l0
[R5-LoopBack0]ip add 5.5.5.5 24
[R5-LoopBack0]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 56.1.1.1 24
//缺省路由配置
[R5]ip route-static 0.0.0.0 0 56.1.1.2
//nat配置
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 5.5.5.0 0.0.0.255
[R5-acl-basic-2000]int g0/0/0
[R5-GigabitEthernet0/0/0]nat outbound 2000
//MGRE配置
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip add 192.168.1.3 24
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]source 56.1.1.1
[R5-Tunnel0/0/0]nhrp entry 192.168.1.1 16.1.1.1 register
[R5-Tunnel0/0/0]nhrp entry 192.168.1.2 46.1.1.1 register
[R5-Tunnel0/0/0]nhrp network-id 100
//OSPF配置
[R5]ospf 1 router-id 9.9.9.9
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]q
[R5-ospf-1]q
[R5]interface Tunnel 0/0/0
[R5-Tunnel0/0/0]ospf network-type broadcast
R6:
//IP配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R6
[R6]int l0
[R6-LoopBack0]ip add 6.6.6.6 24
[R6-LoopBack0]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 16.1.1.2 24
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 16.1.2.2 24
[R6-GigabitEthernet0/0/1]int g4/0/0
[R6-GigabitEthernet4/0/0]ip add 26.1.1.2 24
[R6-GigabitEthernet4/0/0]int g4/0/1
[R6-GigabitEthernet4/0/1]ip add 36.1.1.2 24
[R6-GigabitEthernet4/0/1]int g4/0/2
[R6-GigabitEthernet4/0/2]ip add 46.1.1.2 24
[R6-GigabitEthernet4/0/2]int g4/0/3
[R6-GigabitEthernet4/0/3]ip add 56.1.1.2 24
[R6-GigabitEthernet4/0/3]
四、测试:
ping: