As the gateway of a branch, the FW uses the IPSec intelligent link selection function for dynamic IPSec tunnel switchover.
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, and FW_B connects to the Internet through two links and has OSPF running at its egress.
Requirements are as follows:
Item |
FW_A |
FW_B |
|
|---|---|---|---|
WAN interface |
Interface number: GigabitEthernet 0/0/1 IP address: 3.3.3.3/24 Security zone: Untrust |
|
|
LAN interface |
Interface number: GigabitEthernet 0/0/3 IP address: 10.1.1.1/24 Security zone: Trust |
Interface number: GigabitEthernet 0/0/3 IP address: 10.1.2.1/24 Security zone: Trust |
|
IPSec policy type |
Template mode |
IKE mode + IPSec intelligent link selection |
|
IPSec proposal |
Encapsulation mode |
Tunnel mode |
Tunnel mode |
Security 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-128 |
aes-128 |
|
IKE peer |
Negotiation mode |
Main mode |
Main mode |
Pre-shared key |
Admin@123 |
Admin@123 |
|
Identity type |
IP address |
IP address |
|
Peer IP address |
Unspecified |
3.3.3.3 |
|
Version |
V1 |
V1 |
|
For details, see the configuration manual for the corresponding router. You must ensure that FW_B and FW_A are reachable to each other over the Internet by configuring the intermediate router.
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
Switch mode :route-based
State :enable
IPSec policy alias :map1-10
link list:
ID local-address remote-address loss(%) delay(ms) state
1 1.1.1.1 3.3.3.3 -- -- active
2 2.2.2.2 3.3.3.3 -- -- inactive
===========================================
Run the display ike sa and display ipsec sa commands on FW_A and FW_B to display the established IKE and IPSec SAs. Take FW_B as an example. If the following information is displayed, the IKE and IPSec SAs are successfully established.
<FW_B> display ike sa
IKE SA information :
Conn-ID Peer VPN Flag(s) Phase RemoteType RemoteID
------------------------------------------------------------------------------------------------------------------------------------
66 3.3.3.3:500 RD|ST|A v1:2 IP 3.3.3.3
65 3.3.3.3:500 RD|ST|A v1:1 IP 3.3.3.3
Number of IKE SA : 2
------------------------------------------------------------------------------------------------------------------------------------
Flag Description:
RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUT
HRT--HEARTBEAT LKG--LAST KNOWN GOOD SEQ NO. BCK--BACKED UP
M--ACTIVE S--STANDBY A--ALONE NEG--NEGOTIATING
<FW_B> display ipsec sa ipsec sa information: =============================== Interface: GigabitEthernet0/0/1 =============================== ----------------------------- IPSec policy name: "map1" Sequence number : 10 Acl group : 3000 Acl rule : 5 Mode : ISAKMP ----------------------------- Connection ID : 66 Encapsulation mode: Tunnel Holding time : 0d 0h 8m 52s Tunnel local : 1.1.1.1:500 Tunnel remote : 3.3.3.3:500 Flow source : 10.1.2.0/255.255.255.0 0/0 Flow destination : 10.1.1.0/255.255.255.0 0/0 [Outbound ESP SAs] SPI: 194713812 (0xb9b18d4) Proposal: ESP-ENCRYPT-AES-256 ESP-AUTH-SHA2-256-128 SA remaining key duration (kilobytes/sec): 5242880/3068 Max sent sequence-number: 11 UDP encapsulation used for NAT traversal: N SA encrypted packets (number/bytes): 10/840 [Inbound ESP SAs] SPI: 190232433 (0xb56b771) Proposal: ESP-ENCRYPT-AES-256 ESP-AUTH-SHA2-256-128 SA remaining key duration (kilobytes/sec): 5242880/3068 Max received sequence-number: 1 UDP encapsulation used for NAT traversal: N SA decrypted packets (number/bytes): 5/420 Anti-replay : Enable Anti-replay window size: 1024
Shut down GE0/0/1 on 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
Switch mode :route-based
State :enable
IPSec policy alias :map1-10
link list:
ID local-address remote-address loss(%) delay(ms) state
1 1.1.1.1 3.3.3.3 -- -- inactive
2 2.2.2.2 3.3.3.3 -- -- active
===========================================
Configuration script of FW_A:
# 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 # ike proposal 10 encryption-algorithm aes-128 dh group14 authentication-algorithm sha2-256 authentication-method pre-share # ike peer b pre-shared-key %$%$921NG0I(@0aT8y@GhOS97G>5%$%$ ike-proposal 10 undo version 2 # ipsec proposal tran1 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 # ipsec policy map1 10 isakmp template map_temp # interface GigabitEthernet0/0/1 ip address 3.3.3.3 255.255.255.0 ipsec policy map1 # interface GigabitEthernet0/0/3 ip address 10.1.1.1 255.255.255.0 # 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 mask 255.255.255.0 destination-address 10.1.2.0 mask 255.255.255.0 action permit rule name 2 source-zone untrust destination-zone trust source-address 10.1.2.0 mask 255.255.255.0 destination-address 10.1.1.0 mask 255.255.255.0 action permit rule name 3 source-zone local destination-zone untrust source-address 3.3.3.3 mask 255.255.255.255 destination-address 1.1.1.1 mask 255.255.255.255 destination-address 2.2.2.2 mask 255.255.255.255 action permit rule name 4 source-zone untrust destination-zone local source-address 1.1.1.1 mask 255.255.255.255 source-address 2.2.2.2 mask 255.255.255.255 destination-address 3.3.3.3 mask 255.255.255.255 action permit
Configuration script of FW_B:
#
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
encryption-algorithm aes-128
dh group14
authentication-algorithm sha2-256
authentication-method pre-share
#
ike peer a1
undo version 2
pre-shared-key %^%#t)H+5Zh1U%O5M~G{~Vg4o^T)7FEJUS{zD[Q@\(&3%^%#
ike-proposal 10
remote-address 3.3.3.3
#
ipsec proposal tran1
esp authentication-algorithm sha2-256
esp encryption-algorithm aes-256
#
ipsec smart-link profile pro1
link-switch-mode route-based
link 1 interface GigabitEthernet0/0/1 local 1.1.1.1 remote 3.3.3.3
link 2 interface GigabitEthernet0/0/2 local 2.2.2.2 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/1
ip address 1.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 2.2.2.2 255.255.255.0
#
interface GigabitEthernet0/0/3
ip address 10.1.2.1 255.255.255.0
#
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 mask 255.255.255.0
destination-address 10.1.1.0 mask 255.255.255.0
action permit
rule name 2
source-zone untrust
destination-zone trust
source-address 10.1.1.0 mask 255.255.255.0
destination-address 10.1.2.0 mask 255.255.255.0
action permit
rule name 3
source-zone local
destination-zone untrust
source-address 1.1.1.1 mask 255.255.255.255
source-address 2.2.2.2 mask 255.255.255.255
destination-address 3.3.3.3 mask 255.255.255.255
action permit
rule name 4
source-zone untrust
destination-zone local
source-address 3.3.3.3 mask 255.255.255.255
destination-address 1.1.1.1 mask 255.255.255.255
destination-address 2.2.2.2 mask 255.255.255.255
action permit
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.0 0.0.0.255
network 2.2.2.0 0.0.0.255