This section describes how to configure the IPSec VPN tunnel between two gateways with fixed IP addresses. In this example, both ends can initiate negotiations.
Networking Requirements
As shown in Figure 1, FW_A connects network A to the Internet and FW_B connects network B to the Internet. The networking requirements are as follows:
Network A (10.1.1.0/24) is connected to GigabitEthernet 0/0/3 of FW_A.
Network B (10.1.2.0/24) is connected to GigabitEthernet 0/0/3 of FW_B.
FW_A and FW_B are reachable to each other.
The purpose of this networking is to set up an IPSec tunnel between FW_A and FW_B and to enable the communication between users on network A and network B.
Figure 1 Networking diagram of configuring a site-to-site IPSec tunnel
Data Planning
Item
|
Data
|
FW_A
|
Interface: GigabitEthernet 0/0/3
IP address: 10.1.1.1/24
Security zone: Trust
|
Interface: GigabitEthernet 0/0/1
IP address: 1.1.3.1/24
Security zone: Untrust
|
IPSec configuration
Scenario: Site-to-site
Peer IP Address: 1.1.5.1
Authentication Type: Pre-Shared Key
Pre-Shared Key: Test!1234
Local ID: IP Address
Peer ID: IP Address
|
FW_B
|
Interface: GigabitEthernet 0/0/1
IP address: 1.1.5.1/24
Security zone: Untrust
|
Interface: GigabitEthernet 0/0/3
IP address: 10.1.2.1/24
Security zone: Trust
|
IPSec configuration
Scenario: Site-to-site
Peer IP Address: 1.1.3.1
Authentication Type: Pre-Shared Key
Pre-Shared Key: Test!1234
Local ID: IP Address
Peer ID: IP Address
|
Configuration Roadmap
The procedure and roadmap for configuring FW_A and FW_B are similar:
- Configure interfaces.
- Configure security policies to allow specific subnets to communicate.
- Create a static route to the peer end.
- Configure the IPSec policy, including basic IPSec policy information, data flow to be protected by IPSec, and proposal parameters for security association negotiation.
Procedure
- Configure FW_A.
- Set an IP address for each interface and assign the interfaces to security zones.
- Choose .
Click
of GE0/0/1> and set the following parameters:
Zone
|
untrust
|
IPv4
|
IP Address
|
1.1.3.1/24
|
- Click OK.
Repeat the preceding steps to set the parameters of the GE0/0/3 interface.
Zone
|
trust
|
IPv4
|
IP Address
|
10.1.1.1/24
|
- Configure security policies to allow specific subnets to communicate.
Choose .
Click Add and set the parameters of the security policy for the Trust->Untrust interzone as follows:
Name
|
policy_ipsec_1
|
Source Zone
|
trust
|
Destination Zone
|
untrust
|
Source Address/Region
|
10.1.1.0/24
|
Destination Address/Region
|
10.1.2.0/24
|
Action
|
Permit
|
- Click OK.
Repeat preceding steps to configure security policies for the Untrust -> Trust, Untrust -> Local, and Local -> Untrust interzones.
The parameters of the security policy for the Untrust -> Trust interzone are as follows:
Name
|
policy_ipsec_2
|
Source Zone
|
untrust
|
Destination Zone
|
trust
|
Source Address/Region
|
10.1.2.0/24
|
Destination Address/Region
|
10.1.1.0/24
|
Action
|
Permit
|
The parameters of the security policy for the Untrust -> Local interzone are as follows:
Name
|
policy_ipsec_3
|
Source Zone
|
untrust
|
Destination Zone
|
local
|
Source Address/Region
|
1.1.5.1/32
|
Destination Address/Region
|
1.1.3.1/32
|
Action
|
Permit
|
The parameters of the security policy for the Local -> Untrust interzone are as follows:
Name
|
policy_ipsec_4
|
Source Zone
|
local
|
Destination Zone
|
untrust
|
Source Address/Region
|
1.1.3.1/32
|
Destination Address/Region
|
1.1.5.1/32
|
Action
|
Permit
|
The local-untrust interzone policy controls whether IKE negotiation packets can pass through the FW. This policy can use the source and destination addresses, protocol, or port as the matching condition. In this example, the source and destination addresses are used as the matching condition. To use the protocol or port as the matching condition, you need to enable ESP and port 500 for UDP (port 4500 also in NAT traversal scenarios).
- Configure a route to the peer end. In this example, the next hop of the route from FW_A to FW_B is 1.1.3.2.
- Choose .

Click Add and set the following parameters.
Destination Address/Mask
|
10.1.2.0/255.255.255.0
|
Next Hop
|
1.1.3.2
|
Click OK.
- Click Add and set the following parameters, and click OK.
Destination Address/Mask
|
1.1.5.0/255.255.255.0
|
Next Hop
|
1.1.3.2
|
- Configure the IPSec tunnel on FW_A.
- Choose , click Add, and select Scenario as Site-to-site.

- Configure the basic IPSec policy information, specify the remote gateway, and set the pre-shared key to Test!1234.

- Under Data Flow to Encrypt, click Add to add a data flow as follows.

During packet forwarding, the IPSec module is behind the NAT module (NAT server, destination NAT, and source NAT). You need to ensure that the NAT server and destination NAT do not affect the processing of IPSec-protected data flow. The following requirements must be met:
Run the display firewall server-map command to check the source and destination IP addresses in the servermap table.
Ensure that the IPSec-protected data flow does not match the servermap table or reverse servermap table created on the NAT server. Otherwise, destination addresses of packets will be translated.
Run the display acl acl-number commands to check ACL information of the destination NAT policy.
Ensure that the IPSec-protected data flow does not match the destination NAT policy. Otherwise, destination addresses of packets will be translated.
Run the display current-configuration configuration policy-nat command to check source NAT policy information.
Ensure that the IPSec-protected data flow does not match the source NAT policy.
If NAT is required for the IPSec-protected data flow, the ACL needs to match the post-NAT IP address.
- Optional: Set the parameters of IPSec and IKE. Use the default parameters in this example. If you want to change the value of a parameter, expand Advanced under IKE/IPSec Proposal. You must ensure that the parameter settings are the same on both tunnel ends.
- Click Apply. The configuration of FW_A is complete.
- Configure FW_B.
- Set an IP address for each interface and assign the interfaces to security zones.
- Choose .
Click
of GE0/0/1> and set the following parameters:
Zone
|
untrust
|
IPv4
|
IP Address
|
1.1.5.1/24
|
- Click OK.
Repeat the preceding steps to set the parameters of the GE0/0/3 interface.
Zone
|
trust
|
IPv4
|
IP Address
|
10.1.2.1/24
|
- Configure security policies to allow specific subnets to communicate.
Choose .
Click Add and set the parameters of the security policy for the Trust->Untrust interzone as follows:
Name
|
policy_ipsec_1
|
Source Zone
|
trust
|
Destination Zone
|
untrust
|
Source Address/Region
|
10.1.2.0/24
|
Destination Address/Region
|
10.1.1.0/24
|
Action
|
Permit
|
- Click OK.
Repeat preceding steps to configure security policies for the Untrust -> Trust, Untrust -> Local, and Local -> Untrust interzones.
The parameters of the security policy for the Untrust -> Trust interzone are as follows:
Name
|
policy_ipsec_2
|
Source Zone
|
untrust
|
Destination Zone
|
trust
|
Source Address/Region
|
10.1.1.0/24
|
Destination Address/Region
|
10.1.2.0/24
|
Action
|
Permit
|
The parameters of the security policy for the Untrust -> Local interzone are as follows:
Name
|
policy_ipsec_3
|
Source Zone
|
untrust
|
Destination Zone
|
local
|
Source Address/Region
|
1.1.3.1/32
|
Destination Address/Region
|
1.1.5.1/32
|
Action
|
Permit
|
The parameters of the security policy for the Local -> Untrust interzone are as follows:
Name
|
policy_ipsec_4
|
Source Zone
|
local
|
Destination Zone
|
untrust
|
Source Address/Region
|
1.1.5.1/32
|
Destination Address/Region
|
1.1.3.1/32
|
Action
|
Permit
|
The local-untrust interzone policy controls whether IKE negotiation packets can pass through the FW. This policy can use the source and destination addresses, protocol, or port as the matching condition. In this example, the source and destination addresses are used as the matching condition. To use the protocol or port as the matching condition, you need to enable ESP and port 500 for UDP (port 4500 also in NAT traversal scenarios).
- Configure a route to the peer end. In this example, the next hop of the route from FW_A to FW_B is 1.1.5.2.
- Choose .
Click Add and set the following parameters.
Destination Address/Mask
|
10.1.1.0/255.255.255.0
|
Next Hop
|
1.1.5.2
|
Click OK.
- Click Add and set the following parameters, and click OK.
Destination Address/Mask
|
1.1.3.0/255.255.255.0
|
Next Hop
|
1.1.5.2
|
- Configure the IPSec tunnel on FW_B.
- Choose , click Add, and select Scenario as Site-to-site.
- Configure the basic IPSec policy information, specify the remote gateway, and set the pre-shared key to Test!1234.

- Under Data Flow to Be Encrypted, click Add to add a data flow as follows.

During packet forwarding, the IPSec module is behind the NAT module (NAT server, destination NAT, and source NAT). You need to ensure that the NAT server and destination NAT do not affect the processing of IPSec-protected data flow. The following requirements must be met:
Run the display firewall server-map command to check the source and destination IP addresses in the servermap table.
Ensure that the IPSec-protected data flow does not match the servermap table or reverse servermap table created on the NAT server. Otherwise, destination addresses of packets will be translated.
Run the display acl acl-number commands to check ACL information of the destination NAT policy.
Ensure that the IPSec-protected data flow does not match the destination NAT policy. Otherwise, destination addresses of packets will be translated.
Run the display current-configuration configuration policy-nat command to check source NAT policy information.
Ensure that the IPSec-protected data flow does not match the source NAT policy.
If NAT is required for the IPSec-protected data flow, the ACL needs to match the post-NAT IP address.
- Optional: Set the parameters of IPSec and IKE. Use the default parameters in this examples. If you want to change the value of a parameter, expand Advanced under IKE/IPSec Proposal. You must ensure that the parameter settings are the same on both tunnel ends.
- Click Apply. The configuration of FW_B is complete.
Configuration Verification
Access a host or server on the headquarters network from a host on the branch network. The access succeeds.
On FW_A, choose to display the established tunnels.
Policy Name
|
Status
|
Local Address
|
Peer Address
|
policy_1
|
IKE and IPSec negotiations succeed.
|
1.1.3.1
|
1.1.5.1
|
On FW_B, choose to display the established tunnels.
Policy Name
|
Status
|
Local Address
|
Peer Address
|
policy_1
|
IKE and IPSec negotiations succeed.
|
1.1.5.1
|
1.1.3.1
|