Skip to content
Oct 12 / Greg

Cisco – IPSec Tunnel Termination via HSRP

hsrpIpsec

James ran into this one the other day, and I found it interesting. If you have routers configured for high availability(HA) using hot stand-by routing protocol(HSRP) and you are doing straight IPSec tunnels, how would one go about terminating the tunnel on the virtual HSRP IP address? First, why would you want to do this?

You would most likely want to do this so that you can create a policy at remote sites that won’t break. With straight IPSec tunnels, you can’t specify multiple crypto maps that leverage identical address space in the match ACLs. An easy fix in the scenario is to peer your IPSec tunnel with the HSRP address of your hub site. This way when the routers fail over, your VPN tunnel will failover also.

How do we configure all of this goodness?

Remote Config:

  1. !apply the crypto map to the outside interface
  2. interface Fa0/0
  3. ip address 1.1.1.1 255.255.255.252
  4. crypto map to-hub
  5. desc outside
  6. interface Fa0/1
  7. ip address 192.168.1.1 255.255.255.0
  8. desc inside
  9. !route map to clear the do not fragment bit on tunnel traffic
  10. ip policy route-map clear-df
  11. !our policy
  12. crypto isakmp policy 1
  13. encr 3des
  14. authentication pre-share
  15. group 2
  16. lifetime 14400
  17. !key for hub
  18. crypto isakmp key test address 2.2.2.4
  19. !transform set
  20. crypto ipsec transform-set to-hub esp-3des esp-sha-hmac
  21. !the actual crypto map
  22. crypto map to-hub 10 ipsec-isakmp
  23. set peer 2.2.2.4
  24. set transform-set to-hub
  25. match address hub
  26. !interesting traffic ACL
  27. ip access-list extended hub
  28. remark Allow access though tunnel to hub
  29. permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255
  30. !nat acl. We are denying access to tunnel traffic
  31. ip access-list extended NAT
  32. deny ip any 192.168.0.0 0.0.255.255
  33. permit ip any any
  34. !this is the ACL for the clear DF routemap
  35. ip access-list extended clear-df
  36. permit tcp any 192.168.0.0 0.0.255.255
  37. !nat statement
  38. ip nat inside source list NAT interface FastEthernet0/0 overload
  39. !clear DF route map
  40. route-map clear-df permit 10
  41. match ip address clear-df
  42. set ip df 0


The remote config is straight forward.

RTR-1 Config:

  1. !apply the crypto map to the outside interface
  2. interface Fa0/0
  3. ip address 2.2.2.2 255.255.255.248
  4. !notice that the crypto map is using the redundancy command
  5. ! we specify the name of the standby group
  6. ! this will source the tunnel from the standby address
  7. crypto map to-remote redundancy ha-out
  8. desc outside
  9. !here's the HSRP config info
  10. standby delay minimum 30 reload 60
  11. standby 1 ip 2.2.2.4
  12. standby 1 timers 1 10
  13. standby 1 preempt
  14. !name of the hsrp group reference by the crypto map
  15. standby 1 name ha-out
  16. standby 1 track fa0/1
  17. interface Fa0/1
  18. ip address 192.168.2.1 255.255.255.0
  19. desc inside
  20. !route map to clear the do not fragment bit on tunnel traffic
  21. ip policy route-map clear-df
  22. !our policy
  23. crypto isakmp policy 1
  24. encr 3des
  25. authentication pre-share
  26. group 2
  27. lifetime 14400
  28. !key for remote
  29. crypto isakmp key test address 1.1.1.1
  30. !transform set
  31. crypto ipsec transform-set to-remote esp-3des esp-sha-hmac
  32. !the actual crypto map
  33. crypto map to-remote 10 ipsec-isakmp
  34. set peer 1.1.1.1
  35. set transform-set to-remote
  36. match address remote
  37. !interesting traffic ACL
  38. ip access-list extended remote
  39. remark Allow access though tunnel to remote
  40. permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
  41. !nat acl. We are denying access to tunnel traffic
  42. ip access-list extended NAT
  43. deny ip any 192.168.0.0 0.0.255.255
  44. permit ip any any
  45. !this is the ACL for the clear DF routemap
  46. ip access-list extended clear-df
  47. permit tcp any 192.168.0.0 0.0.255.255
  48. !nat statement
  49. ip nat inside source list NAT interface FastEthernet0/0 overload
  50. !clear DF route map
  51. route-map clear-df permit 10
  52. match ip address clear-df
  53. set ip df 0

RTR-2 Config:

  1. !apply the crypto map to the outside interface
  2. interface Fa0/0
  3. ip address 2.2.2.3 255.255.255.248
  4. !notice that the crypto map is using the redundancy command
  5. ! we specify the name of the standby group
  6. ! this will source the tunnel from the standby address
  7. crypto map to-remote redundancy ha-out
  8. desc outside
  9. !here's the HSRP config info
  10. standby delay minimum 30 reload 60
  11. standby 1 ip 2.2.2.4
  12. standby 1 timers 1 10
  13. standby 1 preempt
  14. !name of the hsrp group reference by the crypto map
  15. standby 1 name ha-out
  16. standby 1 track fa0/1
  17. interface Fa0/1
  18. ip address 192.168.2.2 255.255.255.0
  19. desc inside
  20. !route map to clear the do not fragment bit on tunnel traffic
  21. ip policy route-map clear-df
  22. !our policy
  23. crypto isakmp policy 1
  24. encr 3des
  25. authentication pre-share
  26. group 2
  27. lifetime 14400
  28. !key for remote
  29. crypto isakmp key test address 1.1.1.1
  30. !transform set
  31. crypto ipsec transform-set to-remote esp-3des esp-sha-hmac
  32. !the actual crypto map
  33. crypto map to-remote 10 ipsec-isakmp
  34. set peer 1.1.1.1
  35. set transform-set to-remote
  36. match address remote
  37. !interesting traffic ACL
  38. ip access-list extended remote
  39. remark Allow access though tunnel to remote
  40. permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
  41. !nat acl. We are denying access to tunnel traffic
  42. ip access-list extended NAT
  43. deny ip any 192.168.0.0 0.0.255.255
  44. permit ip any any
  45. !this is the ACL for the clear DF routemap
  46. ip access-list extended clear-df
  47. permit tcp any 192.168.0.0 0.0.255.255
  48. !nat statement
  49. ip nat inside source list NAT interface FastEthernet0/0 overload
  50. !clear DF route map
  51. route-map clear-df permit 10
  52. match ip address clear-df
  53. set ip df 0


Here in the HSRP router configs you will notice that there are two new commands. The redundancy command was added to the cyrpto map interface command and the name command was used on the standby group. You name the standby group and then reference this in the crypto statement. What this does is source the IPSec tunnel from the HSRP virtual IP.

Leave a Comment

 

*