HA ×××,即高可用性×××。通过配置备份一个peer,使得其中的一个peer因为某种原因当掉的时候,另一个peer能够起来再建立一条×××隧道,使两端的通信继续。备份隧道的建立所需时间与正常隧道建立时间基本一直,关键的时间开销在DPD检测(死亡对等体检测)。因此在实验的时候会看到当其中一个peer当掉时,会有一定程度的丢包,但是可以接受。
下面的实验简单演示HA的配置方法和一些需要注意的问题。
拓扑:
说明:
1. L2L-BJ作为远端(北京)的一个加密点设备,另一端(天津)的两个加密点设备为L2L-TJ和备份设备L2L-TJ-BACKUP。
2. Internet模拟中间的ISP网络。
3. Inside-network模拟天津的内部网络。
4. 加密点:12.1.1.1 ß-à23.1.1.3(24.1.1.4)
5. 通信点:192.168.10.0ß-à192.168.40.0
6. L2L-TJ,L2L-TJ-BACKUP,Insidenetwork间运行OSPF。
基本配置
L2L2-BJ:
!
hostname L2L-BJ
!
ip cef
!
crypto isakmp policy 10
hash md5
authentication pre-share
group 2
crypto isakmp key cisco address 23.1.1.3
crypto isakmp key cisco address 24.1.1.4
crypto isakmp keepalive 10 periodic
!
crypto ipsec transform-set TRANS esp-des esp-md5-hmac
!
crypto map BJ-TJ 10 ipsec-isakmp
set peer 23.1.1.3
set peer 24.1.1.4
set transform-set TRANS
match address ×××
!
interface Loopback0
ip address 192.168.10.1 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.12
encapsulation dot1Q 12
ip address 12.1.1.1 255.255.255.0
crypto map BJ-TJ
!
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0.12 12.1.1.2
Internet:
!
hostname Internet
!
ip cef
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.12
encapsulation dot1Q 12
ip address 12.1.1.2 255.255.255.0
!
interface FastEthernet0/0.23
encapsulation dot1Q 23
ip address 23.1.1.2 255.255.255.0
!
interface FastEthernet0/0.24
encapsulation dot1Q 24
ip address 24.1.1.2 255.255.255.0
!
L2L-TJ:
!
hostname L2L-TJ
!
ip cef
!
crypto isakmp policy 10
hash md5
authentication pre-share
group 2
crypto isakmp key cisco address 12.1.1.1
crypto isakmp keepalive 10 periodic
!
crypto ipsec transform-set TRANS esp-des esp-md5-hmac
!
crypto map BJ-TJ 10 ipsec-isakmp
set peer 12.1.1.1
set transform-set TRANS
match address ×××
reverse-route tag 10
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.23
encapsulation dot1Q 23
ip address 23.1.1.3 255.255.255.0
crypto map BJ-TJ
!
interface FastEthernet0/0.35
encapsulation dot1Q 35
ip address 35.1.1.3 255.255.255.0
!
router ospf 10
router-id 35.1.1.3
log-adjacency-changes
redistribute static subnets route-map RRI
network 35.1.1.3 0.0.0.0 area 0
!
ip route 12.1.1.1 255.255.255.255 FastEthernet0/0.23 23.1.1.2
!
ip access-list extended ×××
permit ip 192.168.40.0 0.0.0.255 192.168.10.0 0.0.0.255
!
route-map RRI permit 10
match tag 10
!
L2L-TJ-BACKUP:
!
hostname L2L-TJ-BACKUP
!
ip cef
!
crypto isakmp policy 10
hash md5
authentication pre-share
group 2
crypto isakmp key cisco address 12.1.1.1
crypto isakmp keepalive 10 periodic
!
crypto ipsec transform-set TRANS esp-des esp-md5-hmac
!
crypto map BJ-TJ 10 ipsec-isakmp
set peer 12.1.1.1
set transform-set TRANS
match address ×××
reverse-route tag 10
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.24
encapsulation dot1Q 24
ip address 24.1.1.4 255.255.255.0
crypto map BJ-TJ
!
interface FastEthernet0/0.45
encapsulation dot1Q 45
ip address 45.1.1.4 255.255.255.0
!
router ospf 10
router-id 45.1.1.4
log-adjacency-changes
redistribute static subnets route-map RRI
network 45.1.1.4 0.0.0.0 area 0
!
ip route 12.1.1.1 255.255.255.255 FastEthernet0/0.24 24.1.1.2
!
ip access-list extended ×××
permit ip 192.168.40.0 0.0.0.255 192.168.10.0 0.0.0.255
!
route-map RRI permit 10
match tag 10
!
Inside-network:
!
hostname Inside-network
!
ip cef
!
interface Loopback0
ip address 192.168.40.1 255.255.255.0
ip ospf network point-to-point
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
!
interface FastEthernet0/0.35
encapsulation dot1Q 35
ip address 35.1.1.5 255.255.255.0
ip ospf priority 100
!
interface FastEthernet0/0.45
encapsulation dot1Q 45
ip address 45.1.1.5 255.255.255.0
ip ospf priority 100
!
router ospf 10
router-id 192.168.40.1
log-adjacency-changes
passive-interface Loopback0
network 35.1.1.5 0.0.0.0 area 0
network 45.1.1.5 0.0.0.0 area 0
network 192.168.40.0 0.0.0.255 area 0
注意:
1. 在上面的基本配置中,HA的两个L2L peer(L2L-TJ和L2L-TJ-BACKUP)都没有配置到达对端peer(L2L-BJ)通信点的路由!这是因为Inside-network需要动态学习到达对端通信点的路由,他不能固定的指向某一个peer,否则HA在两个peer间切换就没有意义了。解决的方法就是使用RRI(反向路由注入,这个技术在Ez×××的client模式的server端经常使用),然后将这个指向对端通信点的静态路由重发布到路由进程中。
2. 在L2L-BJ的crypto配置中,他的peer有两个,其他配置如常。
3. 开启DPD。Crypto isakmp keepalive 10 period,后面的period不要忘了。
4. 为了避免重发布的时候将不相关的静态路由也不发布出去,谢了一个route-map来控制。
测试:
1. 从北京发起连接。
L2L-BJ#ping 192.168.40.1 sou l0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.40.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.10.1
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 52/96/116 ms
L2L-BJ#sh cry isa sa
dst src state conn-id slot status
23.1.1.3 12.1.1.1 QM_IDLE 1 0 ACTIVE
×××建立成功。
因为我们在书写peer的时候首先写的是23.1.1.3,因此尝试建立×××的时候,首先匹配的是23.1.1.3。
2. 检查RRI。
L2L-TJ#sh ip route static
S 192.168.10.0/24 [1/0] via 12.1.1.1
12.0.0.0/32 is subnetted, 1 subnets
S 12.1.1.1 [1/0] via 23.1.1.2, FastEthernet0/0.23
192.168.10.0是通信点路由,RRI成功注入。
下面去inside-network看看有没有收到。
Inside-network#sh ip route ospf
O E2 192.168.10.0/24 [110/20] via 35.1.1.3, 00:03:59, FastEthernet0/0.35
收到。注意他的下一跳。当×××建立的peer不同时,这个下一跳相应的会改变。
3. 测试HA。
测试方法:从北京发起一个连续ping,然后从将L2L-TJ接入internet的端口当掉,看看×××能不能自动切换peer重建连接。
1) 发起ping
L2L-BJ#ping 192.168.40.1 source loopback 0 repeat 1000000
Type escape sequence to abort.
Sending 1000000, 100-byte ICMP Echos to 192.168.40.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.10.1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
切到L2L-TJ关闭FA0/0.23,再切回L2L-BJ观察丢包情况
!!!!!!!!!!!!!!!!!!!!!!!!!!!!.............!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
一小段时间(大概10s)的丢包后又成功发送。
2) 检查×××连接。
L2L-BJ#sh cry isa sa
dst src state conn-id slot status
24.1.1.4 12.1.1.1 QM_IDLE 2 0 ACTIVE
已经切到备份的peer了。
检查inside-network到达通信点路由的下一跳。
Inside-network#sh ip route ospf
O E2 192.168.10.0/24 [110/20] via 45.1.1.4, 00:04:16, FastEthernet0/0.45
已经指向备份路由器了。
实验原理很明确,实现的方法也很简单。需要注意的一个问题就是如果我们再打开fa0/0.23端口,×××的隧道不会切回到23.1.1.3。这个不同于redundant vpn,他们之间没有抢占或者优先级的关系。
PS:
关于RRI
RRI在Ez×××的client模式下用的比较多,还有就是HA ×××和Redundancy ×××,因为涉及到链路或设备的切换,通过反向路由注入将获得的静态路由重发布进动态路由协议让身后的网络获得路由并动态的切换。此时有一个比较好玩的事情就是不用去配置去往通信点的路由,一般情况下配置L2L的加密点设备时,要求其必须具有加密点和两端通信点的路由。
RRI可以加上static参数,但是一般情况下不必如此。Static参数的作用是不管本设备×××是否激活, 都会产生一条静态路由。
另外一个参数就是remote-peer x.x.x.x,这个是配置到达peer的下一跳地址。我觉得用处不是很大,到达peer的路由手动配就可以了,也不费多大到的劲。