1,配置各路由接口网段及其环回地址,并补充缺省
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 16.0.0.1/24 up up
GigabitEthernet0/0/1 116.0.0.1/24 up up
GigabitEthernet0/0/2 unassigned down down
GigabitEthernet4/0/0 unassigned down down
LoopBack0 192.168.1.1/24 up up(s)
NULL0 unassigned up up(s)
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 26.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.2.1/24 up up(s)
NULL0 unassigned up up(s)
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 36.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.3.1/24 up up(s)
NULL0 unassigned up up(s)
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 46.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.4.1/24 up up(s)
NULL0 unassigned up up(s)
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 56.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.5.1/24 up up(s)
NULL0 unassigned up up(s)
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 16.0.0.2/24 up up
GigabitEthernet0/0/1 116.0.0.2/24 up up
GigabitEthernet0/0/2 26.0.0.2/24 up up
GigabitEthernet2/0/0 46.0.0.2/24 up up
GigabitEthernet3/0/0 56.0.0.2/24 up up
GigabitEthernet4/0/0 36.0.0.2/24 up up
NULL0 unassigned up up(s)
缺省
[r1]ip route-static 0.0.0.0 0 16.0.0.2
[r1]ip route-static 0.0.0.0 0 116.0.0.2
[r2]ip route-static 0.0.0.0 0 26.0.0.2
[r3]ip route-static 0.0.0.0 0 36.0.0.2
[r4]ip route-static 0.0.0.0 0 46.0.0.2
[r5]ip route-static 0.0.0.0 0 56.0.0.2
配置完成后可以进行简单的ping进行测试
2,搭建MGRE环境
AR1AR4AR5为全连的MGRE结构,然他们彼此在nhrp100这个域中作为中心又要作为分支
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip add 192.168.6.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.0.0.1
Jan 13 2022 23:09:44-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]
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r4]int t 0/0/0
[r4-Tunnel0/0/0]
[r4-Tunnel0/0/0]ip add 192.168.6.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 46.0.0.1
Jan 13 2022 23:13:32-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r4-Tunnel0/0/0]
[r4-Tunnel0/0/0]nhrp network-id 100
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r5]int t0/0/0
[r5-Tunnel0/0/0]ip add 192.168.6.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]so
[r5-Tunnel0/0/0]source 56.0.0.1
Jan 13 2022 23:15:56-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r5-Tunnel0/0/0]
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
彼此分支AR1找AR4和AR5进行注册
[r1]int t0/0/0
[r1-Tunnel0/0/0]nh
[r1-Tunnel0/0/0]nhrp en
[r1-Tunnel0/0/0]nhrp entry 192.168.6.2 46.0.0.1 r
[r1-Tunnel0/0/0]nhrp entry 192.168.6.2 46.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry 192.168.6.3 56.0.0.1 r
[r1-Tunnel0/0/0]nhrp entry 192.168.6.3 56.0.0.1 register
到AR4,AR5上进行检查
[r4]dis nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.6.1 32 16.0.0.1 192.168.6.1 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:01:37
Expire time : 01:58:23
Number of nhrp peers: 1
[r5]dis nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.6.1 32 16.0.0.1 192.168.6.1 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:01:52
Expire time : 01:58:08
Number of nhrp peers: 1
同时AR1上也会有注册信息
[r1]dis nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.6.2 32 46.0.0.1 192.168.6.2 static hub
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:03:43
Expire time : --
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
192.168.6.3 32 56.0.0.1 192.168.6.3 static hub
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:03:16
Expire time : --
Number of nhrp peers: 2
AR1,AR2,AR3为星型拓扑结构
[r1]int t0/0/1
[r1-Tunnel0/0/1]ip add 192.168.7.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]so
[r1-Tunnel0/0/1]source 116.0.0.1
Jan 13 2022 23:36:59-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 network-id 110
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r2]int t0/0/0
[r2-Tunnel0/0/0]ip add 192.168.7.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]
[r2-Tunnel0/0/0]so
[r2-Tunnel0/0/0]source g
[r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
Jan 13 2022 23:38:26-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 110
[r2-Tunnel0/0/0]nhrp entry 192.168.7.1 116.0.0.1
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip add 192.168.7.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]so
[r3-Tunnel0/0/0]source g
[r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
Jan 13 2022 23:40:06-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 110
[r3-Tunnel0/0/0]nhrp entry 192.168.7.1 116.0.0.1
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
3,通过ospf让私网网段进行互相通信
[r1]ospf 1 r
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]a
[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 192.168.6.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.169.7.0 0.0.0.255
[r3]ospf 1 ro
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]
[r3-ospf-1]
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]
[r3-ospf-1-area-0.0.0.0]ne
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]ne
[r3-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r4]ospf 1 ro
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]net
[r4-ospf-1]ne
[r4-ospf-1]nexthop
[r4-ospf-1]nexthop
[r4-ospf-1]a 0
[r4-ospf-1-area-0.0.0.0]ne
[r4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]net
[r4-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r5]ospf 1 ro
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]a 0
[r5-ospf-1-area-0.0.0.0]
[r5-ospf-1-area-0.0.0.0]
[r5-ospf-1-area-0.0.0.0]ne
[r5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]net
[r5-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
检查发现获取不全
[r1]dis ospf peer brief
修改网络类型 将全连修改为broadcost
r1]int t0/0/0
[r1-Tunnel0/0/0]
[r1-Tunnel0/0/0]
[r1-Tunnel0/0/0]ospf
[r1-ospf-1]q
[r1]int t0/0/0
[r1-Tunnel0/0/0]ospf
[r1-Tunnel0/0/0]ospf n
[r1-Tunnel0/0/0]ospf network-type b
[r1-Tunnel0/0/0]ospf network-type broadcast
改高AR1 的优先级进行DR选举
[r1-Tunnel0/0/1]ospf d
[r1-Tunnel0/0/1]ospf dr-priority 10
<r1>reset ospf 1 process
AR1AR2AR3进行重新选举Warning: The OSPF process will be reset. Continue? [Y/N]:y
在进行简单的测试