Configuring an IPsec policy

IPsec policies define which IPsec transform sets should be used to protect which data flows. An IPsec policy is uniquely identified by its name and sequence number.

IPsec policies fall into two categories:

Configuring a manual IPsec policy

To guarantee successful SA negotiations, follow these guidelines when configuring manual IPsec policies at the two ends of an IPsec tunnel:

Follow these guidelines when you configure an IPsec policy for an IPv6 routing protocol:

Before you configure a manual IPsec policy, configure ACLs used for identifying protected traffic and IPsec transform sets. ACLs are not required for IPsec policies for an IPv6 protocol.

To configure a manual IPsec policy:

Step

Command

Remarks

1. Enter system view.

system-view

N/A

2. Create a manual IPsec policy and enter its view.

ipsec policy policy-name seq-number manual

By default, no IPsec policy exists.

3. Assign an ACL to the IPsec policy.

security acl acl-number

Not needed for IPsec policies to be applied to IPv6 routing protocols and required for other applications.

By default, an IPsec policy references no ACL.

An IPsec policy can reference only one ACL. If you specify multiple ACLs for an IPsec policy, only the last specified ACL takes effect.

4. Assign an IPsec transform set to the IPsec policy.

transform-set transform-set-name

By default, an IPsec policy references no IPsec transform set.

A manual IPsec policy can reference only one IPsec transform set. To change an IPsec transform set for an IPsec policy, you must remove the current reference first.

5. Configure the two ends of the IPsec tunnel.

  • Configure the local address of the tunnel:tunnel local ip-address

  • Configure the remote address of the tunnel:tunnel remote ip-address

Configuring the local address of the tunnel is not needed for IPsec policies to be applied to IPv6 routing protocols and required for other applications.

Configuring the remote address of the tunnel is required.

Both the local and remote addresses are not configured by default.

6. Configure an SPI for an SA.

sa spi { inbound | outbound } { ah | esp } spi-number

By default, no SPI is configured for an SA.

7. Configure keys for the SA.

  • Configure an authentication key in hexadecimal for AH:sa authentication-hex { inbound | outbound } ah [ cipher string-key | simple hex-key ]

  • Configure an authentication key in characters for AH:sa string-key { inbound | outbound } ah [ cipher | simple ] string-key

  • Configure a key in characters for ESP:sa string-key { inbound | outbound } esp [ cipher | simple ] string-key

  • Configure an authentication key in hexadecimal for ESP:sa authentication-hex.{ inbound | outbound } esp [ cipher string-key | simple hex-key ]

  • Configure an encryption key in hexadecimal for ESP:sa encryption-hex.{ inbound | outbound } esp [ cipher string-key | simple hex-key ]

Configure keys properly for the security protocol (AH or ESP) you have specified.

If you configure a key in two modes (in characters and in hexadecimal), only the last configured one will be used.

If you configure a key in characters for ESP, the device automatically generates an authentication key and an encryption key for ESP.

The sa string-key command is not supported in FIPS mode.


[NOTE: ]

NOTE:

You cannot change the creation mode of an IPsec policy from manual to through IKE, or vice versa. To create an IKE-based IPsec policy, delete the manual IPsec policy, and then use IKE to configure an IPsec policy.


Configuring an IKE-based IPsec policy (available only in FIPS mode)

To configure an IKE-based IPsec policy, directly configure it by configuring the parameters in IPsec policy view.

Before you configure an IKE-based IPsec policy, configure the ACLs and the IKE peer for the IPsec policy.

The parameters for the local and remote ends must match.

When you configure an IKE-based IPsec policy, follow these guidelines:

To directly configure an IKE-based IPsec policy:

Step

Command

Remarks

1. Enter system view.

system-view

N/A

2. Create an IKE-based IPsec policy and enter its view.

ipsec policy policy-name seq-number isakmp

By default, no IPsec policy exists.

3. Configure an IPsec connection name.

connection-name name

Optional.

By default, no IPsec connection name is configured.

4. Assign an ACL to the IPsec policy.

security acl acl-number

By default, an IPsec policy references no ACL.

An IPsec policy can reference only one ACL. If you specify multiple ACLs for an IPsec policy, only the last specified ACL takes effect.

5. Assign IPsec transform sets to the IPsec policy.

transform-set transform-set-name&<1-6>

By default, an IPsec policy references no IPsec transform set.

6. Specify an IKE peer for the IPsec policy.

ike-peer peer-name

An IPsec policy cannot reference any IKE peer that is already referenced by an IPsec profile, and vice versa.

7. Enable and configure the perfect forward secrecy feature for the IPsec policy.

pfs dh-group14

Optional.

By default, the PFS feature is not used for negotiation.

For more information about PFS, see "Configuring IKE."

8. Set the SA lifetime.

sa duration { time-based seconds | traffic-based kilobytes }

Optional.

By default, the global SA lifetime is used.

9. Enable the IPsec policy.

policy enable

Optional.

Enabled by default.

10. Return to system view.

quit

N/A

11. Set the global SA lifetime.

ipsec sa global-duration { time-based seconds | traffic-based kilobytes }

Optional.

3600 seconds for time-based SA lifetime by default.

1843200 kilobytes for traffic-based SA lifetime by default.

With SAs to be established through IKE negotiation, an IPsec policy can reference up to six IPsec transform sets. During negotiation, IKE searches for a fully matched IPsec transform set at the two ends of the expected IPsec tunnel. If no match is found, no SA can be set up and the packets expecting to be protected will be dropped.

During IKE negotiation for an IPsec policy with PFS enabled, an additional key exchange is performed. If the local end uses PFS, the remote end must also use PFS for negotiation and both ends must use the same DH group. Otherwise, the negotiation will fail.

An SA uses the global lifetime settings when it is not configured with lifetime settings in IPsec policy view. When negotiating to set up SAs, IKE uses the local lifetime settings or those proposed by the peer, whichever are smaller.

You cannot change the creation mode of an IPsec policy from IKE to manual, or vice versa. To create a manual IPsec policy, delete the IKE-mode IPsec policy, and then configure the manual IPsec policy.