第一步:IP地址规划
PC地址
设备 | 地址 | 网关 |
PC1 | 192.168.1.2/24 | 192.168.1.1/24 |
PC2 | 192.168.2.2/24 | 192.168.2.1/24 |
PC3 | 192.168.3.2/24 | 192.168.3.1/24 |
PC4 | 192.168.4.2/24 | 192.168.4.1/24 |
PC5 | 192.168.5.2/24 | 192.168.5.1/24 |
设备地址
设备 | 接口 | 地址 |
R1 | g0/0/0 | 10.1.1.1/24 |
g0/0/1 | 100.1.1.1/24 | |
g0/0/2 | 192.168.1.1/24 | |
R2 | g0/0/0 | 20.1.1.1/24 |
g0/0/1 | 192.168.2.1/24 | |
R3 | g0/0/0 | 30.1.1.1/24 |
g0/0/1 | 192.168.3.1/24 | |
R5 | g0/0/0 | 40.1.1.1/24 |
g0/0/1 | 192.168.4.1/24 | |
R60 | g0/0/0 | 50.1.1.1/24 |
g0/0/1 | 192.168.5.1/24 |
R4 | g0/0/0 | 100.1.1.2/24 |
g0/0/1 | 10.1.1.2/24 | |
g0/0/2 | 50.1.1.2/24 | |
g4/0/0 | 40.1.1.2/24 | |
g4/0/1 | 30.1.1.2/24 | |
g4/0/2 | 20.1.1.2/24 |
第二步:配置IP地址
R1配置
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.1.1.1 24
Jul 23 2023 17:56:28-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 100.1.1.1 24
Jul 23 2023 17:56:57-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[R1-GigabitEthernet0/0/2]ip address 192.168.1.1 24
Jul 23 2023 17:57:36-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R1-GigabitEthernet0/0/2]q
[R1]
R2配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 20.1.1.1 24
Jul 23 2023 18:02:41-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.2.1 24
Jul 23 2023 18:03:22-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]q
[R2]
R3配置
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 30.1.1.1 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.3.1 24
R4配置
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 100.1.1.2 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 10.1.1.2 24.
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip address 50.1.1.2 24
[R4-GigabitEthernet0/0/2]int g4/0/0
[R4-GigabitEthernet4/0/0]ip address 40.1.1.2 24
[R4-GigabitEthernet4/0/0]int g4/0/1
[R4-GigabitEthernet4/0/1]ip address 30.1.1.2 24
[R4-GigabitEthernet4/0/1]int g4/0/2
[R4-GigabitEthernet4/0/2]ip address 20.1.1.2 24[R4-GigabitEthernet4/0/2]q
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 5.5.5.5 24
R5配置
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip address 40.1.1.1 24
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip address 192.168.4.1 24
R6配置
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip address 50.1.1.1 24
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip address 192.168.5.1 24
第三步:配置缺省
[R1]ip route-static 0.0.0.0 0 100.1.1.2
[R1]ip route-static 0.0.0.0 0 10.1.1.2[R2]ip route-static 0.0.0.0 0 20.1.1.2
[R3]ip route-static 0.0.0.0 0 30.1.1.2
[R5]ip route-static 0.0.0.0 0 40.1.1.2
[R6]ip route-static 0.0.0.0 0 50.1.1.2
第四步:NAT地址转换
R1上的配置
[R1]acl 2000
[R1-acl-basic-2000]rule permit source any
[R1-acl-basic-2000]q
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]nat outbound 2000
[R1-GigabitEthernet0/0/0]q
[R1]acl 2001
[R1-acl-basic-2001]rule permit source any
[R1-acl-basic-2001]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2001
R2上的配置
[R2]acl 2000
[R2-acl-basic-2000]rule permit source any
[R2-acl-basic-2000]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]nat outbound 2000
R3上的配置
[R3]acl 2000
[R3-acl-basic-2000]rule permit source any
[R3-acl-basic-2000]q
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]nat outbound 2000
R5上的配置
[R5]acl 2000
[R5-acl-basic-2000]rule permit source any
[R5-acl-basic-2000]q
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]nat outbound 2000
R6上的配置
[R6]acl 2000
[R6-acl-basic-2000]rule permit source any
[R6-acl-basic-2000]q
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]nat outbound 2000
第五步:构建星型结构MGRE网络
R1中心站点
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]ip address 15.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]source 10.1.1.1
Jul 23 2023 20:40:34-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R1-Tunnel0/0/0]nhrp entry multicast dynamic
[R1-Tunnel0/0/0]nhrp network-id 100
R2
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]ip address 15.1.1.2 24
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]source g0/0/0
Jul 23 2023 20:47:00-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R2-Tunnel0/0/0]nhrp network-id 100
[R2-Tunnel0/0/0]nhrp entry 15.1.1.1 10.1.1.1 register
R3
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]ip address 15.1.1.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp
[R3-Tunnel0/0/0]source g0/0/0
Jul 23 2023 20:52:05-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R3-Tunnel0/0/0]nhrp network-id 100
[R3-Tunnel0/0/0]nhrp entry 15.1.1.1 10.1.1.1 register
第六步:全联网状MGRE
R1中心站点
[R1]interface Tunnel 0/0/1
[R1-Tunnel0/0/1]ip address 25.1.1.1 24
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
[R1-Tunnel0/0/1]source 100.1.1.1
Jul 23 2023 21:03:09-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
[R1-Tunnel0/0/1]nhrp entry multicast dynamic
[R1-Tunnel0/0/1]nhrp network-id 200
R5中心站点
[R5]interface Tunnel 0/0/1
[R5-Tunnel0/0/1]ip address 25.1.1.2 24
[R5-Tunnel0/0/1]tunnel-protocol gre p2mp
[R5-Tunnel0/0/1]source 40.1.1.1
Jul 23 2023 21:10:09-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/1 has entered the UP state.
[R5-Tunnel0/0/1]nhrp entry multicast dynamic
[R5-Tunnel0/0/1]nhrp network-id 200
[R5-Tunnel0/0/1]nhrp entry 25.1.1.1 100.1.1.1 register
R6
[R6]interface Tunnel 0/0/1
[R6-Tunnel0/0/1]ip address 25.1.1.3 24
[R6-Tunnel0/0/1]tunnel-protocol gre p2mp
[R6-Tunnel0/0/1]source 50.1.1.1
[R6-Tunnel0/0/1]nhrp network-id 200
[R6-Tunnel0/0/1]nhrp entry 25.1.1.1 100.1.1.1 register
[R6-Tunnel0/0/1]nhrp entry 25.1.1.2 40.1.1.1 register
第七步:OSPF
R1(区域0+1)
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 15.1.1.1 0.0.0.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]q
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 25.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.1]q
[R1-ospf-1]q
[R1]
R2(区域0)
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 15.1.1.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
R3(区域0)
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 15.1.1.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0
R5(区域1)
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 1
[R5-ospf-1-area-0.0.0.1]network 25.1.1.2 0.0.0.0
[R5-ospf-1-area-0.0.0.1]network 192.168.4.1 0.0.0.0
R6(区域1)
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 1
[R6-ospf-1-area-0.0.0.1]network 25.1.1.3 0.0.0.0
[R6-ospf-1-area-0.0.0.1]network 192.168.5.1 0.0.0.0
在NBMA网络中,接口类型为p2p,故OSPF协议不能正常建立邻居关系,此时要将其所有接口均修改为Broadcast;
R2和R3在星型MGRE网络中,还要使其放弃DR选举,否则area 0选路将不一致
[R1]int t0/0/0
[R1-Tunnel0/0/0]ospf network-type broadcast
[R1-Tunnel0/0/0]q
[R1]int t0/0/1
[R1-Tunnel0/0/1]ospf network-type broadcast[R5]int t0/0/1
[R5-Tunnel0/0/1]ospf network-type broadcast[R6]int t0/0/1
[R6-Tunnel0/0/1]ospf network-type broadcast[R2]int t0/0/0
[R2-Tunnel0/0/0]ospf network-type broadcast
[R2-Tunnel0/0/0]ospf dr-priority 0[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf network-type broadcast
[R3-Tunnel0/0/0]ospf dr-priority 0
第八步:测试