R1为HUB
R3 R4为R1的一级子分支
R7 R8是R3的子分支
R9 R10是R4的子分支
R2 R5 R6是ISP
目标为R7-R9 R10一跳互通 R8-R9 R10一跳互通
首先保证R2 R5 R6到全网任何位置的连通性
再做R1 R3 R4的HUB-SPOKE结构
再进行R3 R7 R8和R4 R9 R10的HUB-SPOKE结构的配置
R1
interface Tunnel0
ip address 172.16.34.1 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp redirect
ip ospf network broadcast
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
!
interface Ethernet0/0
ip address 10.0.12.1 255.255.255.0
no ip split-horizon eigrp 90
ip ospf network non-broadcast
!
interface Ethernet0/1
no ip address
shutdown
!
interface Ethernet0/2
no ip address
shutdown
!
interface Ethernet0/3
no ip address
shutdown
!
router ospf 1
router-id 1.1.1.1
network 172.16.0.0 0.0.255.255 area 0
R3
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
ip address 33.33.33.33 255.255.255.255
!
interface Tunnel0
ip address 172.16.34.3 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp nhs 172.16.34.1 nbma 10.0.12.1 multicast
ip nhrp shortcut
ip ospf network broadcast
ip ospf priority 0
tunnel source Loopback0
tunnel mode gre multipoint
tunnel key 100
!
interface Tunnel1
ip address 172.16.78.3 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp redirect
ip ospf network broadcast
tunnel source Loopback1
tunnel mode gre multipoint
tunnel key 100
!
router ospf 1
router-id 3.3.3.3
network 172.16.0.0 0.0.255.255 area 0
ip route 0.0.0.0 0.0.0.0 10.0.23.2
R4
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Loopback1
ip address 44.44.44.44 255.255.255.255
!
interface Tunnel0
ip address 172.16.34.4 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp nhs 172.16.34.1 nbma 10.0.12.1 multicast
ip nhrp shortcut
ip ospf network broadcast
ip ospf priority 0
tunnel source Loopback0
tunnel mode gre multipoint
tunnel key 100
!
interface Tunnel1
ip address 172.16.109.4 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp redirect
ip ospf network broadcast
tunnel source Loopback1
tunnel mode gre multipoint
tunnel key 100
!
router ospf 1
router-id 4.4.4.4
network 172.16.0.0 0.0.255.255 area 0
!
ip route 0.0.0.0 0.0.0.0 10.0.24.2
R7
!
interface Tunnel0
ip address 172.16.78.7 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp nhs 172.16.78.3 nbma 33.33.33.33 multicast
ip nhrp redirect
ip ospf network broadcast
ip ospf priority 0
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
router ospf 1
router-id 7.7.7.7
network 172.16.0.0 0.0.255.255 area 0
!
ip route 0.0.0.0 0.0.0.0 Ethernet0/0
R8
!
interface Tunnel0
ip address 172.16.78.8 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp nhs 172.16.78.3 nbma 33.33.33.33 multicast
ip nhrp redirect
ip ospf network broadcast
ip ospf priority 0
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
!
!
router ospf 1
router-id 8.8.8.8
network 172.16.0.0 0.0.255.255 area 0
!
ip route 0.0.0.0 0.0.0.0 10.0.58.5
R9
!
interface Tunnel0
ip address 172.16.109.9 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp nhs 172.16.109.4 nbma 44.44.44.44 multicast
ip nhrp redirect
ip ospf network broadcast
ip ospf priority 0
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
!
!
router ospf 1
router-id 9.9.9.9
network 172.16.0.0 0.0.255.255 area 0
!
ip route 0.0.0.0 0.0.0.0 10.0.69.6
!
interface Tunnel0
ip address 172.16.109.10 255.255.255.0
no ip redirects
ip nhrp network-id 100
ip nhrp nhs 172.16.109.4 nbma 44.44.44.44 multicast
ip nhrp redirect
ip ospf network broadcast
ip ospf priority 0
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
!
!
router ospf 1
router-id 10.10.10.10
network 172.16.0.0 0.0.255.255 area 0
!
ip route 0.0.0.0 0.0.0.0 10.0.106.6
该实验中需要注意
1、全网tunnel key值需要相同,否则 无法做成动态隧道
2、在R3和R4上需要做2个tunnel并且2个tunnel的源都不同 否则在数据传输的过程中 从下层传输的数据无法分辨应该进入到那条通路
ip nhrp shortcut 发起对对应地址的公网映射请求
ip nhrp redirect 本地无请求的映射关系 进行转发
故转发到最后一节拿到映射关系后 就打成了一跳互通
需要注意的是 当第一次测试时 不会一跳互通 因为一跳互通的请求需要被发起
所以在发起了一跳互通之后的测试都是一跳互通