The keepalive command enables the Keepalive detection function of a soft GRE tunnel and configures Keepalive parameters.
The undo keepalive command disables the Keepalive detection function of a soft GRE tunnel and restores the default Keepalive parameter settings.
By default, the Keepalive detection function of a soft GRE tunnel is disabled, the interval for sending Keepalive packets is 5 seconds, and the maximum number of Keepalive packet retransmissions is 3.
Parameter | Description | Value |
---|---|---|
period period | Specifies the interval for sending Keepalive packets. |
The value is an integer that ranges from 1 to 32767, in seconds. |
retry-times retry-times | Specifies the maximum number of Keepalive packet retransmissions. |
The value is an integer that ranges from 1 to 255. |
Usage Scenario
When a network fault occurs and the remote end of a soft GRE tunnel becomes unreachable, an AP cannot detect the network fault and continues sending packets to the remote end. These packets will waste device resources and bandwidth of the intermediate network. To prevent this situation, you can enable the Keepalive detection function so that the AP can detect the soft GRE tunnel status. When the remote end is unreachable, the AP stops sending packets to the remote end; otherwise, the AP continues sending packets. By detecting the status of the soft GRE tunnel, an AP can determine whether to send packets to the remote end. This prevents tunnel resource waste and reduces bandwidth occupation.
After the Keepalive detection function is enabled on the source end of a soft GRE tunnel, the AP starts a tunnel-unreachable counter to periodically send and count Keepalive packets to check soft GRE tunnel connectivity. The tunnel-unreachable counter is incremented by 1 every time a Keepalive probe is sent and no response is received within the detection period. If no response is received when the value of the counter reaches the value of retry-times, the tunnel-unreachable counter is cleared. If the source end does not receive any response packet when the tunnel-unreachable counter value reaches retry-times, the source end considers the remote end unreachable and tears down the tunnel; otherwise, the source end considers the remote end reachable.
Precautions
If you do not specify the parameters period period [ retry-times retry-times ] in the keepalive command, the Keepalive detection function is enabled and the parameters period period [ retry-times retry-times ] are restored to the default settings.
When you run the keepalive command multiple times, the latest configuration takes effect.
The Keepalive detection function takes effect unidirectionally. To enable the Keepalive detection function on both ends of a soft GRE tunnel, run the keepalive command on each end of the tunnel. The Keepalive configuration takes effect on one end even if the function is disabled on the other end. However, you are advised to enable the Keepalive detection function on both ends.