第二阶段DM×××可以使用动态协议实现分支站点之间内网的直接通信
这里使用OSPF ,主要配置如下:
R1#sho run int tun 0
Building configuration...
Current configuration : 258 bytes
interface Tunnel0
ip address 10.1.1.1 255.255.255.0
no ip redirects
ip nhrp authentication 123
ip nhrp map multicast dynamic
ip nhrp network-id 100
ip ospf network broadcast
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
End
R1#sho ip nhrp
10.1.1.2/32 via 10.1.1.2
Tunnel0 created 00:10:58, expire 01:49:01
Type: dynamic, Flags: unique registered
NBMA address: 100.2.28.2
10.1.1.3/32 via 10.1.1.3
Tunnel0 created 00:10:58, expire 01:49:01
Type: dynamic, Flags: unique registered used
NBMA address: 100.3.38.3
R1#sho ip route
CGateway of last resort is 100.1.18.8 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 100.1.18.8
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
L 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/1001] via 10.1.1.2, 00:10:54, Tunnel0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/1001] via 10.1.1.3, 00:01:03, Tunnel0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Tunnel0
L 10.1.1.1/32 is directly connected, Tunnel0
100.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 100.1.18.0/24 is directly connected, Ethernet0/0
L 100.1.18.1/32 is directly connected, Ethernet0/0
R2#sho run int tun 0
Building configuration...
Current configuration : 336 bytes
interface Tunnel0
ip address 10.1.1.2 255.255.255.0
no ip redirects
ip nhrp authentication 123
ip nhrp map 10.1.1.1 100.1.18.1
ip nhrp map multicast 100.1.18.1
ip nhrp network-id 100
ip nhrp nhs 10.1.1.1
ip ospf network broadcast
ip ospf priority 0 //将spoke的优先级改为0,使其不参与选举
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
End
R2#sho ip nhrp
10.1.1.1/32 via 10.1.1.1
Tunnel0 created 00:12:56, never expire
Type: static, Flags: used
NBMA address: 100.1.18.1
10.1.1.2/32 via 10.1.1.2
Tunnel0 created 00:00:02, expire 01:59:57
Type: dynamic, Flags: router unique local
NBMA address: 100.2.28.2
(no-socket)
10.1.1.3/32 via 10.1.1.3
Tunnel0 created 00:00:02, expire 01:59:57
Type: dynamic, Flags: router used
NBMA address: 100.3.38.3
R2#sho ip route
Gateway of last resort is 100.2.28.8 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 100.2.28.8
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/1001] via 10.1.1.1, 00:12:47, Tunnel0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/1001] via 10.1.1.3, 00:00:19, Tunnel0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Tunnel0
L 10.1.1.2/32 is directly connected, Tunnel0
100.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 100.2.28.0/24 is directly connected, Ethernet0/0
L 100.2.28.2/32 is directly connected, Ethernet0/0
R3#sho run int tun 0
Building configuration...
Current configuration : 302 bytes
interface Tunnel0
ip address 10.1.1.3 255.255.255.0
no ip redirects
ip nhrp authentication 123
ip nhrp map 10.1.1.1 100.1.18.1
ip nhrp map multicast 100.1.18.1
ip nhrp network-id 100
ip nhrp nhs 10.1.1.1
ip ospf network broadcast
ip ospf priority 0 //将spoke的优先级改为0,使其不参与选举
tunnel source Ethernet0/0
tunnel mode gre multipoint
tunnel key 100
End
10.1.1.1/32 via 10.1.1.1
Tunnel0 created 00:14:25, never expire
Type: static, Flags: used
NBMA address: 100.1.18.1
10.1.1.2/32 via 10.1.1.2
Tunnel0 created 00:01:31, expire 01:58:28
Type: dynamic, Flags: router
NBMA address: 100.2.28.2
10.1.1.3/32 via 10.1.1.3
Tunnel0 created 00:01:31, expire 01:58:28
Type: dynamic, Flags: router unique local
NBMA address: 100.3.38.3
(no-socket)
R3#sho ip route
Gateway of last resort is 100.3.38.8 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 100.3.38.8
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/1001] via 10.1.1.1, 00:00:07, Tunnel0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/1001] via 10.1.1.2, 00:00:07, Tunnel0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback0
L 3.3.3.3/32 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Tunnel0
L 10.1.1.3/32 is directly connected, Tunnel0
100.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 100.3.38.0/24 is directly connected, Ethernet0/0
L 100.3.38.3/32 is directly connected, Ethernet0/0
R8#sho ip route
100.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C 100.1.18.0/24 is directly connected, Ethernet0/0
L 100.1.18.8/32 is directly connected, Ethernet0/0
C 100.2.28.0/24 is directly connected, Ethernet0/1
L 100.2.28.8/32 is directly connected, Ethernet0/1
C 100.3.38.0/24 is directly connected, Ethernet0/2
L 100.3.38.8/32 is directly connected, Ethernet0/2
R2#traceroute 3.3.3.3 source 2.2.2.2 numeric
Type escape sequence to abort.
Tracing the route to 3.3.3.3
VRF info: (vrf in name/id, vrf out name/id)
1 10.1.1.3 5 msec * 0 msec //spoke(或分支)之间一跳可达
R3#traceroute 2.2.2.2 source 3.3.3.3 numeric
Type escape sequence to abort.
Tracing the route to 2.2.2.2
VRF info: (vrf in name/id, vrf out name/id)
1 10.1.1.2 1 msec * 1 msec
注意:
1、OSPF要达成第二阶段必须把tunnel的网络类型改为BMA/NBMA 并且hub必须为DR,一般把spoke选举优先级改为0。
2、OSPF是链路状态型协议,路由下一跳取决与拓扑图的结构而在多路环境下spoke在拓扑结构中是直连的,所以spoke的路由表中下一跳直接指向目标spoke的tunnel地址。
转载于:https://blog.51cto.com/13596342/2093569