Configuring the LDP session keepalive timeout

After an LDP session is established, an LSR maintains the integrity of the session by sending keepalive messages. The keepalive timer for each peer session resets whenever it receives any LDP protocol message or a keepalive message on that session. When the keepalive timer expires, LDP concludes that the TCP connection is bad or the peer is dead and terminates the session.

The ka-interval and ka-timeout command configurations are mutually exclusive. You can only have one configured at a time. You must explicitly remove the keepalive interval before changing the keepalive timeout. For example:
device(config-router-mpls-ldp)# ka-interval 11
%Warn: Please clear LDP sessions for the new KA parameter value to take effect on existing sessions
device(config-router-mpls-ldp)# ka-timeout 40
%Error: ka-interval needs to be unconfigured before ka-timeout is configured
device(config-router-mpls-ldp)# no ka-interval
%Warn: Please clear LDP sessions for the new KA parameter value to take effect on existing sessions
device(config-router-mpls-ldp)# ka-timeout 40
%Warn: Please clear LDP sessions for the new KA parameter value to take effect on existing sessions
To configure the keepalive timeout and number of intervals, perform the following steps.
  1. In privileged EXEC mode, enter global configuration mode.
    device# configure terminal
  2. Enable MPLS on the device.
    device(config)# router mpls
  3. Access LDP configuration mode.
    device(config-router-mpls)# ldp
  4. Set the keepalive time interval at which the session is terminated when the keepalive or LDP protocol message is not received.
    device(config-router-mpls-ldp)# ka-timeout 180
    %Warn: Please clear LDP sessions for the new KA parameter value to take effect on existing sessions
    
    In this example, the time after which the session is terminated when the keepalive or LDP protocol message is not received is set to 180 seconds. The possible values are 1 through 65535. A warning is displayed whenever the ka-timeout value is changed.
  5. Configure the number of keepalive intervals after which the session is terminated when no session keepalive or other LDP protocol message is received from the LDP peer.
    device(config-router-mpls-ldp)# ka-int-count 10
    %Warn: Please clear LDP sessions for the new KA parameter value to take effect on existing sessions
    
    In this example, the number of intervals is set to 10.
  6. Verify the keepalive timeout configuration.
    device # show mpls ldp
    Label Distribution Protocol version 1 (deleting it will stop LDP)
     LSR ID: 10.122.122.122, using Loopback 1
     Hello interval: Link 5 sec, Targeted 15 sec
     Hold time value sent in Hellos: Link 15 sec, Targeted 45 sec 
     Keepalive interval: 18 sec, Hold time multiple: 10 intervals 
     Keepalive timeout: 180 sec
     Load sharing: 8
     Tunnel metric: 0
     FEC used for auto discovered peers: current 129, configured 129
     End of LIB: Disabled, Notification time: 60000 ms, tx label silence time: 1000 ms
     Rx label silence time: 1000 ms
     Graceful restart: disabled
      Reconnect time: 0 seconds, Max peer reconnect time: 120 seconds 
      Recovery time: 0 seconds, Max peer recovery time: 120 seconds 
      Forwarding state holding timer: not running
     Label Withdrawal delay: 60 seconds (Default)
    When the keepalive timeout value is configured, the keepalive interval displays as keepalive timeout divided by the keepalive interval count (ka-timeout/ka-in-count).

Example

The following example is the configuration of the previous steps.

device# configure terminal
device(config)# router mpls
device(config-router-mpls)# ldp
device(config-router-mpls-ldp)# ka-timeout 180
device(config-router-mpls-ldp)# ka-int-count 10