1,新建拓扑
2.R1配置
<Huawei>sys
[Huawei]sysname R1
[R1]int 10
[R1-LoopBack0lip add 1.1.1.1 24
[R1-LoopBack0Jint 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]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配置:
基础配置
<Huawei>sys
[Huawei]sysname R2
[R2]int 10
[R2-LoopBack0]ip add 2.2.2.2 24
[R2-LoopBack0Jint 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-acI-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 routerid 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
[R2int tu 0/0/0R2-Tunnel0/0/0]ospf network-type broadcast
[R2-Tunnel0/0/0]ospf dr-priority 0
[R2-Tunnel0/0/0]
R3配置:
基础配置
<Huawei>sys
[Huawei]sysname R3
[R3]int 10
[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.1network 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]g
[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配置:
基础配置
<Huawei>sys
[Huawei]sysname R4
[R4]int 10
[R4-LoopBacko]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.01]q
[R4-ospf-1]q
[R4]interface Tunnel 0/0/0
[R4-Tunnel0/0/0]ospf network-type broadcast
R5配置
基础配置
<Huawei>sys
[Huawei]sysname R5
[R5]int 10
[R5-LoopBacko]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-acI-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.0lnetwork 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配置:
基础配置
<Huawei>sys
[Huawei]sysname R6
[R6Jint 10
[R6-LoopBacko]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]q