×××第五话:DM×××标准配置与路由特性探讨
DM×××(动态多点×××)的网络拓扑与帧中继中教科书式的hub-spoke拓扑一模一样,如果你学习过FR的hub-spoke拓扑,那么DM×××就很容易理解。而且在后面的实验中,你会发现他们真的很像!
DM×××这个技术的出现就是为了解决一个中心站点与多个分支站点间建立×××通信时的问题。一般情况下,spoke(分支站点)与hub(中心站点)间建立×××隧道,spoke间通信的话就要穿越hub。这种方式造成流量的流动很不合理,hub端的管理开销很大,用cisco官方的话来说就是拓展性不高,灵活性不够(这几句话经常听见)。打个比方,中心站点在哈尔滨,两个分支站点分别在苏州和上海。苏州和上海这两个分支站点间的通信却需要绕大半个中国才能通,这是不合理的!(当年大学里只准接教育网的时候,去外网的服务的话经常是这么个情况,同一个城市的大学间通信要绕一个大圈子)
DM×××通过动态建立虚链路(也有的成为按需电路,其实就是一个临时协商一个加密隧道)来解决这个情况。Spoke端与hub端建立永久链路,当spoke与spoke间需要通信的时候,hub解析出spoke的通信点地址,然后告诉spoke,让spoke间协商起一条×××隧道,这样就解决了上面的问题。
DM×××除了使用GRE over IPSec这个技术之外,另一个关键的技术就是NHRS(下一跳解析协议)。这个技术简要说来就是维护spoke的真是IP地址,当spoke间需要通信的时候,就调用相应的地址让他们建立×××隧道连接。维护地址数据库的任务有server端,也就是hub端完成,spoke端都是client,client向server注册自己的地址。
在cisco的官方文档上提出了DM×××需要遵守的2/8原则:spoke与hub间的流量应占80%,spoke间的流量应占剩下的20%。也就是说,如果spoke间的流量过多的话,就不应属于hub-spoke这种拓扑类型了,那么也就不应该应用DM×××这个技术。
下面的实验演示在cisco的2691路由器(12.4)上配置一个标准DM×××。先后使用两个IGP实现路由,讨论这两种路由需要注意的一些小细节。
拓扑:
基本配置
HUB:
!
hostname HUB
!
interface Loopback0
ip address 192.168.10.1 255.255.255.0
ip ospf network point-to-point
!
interface Serial0/0
ip address 12.1.1.1 255.255.255.0
clock rate 2000000
!
ip route 0.0.0.0 0.0.0.0 Serial0/0 12.1.1.2
Internet:
!
hostname Internet
interface Serial0/0
ip address 12.1.1.2 255.255.255.0
clock rate 2000000
!
interface Serial0/1
ip address 23.1.1.2 255.255.255.0
clock rate 2000000
!
interface Serial0/2
ip address 24.1.1.2 255.255.255.0
clock rate 2000000
!
SPOKE-A:
!
hostname SPOKE-A
!
interface Loopback0
ip address 192.168.30.1 255.255.255.0
ip ospf network point-to-point
!
interface Serial0/0
ip address 23.1.1.3 255.255.255.0
clock rate 2000000
!
interface Serial0/2
ip address 24.1.1.2 255.255.255.0
clock rate 2000000
!
ip route 0.0.0.0 0.0.0.0 Serial0/0 23.1.1.2
SPOKE-B:
!
hostname Client-B
!
interface Loopback0
ip address 192.168.40.1 255.255.255.0
ip ospf network point-to-point
!
interface Serial0/0
ip address 24.1.1.4 255.255.255.0
clock rate 2000000
!
ip route 0.0.0.0 0.0.0.0 Serial0/0 24.1.1.2
基本配置完成后开始进行GRE over IPSec ×××的一些基本配置。
HUB:
!
crypto isakmp policy 10
hash md5
authentication pre-share
group 2
crypto isakmp key cisco address 0.0.0.0 0.0.0.0
!
crypto ipsec transform-set TRANS esp-des esp-md5-hmac
mode transport
!
crypto ipsec profile DM×××
set security-association lifetime seconds 120
set transform-set TRANS
!
SPOKE-A:
!
crypto isakmp policy 10
hash md5
authentication pre-share
group 2
crypto isakmp key cisco address 0.0.0.0 0.0.0.0
!
crypto ipsec transform-set TRAN esp-des esp-md5-hmac
mode transport
!
crypto ipsec profile DM×××
set security-association lifetime seconds 120
set transform-set TRAN
SPOKE-B:
!
crypto isakmp policy 10
hash md5
authentication pre-share
group 2
crypto isakmp key cisco address 0.0.0.0 0.0.0.0
!
!
crypto ipsec transform-set TRAN esp-des esp-md5-hmac
mode transport
!
crypto ipsec profile DM×××
set security-association lifetime seconds 120
set transform-set TRAN
!
以上配置都是GRE over IPSec的基本配置。其中有两个小细节需要注意:
1. peer的地址是0.0.0.0,因为隧道是动态建立的,所以没有明确的IP。
2. 隧道类型是传输模式。可以写隧道模式,但是GRE over IPSec是典型的通信点等于加密点,所以采用传输模式。隧道模式的话,加密前和加密后的IP都是一样的,徒然增加了开销。
IPSec方面的配置完成后开始配置GRE。
HUB:
interface Tunnel0
ip address 192.168.100.1 255.255.255.0
ip nhrp authentication the-edge #认证
ip nhrp map multicast dynamic #地址映射类型
ip nhrp network-id 100 #ID号,必须一致
tunnel source Serial0/0
tunnel mode gre multipoint #GRE隧道类型,与GRE over ipsec的不一样
tunnel key 1 #这个号码也需要一致
tunnel protection ipsec profile DM××× #调用IKE第二阶段的profile
SPOKE-A:
interface Tunnel0
ip address 192.168.100.3 255.255.255.0
ip nhrp authentication the-edge
ip nhrp map multicast dynamic
ip nhrp map 192.168.100.1 12.1.1.1 #地址映射,分别是GRE的地址和源地址,路由是用到
ip nhrp map multicast 12.1.1.1 #hub的地址
ip nhrp network-id 100
ip nhrp nhs 192.168.100.1 #nhrp服务器的地址,也就是server的地址
tunnel source Serial0/0
tunnel mode gre multipoint
tunnel key 1
tunnel protection ipsec profile DM×××
SPOKE-B:
interface Tunnel0
ip address 192.168.100.4 255.255.255.0
ip nhrp authentication the-edge
ip nhrp map multicast dynamic
ip nhrp map 192.168.100.1 12.1.1.1
ip nhrp map multicast 12.1.1.1
ip nhrp network-id 100
ip nhrp nhs 192.168.100.1
tunnel source Serial0/0
tunnel mode gre multipoint
tunnel key 1
tunnel protection ipsec profile DM×××
Tunnel的配置是DM×××很重要的一部分内容这其中配置的重点又是NHRP。上面包含map的配置比较多(spoke端有3跳,hub端有一条)。需要注意其中不同的含义。包含两个地址的那一条对路由起作用,我觉得有点类似于FR中的DLCI到IP的映射。
Tunnel配置完成后起路由协议。
首先测试采用OSPF。
HUB:
router ospf 100
router-id 192.168.10.1
log-adjacency-changes
passive-interface Loopback0
network 192.168.10.0 0.0.0.255 area 0
network 192.168.100.0 0.0.0.255 area 0
SPOKE-A:
router ospf 100
router-id 192.168.30.1
log-adjacency-changes
passive-interface Loopback0
network 192.168.30.0 0.0.0.255 area 0
network 192.168.100.0 0.0.0.255 area 0
SPOKE-B:
router ospf 100
router-id 192.168.40.1
log-adjacency-changes
passive-interface Loopback0
network 192.168.40.0 0.0.0.255 area 0
network 192.168.100.0 0.0.0.255 area 0
注意一定不要把真实物理接口的地址宣告进去!
因为路由协议自身需要发送hello,keepalive信息,所以不用我们手动发起连接即可**隧道。此时在HUB端会出现这样的持续的输出!
*Mar 1 01:47:37.903: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.30.1 on Tunnel0 from EXSTART to DOWN, Neighbor Down: Adjacency forced to reset
*Mar 1 01:47:38.207: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.40.1 on Tunnel0 from EXSTART to DOWN, Neighbor Down: Adjacency forced to reset
*Mar 1 01:47:38.899: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.30.1 on Tunnel0 from LOADING to FULL, Loading Done
在cisco的官方文档上给出的解释是邻居的翻动(flapping)。
造成这种问题的原因就是这这种NBMA网络中,tunnel口默认运行的点到点网络类型。
HUB#sh ip ospf interface tunnel 0
Tunnel0 is up, line protocol is up
Internet Address 192.168.100.1/24, Area 0
Process ID 100, Router ID 192.168.10.1, Network Type POINT_TO_POINT, Cost: 11111
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:02
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 4 msec, maximum is 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.40.1
Suppress hello for 0 neighbor(s)
点到点网络类型没有DR/BDR的选举,如果从一个接口收到一个hello包,进行正常的邻局协商然后同步数据库。也就是说,如果我们只开一个spoke的话,hub与spoke间能工作的很好,完全没有上述邻居翻动的问题!
但是,一旦开启两个或以上的spoke,那么不同的hello到来都会导致邻居关系的重新协商,也就是邻居的flaping!
解决的办法就是改变接口的网络类型。
Int tu 0
Ip ospf network broadcast
Ip ospf priority 10 (spoke端值为零或小与10)
设置优先级是保证hub端成为DR。
1. 查看邻居建立情况:
HUB#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.30.1 0 FULL/DROTHER 00:00:36 192.168.100.3 Tunnel0
192.168.40.1 0 FULL/DROTHER 00:00:36 192.168.100.4 Tunnel0
2. 查看路由:
SPOKE-A#sh ip route ospf
O 192.168.10.0/24 [110/11112] via 192.168.100.1, 00:00:24, Tunnel0
O 192.168.40.0/24 [110/11112] via 192.168.100.4, 00:00:24, Tunnel0
注意上面的1921.68.40.0的下一跳,直接指向了SPOKE-B!
Client-B#sh ip route ospf
O 192.168.30.0/24 [110/11112] via 192.168.100.3, 00:01:38, Tunnel0
O 192.168.10.0/24 [110/11112] via 192.168.100.1, 00:01:38, Tunnel0
3. 查看×××建立情况
HUB#sh cry isa sa
dst src state conn-id slot status
12.1.1.1 24.1.1.4 QM_IDLE 6 0 ACTIVE
12.1.1.1 23.1.1.3 QM_IDLE 5 0 ACTIVE
4. 发起ping测试
Client-B#ping 192.168.30.1 sou l0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.30.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.40.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 92/142/180 ms
下面测试采用EIGRP作为路由协议。
HUB:
router eigrp 100
network 192.168.10.0
network 192.168.100.0
no auto-summary
SPOKE-A:
router eigrp 100
network 192.168.30.0
network 192.168.100.0
no auto-summary
SPOKE-B:
router eigrp 100
network 192.168.40.0
network 192.168.100.0
no auto-summary
1. 查看邻居建立情况
HUB#sh ip eigrp neighbors
IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
1 192.168.100.4 Tu0 13 00:05:46 272 5000 0 5
0 192.168.100.3 Tu0 10 00:05:59 216 5000 0 5
SPOKE-A#sh ip eigrp neighbors
IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 192.168.100.1 Tu0 13 00:06:27 233 5000 0 7
Client-B#sh ip eigrp neighbors
IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 192.168.100.1 Tu0 13 00:06:51 202 5000 0 7
2. 查看路由学习情况
HUB#sh ip route eigrp
D 192.168.30.0/24 [90/297372416] via 192.168.100.3, 00:07:27, Tunnel0
D 192.168.40.0/24 [90/297372416] via 192.168.100.4, 00:07:14, Tunnel0
SPOKE-A#sh ip route eigrp
D 192.168.10.0/24 [90/297372416] via 192.168.100.1, 00:07:43, Tunnel0
Client-B#sh ip route eigrp
D 192.168.10.0/24 [90/297372416] via 192.168.100.1, 00:07:46, Tunnel0
如上所示,spoke端没有学习到其他spoke的路由。如果你还记得FR上运行EIGRP的话,你一定记得关闭水平分割!
HUB(config)#in tu 0
HUB(config-if)#no ip split-horizon eigrp 100
再去spoke看路由表。
SPOKE-A#sh ip route eigrp
D 192.168.10.0/24 [90/297372416] via 192.168.100.1, 00:10:04, Tunnel0
D 192.168.40.0/24 [90/310172416] via 192.168.100.1, 00:00:55, Tunnel0
都学到了!
但是,注意看他的下一跳!然后对比运行OSPF时下一跳的情况!发现问题了吧,spoke的路由的下一跳指向的还是hub。
解决方法:在HUB的tunnel接口下关闭next-hop-self(有点像BGP).
no ip next-hop-self eigrp 100
再去spoke看路由表。
SPOKE-A#sh ip route eigrp
D 192.168.10.0/24 [90/297372416] via 192.168.100.1, 00:00:19, Tunnel0
D 192.168.40.0/24 [90/310172416] via 192.168.100.4, 00:00:19, Tunnel0
这下正常了!
好,实验到此结束!
转载于:https://blog.51cto.com/edges/412751