Terminating an IPSec tunnel,

Unanswered Question
Feb 10th, 2008

Hi every1, if i want to terminate an IPsec session forcefully after a specified amount of time like 5 hours what command do i need? i am using simple site to site vpn between 2 sites, i want the ipsec tunnel to be terminated so that the counters in show crypto ipsec sa equals to zero..

Thanks

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
illusion_rox Mon, 02/11/2008 - 00:56

Sorry i forgot to mention AUTOMATICALLY, i want to ipsec tunnel ( phase 2 ) to be terminated automatically after very 5 hours.

Thanks

manufc Mon, 02/11/2008 - 01:08

Hi,

Depending on your version of IOS, you can script commands using kron.

Cheers

srue Mon, 02/11/2008 - 09:54

or set your ipsec lifetimes for five hours (18000seconds)...i don't know if this resets counters or not though.

illusion_rox Mon, 02/11/2008 - 20:25

hi srue, are you sure that ipsec lifetimes terminate the tunnel ?? coz i heard that it just re-authenticates the tunnel !! so kindly confirm me that it terminates the tunnel.

Thanks

rkazmierczak Tue, 02/12/2008 - 04:51

There are 2 lifetimes though, for phase 1 and 2. They will terminate the tunnel but any interesting traffic will bring it up again of course.

srue Tue, 02/12/2008 - 10:41

How These Lifetimes Work

Assuming that the particular crypto map entry does not have lifetime values configured, when the router requests new security associations it will specify its global lifetime values in the request to the peer; it will use this value as the lifetime of the new security associations. When the router receives a negotiation request from the peer, it will use the smaller of either the lifetime value proposed by the peer or the locally configured lifetime value as the lifetime of the new security associations.

The security association (and corresponding keys) will expire according to whichever comes sooner, either after the number of seconds has passed (specified by the seconds keyword) or after the amount of traffic in kilobytes is passed (specified by the kilobytes keyword). Security associations that are established manually (via a crypto map entry marked as ipsec-manual) have an infinite lifetime.

A new security association is negotiated before the lifetime threshold of the existing security association is reached, to ensure that a new security association is ready for use when the old one expires. The new security association is negotiated either 30 seconds before the seconds lifetime expires or when the volume of traffic through the tunnel reaches 256 kilobytes less than the kilobytes lifetime (whichever comes first).

If no traffic has passed through the tunnel during the entire life of the security association, a new security association is not negotiated when the lifetime expires. Instead, a new security association will be negotiated only when IPSec sees another packet that should be protected.

http://cisco.com/univercd/cc/td/doc/product/software/ios122/122cgcr/fsecur_c/fipsenc/scfipsec.htm

Actions

This Discussion