As the gateway of a branch, the FW uses the IPSec intelligent link selection function for dynamic IPSec tunnel switching.
As shown in Figure 1, the headquarters and branch connect to the Internet through FW_A and FW_B, respectively. FW_A connects to the Internet through one link. FW_B connects to the Internet through two links.
Requirements are as follows:
The local interface in IPSec intelligent link selection can be an interface that dynamically obtains IP addresses through PPPoE or DHCP. That is, when GE0/0/1 or GE0/0/2 on FW_B in Figure 1 obtains IP addresses through PPPoE or DHCP, the IPSec intelligent link selection function is also available.
The method for configuring IPSec intelligent link selection when the local interface has a fixed IP address is the same as that when the local interface obtains IP addresses dynamically.
Item |
FW_A |
FW_B |
|
|---|---|---|---|
Outside interface |
Interface: GigabitEthernet 0/0/1 IP address: 3.3.3.3/24 Security zone: Untrust |
||
Inside interface |
Interface: GigabitEthernet 0/0/3 IP address: 10.1.1.1/24 Security zone: Trust |
Interface: GigabitEthernet 0/0/3 IP address: 10.1.2.1/24 Security zone: Trust |
|
Method of configuring an IPSec policy |
Template |
IKE mode + IPSec intelligent link selection |
|
IPSec proposal |
Encapsulation mode |
Tunnel mode |
Tunnel mode |
IPSec protocol |
ESP |
ESP |
|
ESP authentication algorithm |
SHA2-256 |
SHA2-256 |
|
ESP encryption algorithm |
AES-256 |
AES-256 |
|
IKE proposal |
Authentication method |
Pre-shared key |
Pre-shared key |
Authentication algorithm |
SHA2-256 |
SHA2-256 |
|
Encryption algorithm |
aes-xcbc-96 and hmac-sha2-256 |
aes-xcbc-96 and hmac-sha2-256 |
|
IKE peer |
Negotiation mode |
Main mode |
Main mode |
Pre-shared key |
Admin@123 |
Admin@123 |
|
Identity type |
IP |
IP |
|
Remote IP address |
Unspecified |
3.3.3.3 |
|
Version |
V1 |
V1 |
|
After the configuration is complete, run the display ipsec smart-link profile command on FW_B. The command output shows that FW_B at the branch first uses Link 1 (1.1.1.1 -> 3.3.3.3) to establish an IPSec tunnel.
<FW_B> display ipsec smart-link profile name pro1
===========================================
Name :pro1
Detection number :10
Detection interval :1
Detection source IP :1.1.1.1
Detection destination IP :3.3.3.3
Cycles :3
Switched times :0
Switch mode :detection-based
State :enable
IPSec policy alias :map1
link list:
ID local-address remote-address loss(%) delay(ms) state
1 1.1.1.1 3.3.3.3 0 0 active
2 2.2.2.2 3.3.3.3 0 0 inactive
===========================================
After you run the display ike sa and display ipsec sa commands on FW_A and FW_B, the output indicates that the SAs are established. Take FW_B as an example. If the following information is displayed, the IKE SA and IPSec SA are successfully established.
<FW_B> display ipsec sa =============================== Interface: GigabitEthernet0/0/1 path MTU: 1500 =============================== ----------------------------- IPsec policy name: "map1" sequence number: 10000 mode: isakmp vpn: public ----------------------------- connection id: 1158 rule number: 5 encapsulation mode: tunnel holding time: 0d 0h 0m 14s tunnel local : 1.1.1.1 tunnel remote: 3.3.3.3 flow source: 10.1.2.0-10.1.2.255 0-65535 0 flow destination: 10.1.1.0-10.1.1.255 0-65535 0 [inbound ESP SAs] spi: 35053809 (0x216e0f1) vpn: public said: 182 cpuid: 0x0000 proposal: ESP-ENCRYPT-AES ESP-AUTH-SHA2-256 sa remaining key duration (kilobytes/sec): 200000000/3586 max received sequence-number: 1 udp encapsulation used for nat traversal: N [outbound ESP SAs] spi: 128477047 (0x7a86777) vpn: public said: 183 cpuid: 0x0000 proposal: ESP-ENCRYPT-AES ESP-AUTH-SHA2-256 sa remaining key duration (kilobytes/sec): 200000000/3586 max sent sequence-number: 1 udp encapsulation used for nat traversal: N ----------------------------- IPsec policy name: "map1" sequence number: 10000 mode: isakmp vpn: public ----------------------------- connection id: 1159 rule number: 10 encapsulation mode: tunnel holding time: 0d 0h 0m 15s tunnel local : 1.1.1.1 tunnel remote: 3.3.3.3 flow source: 1.1.1.1-1.1.1.1 0-65535 1 flow destination: 3.3.3.3-3.3.3.3 0-65535 1 [inbound ESP SAs] spi: 262933667 (0xfac0ca3) vpn: public said: 184 cpuid: 0x0000 proposal: ESP-ENCRYPT-AES ESP-AUTH-SHA2-256 sa remaining key duration (kilobytes/sec): 200000000/3585 max received sequence-number: 7 udp encapsulation used for nat traversal: N [outbound ESP SAs] spi: 141108708 (0x86925e4) vpn: public said: 185 cpuid: 0x0000 proposal: ESP-ENCRYPT-AES ESP-AUTH-SHA2-256 sa remaining key duration (kilobytes/sec): 200000000/3585 max sent sequence-number: 8 udp encapsulation used for nat traversal: N
<FW_B> display ike sa
current ike sa number: 3
--------------------------------------------------------------------------------------------------
conn-id peer flag phase vpn
--------------------------------------------------------------------------------------------------
1159 3.3.3.3 RD|ST|A v2:2 public
1158 3.3.3.3 RD|ST|A v2:2 public
1157 3.3.3.3 RD|ST|D|A v2:1 public
flag meaning
RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUT
TD--DELETING NEG--NEGOTIATING D--DPD M--ACTIVE S--STANDBY
A--ALONE
Shut down GE0/0/1 on the FW_B and then run the display ipsec smart-link profile command on FW_B. The command output shows that FW_B automatically uses Link 2 (2.2.2.2 -> 3.3.3.3) to establish an IPSec tunnel.
<FW_B> display ipsec smart-link profile name pro1
===========================================
Name :pro1
Detection number :10
Detection interval :1
Detection source IP :2.2.2.2
Detection destination IP :3.3.3.3
Cycles :3
Switched times :0
Switch mode :detection-based
State :enable
IPSec policy alias :map1
link list:
ID local-address remote-address loss(%) delay(ms) state
1 1.1.1.1 3.3.3.3 50 0 inactive
2 2.2.2.2 3.3.3.3 0 0 active
===========================================
# Configuration script on FW_A (Headquarters):
# acl number 3000 rule 5 permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255 rule 10 permit icmp source 3.3.3.3 0 destination 1.1.1.1 0 rule 15 permit icmp source 3.3.3.3 0 destination 2.2.2.2 0 # ike proposal 10 authentication-method pre-share authentication-algorithm sha2-256 integrity-algorithm aes-xcbc-96 hmac-sha2-256 # ike peer b pre-shared-key %$%$921NG0I(@0aT8y@GhOS97G>5%$%$ ike-proposal 10 undo version 2 # ipsec proposal tran1 encapsulation-mode tunnel transform esp esp authentication-algorithm sha2-256 esp encryption-algorithm aes-256 # ipsec policy-template map_temp 1 security acl 3000 ike-peer b proposal tran1 route inject dynamic preference 65 # ipsec policy map1 10 isakmp template map_temp # interface GigabitEthernet0/0/3 ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 ip address 3.3.3.3 255.255.255.0 ipsec policy map1 service-manage ping permit # firewall zone trust set priority 85 add interface GigabitEthernet0/0/3 # firewall zone untrust set priority 5 add interface GigabitEthernet0/0/1 # security-policy rule name 1 source-zone trust destination-zone untrust source-address 10.1.1.0 24 destination-address 10.1.2.0 24 action permit rule name 2 source-zone untrust destination-zone trust source-address 10.1.2.0 24 destination-address 10.1.1.0 24 action permit rule name 3 source-zone local destination-zone untrust source-address 3.3.3.3 32 destination-address 1.1.1.1 32 destination-address 2.2.2.2 32 action permit rule name 4 source-zone untrust destination-zone local source-address 1.1.1.1 32 source-address 2.2.2.2 32 destination-address 3.3.3.3 32 action permit
# Configuration script on FW_B (Branch):
# acl number 3000 rule 5 permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 # ike proposal 10 authentication-method pre-share authentication-algorithm sha2-256 integrity-algorithm aes-xcbc-96 hmac-sha2-256 # ike peer a1 pre-shared-key %$%$QoAR'zsMp!&5y%7qm\)XOZQH%$%$ ike-proposal 10 remote-address 3.3.3.3 undo version 2 # ipsec proposal tran1 encapsulation-mode tunnel transform esp esp authentication-algorithm sha2-256 esp encryption-algorithm aes-256 # ipsec smart-link profile pro1 link-quality-detection interval 1 number 10 auto-switch cycles 3 link-quality-threshold loss 30 link-quality-threshold delay 500 link 1 interface GigabitEthernet 0/0/1 local 1.1.1.1 nexthop 1.1.1.254 remote 3.3.3.3 link 2 interface GigabitEthernet 0/0/2 local 2.2.2.2 nexthop 2.2.2.254 remote 3.3.3.3 # ipsec policy map1 10 isakmp security acl 3000 ike-peer a1 proposal tran1 smart-link profile pro1 route inject dynamic # interface GigabitEthernet0/0/3 ip address 10.1.2.1 255.255.255.0 # interface GigabitEthernet0/0/2 ip address 2.2.2.2 255.255.255.0 gateway 2.2.2.254 # interface GigabitEthernet0/0/1 ip address 1.1.1.1 255.255.255.0 gateway 1.1.1.254 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/3 # firewall zone untrust set priority 5 add interface GigabitEthernet0/0/1 add interface GigabitEthernet0/0/2 # security-policy rule name 1 source-zone trust destination-zone untrust source-address 10.1.2.0 24 destination-address 10.1.1.0 24 action permit rule name 2 source-zone untrust destination-zone trust source-address 10.1.1.0 24 destination-address 10.1.2.0 24 action permit rule name 3 source-zone local destination-zone untrust source-address 1.1.1.1 32 source-address 2.2.2.2 32 destination-address 3.3.3.3 32 action permit rule name 4 source-zone untrust destination-zone local source-address 3.3.3.3 32 destination-address 1.1.1.1 32 destination-address 2.2.2.2 32 action permit