Configuring an IPsec policy

IPsec policies define which IPsec proposals 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:

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

Required

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 proposal to the IPsec policy.

proposal proposal-name

By default, an IPsec policy references no IPsec proposal.

A manual IPsec policy can reference only one IPsec proposal. To change an IPsec proposal 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

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 IPsec policy that uses IKE, delete the manual IPsec policy, and then use IKE to configure an IPsec policy.


Configuring an IPsec policy that uses IKE (available only in FIPS mode)

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

Before you configure an IPsec policy that uses IKE, 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 IPsec policy that uses IKE, follow these guidelines:

To directly configure an IPsec policy that uses IKE:

Step

Command

Remark

1. Enter system view.

system-view

N/A

2. Create an IPsec policy that uses IKE 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 proposals to the IPsec policy.

proposal proposal-name&<1-6>

By default, an IPsec policy references no IPsec proposal.

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 the chapter "IKE configuration."

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.