As shown in Figure 1, the headquarters is connected to two branches (Branch 1 and Branch 2). The network environment is as follows:
FW_A and FW_B are reachable to each other; and FW_A and FW_C are reachable to each other.
The networking requirements are as follows:
<sysname> system-view [sysname] sysname FW_A [FW_A] interface GigabitEthernet 0/0/3 [FW_A-GigabitEthernet0/0/3] ip address 10.1.1.1 24 [FW_A-GigabitEthernet0/0/3] quit
[FW_A] interface GigabitEthernet 0/0/1 [FW_A-GigabitEthernet0/0/1] ip address 1.1.3.1 24 [FW_A-GigabitEthernet0/0/1] quit
Add interfaces to corresponding security zones.
[FW_A] firewall zone trust [FW_A-zone-trust] add interface GigabitEthernet 0/0/3 [FW_A-zone-trust] quit
[FW_A] firewall zone untrust [FW_A-zone-untrust] add interface GigabitEthernet 0/0/1 [FW_A-zone-untrust] quit
Configure the security policies between the Trust and Untrust zones.
[FW_A] security-policy [FW_A-policy-security] rule name policy1 [FW_A-policy-security-rule-policy1] source-zone trust [FW_A-policy-security-rule-policy1] destination-zone untrust [FW_A-policy-security-rule-policy1] source-address 10.1.1.0 24 [FW_A-policy-security-rule-policy1] destination-address 10.1.2.0 24 [FW_A-policy-security-rule-policy1] destination-address 10.1.3.0 24 [FW_A-policy-security-rule-policy1] action permit [FW_A-policy-security-rule-policy1] quit
[FW_A-policy-security] rule name policy2 [FW_A-policy-security-rule-policy2] source-zone untrust [FW_A-policy-security-rule-policy2] destination-zone trust [FW_A-policy-security-rule-policy2] source-address 10.1.2.0 24 [FW_A-policy-security-rule-policy2] source-address 10.1.3.0 24 [FW_A-policy-security-rule-policy2] destination-address 10.1.1.0 24 [FW_A-policy-security-rule-policy2] action permit [FW_A-policy-security-rule-policy2] quit
Configure the security policies between the Local and Untrust zones.
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).
[FW_A-policy-security] rule name policy3 [FW_A-policy-security-rule-policy3] source-zone local [FW_A-policy-security-rule-policy3] destination-zone untrust [FW_A-policy-security-rule-policy3] source-address 1.1.3.1 32 [FW_A-policy-security-rule-policy3] action permit [FW_A-policy-security-rule-policy3] quit
[FW_A-policy-security] rule name policy4 [FW_A-policy-security-rule-policy4] source-zone untrust [FW_A-policy-security-rule-policy4] destination-zone local [FW_A-policy-security-rule-policy4] destination-address 1.1.3.1 32 [FW_A-policy-security-rule-policy4] action permit [FW_A-policy-security-rule-policy4] quit [FW_A-policy-security] quit
Configure the security policies between the Local and Untrust zones to permit the interzone traffic for the negotiation between the tunnel endpoints.
[FW_A] ip route-static 0.0.0.0 0.0.0.0 1.1.3.2
[FW_A] nat-policy [FW_A-policy-nat] rule name policy_nat1 [FW_A-policy-nat-rule-policy_nat1] source-zone trust [FW_A-policy-nat-rule-policy_nat1] destination-zone untrust [FW_A-policy-nat-rule-policy_nat1] source-address 10.1.1.0 0.0.0.255 [FW_A-policy-nat-rule-policy_nat1] destination-address 10.1.2.0 0.0.0.255 [FW_A-policy-nat-rule-policy_nat1] destination-address 10.1.3.0 0.0.0.255 [FW_A-policy-nat-rule-policy_nat1] action no-nat [FW_A-policy-nat-rule-policy_nat1] quit [FW_A-policy-nat] rule name policy_nat2 [FW_A-policy-nat-rule-policy_nat2] source-zone trust [FW_A-policy-nat-rule-policy_nat2] destination-zone untrust [FW_A-policy-nat-rule-policy_nat2] source-address 10.1.1.0 0.0.0.255 [FW_A-policy-nat-rule-policy_nat2] action source-nat easy-ip [FW_A-policy-nat-rule-policy_nat2] quit [FW_A-policy-nat] quit
[FW_B] nat-policy [FW_B-policy-nat] rule name policy_nat1 [FW_B-policy-nat-rule-policy_nat1] source-zone trust [FW_B-policy-nat-rule-policy_nat1] destination-zone untrust [FW_B-policy-nat-rule-policy_nat1] source-address 10.1.2.0 24 [FW_B-policy-nat-rule-policy_nat1] destination-address 10.1.1.0 24 [FW_B-policy-nat-rule-policy_nat1] destination-address 10.1.3.0 24 [FW_B-policy-nat-rule-policy_nat1] action no-nat [FW_B-policy-nat-rule-policy_nat1] quit [FW_B-policy-nat] rule name policy_nat2 [FW_B-policy-nat-rule-policy_nat2] source-zone trust [FW_B-policy-nat-rule-policy_nat2] destination-zone untrust [FW_B-policy-nat-rule-policy_nat2] source-address 10.1.2.0 24 [FW_B-policy-nat-rule-policy_nat2] action source-nat easy-ip [FW_B-policy-nat-rule-policy_nat2] quit [FW_B-policy-nat] quit
The configuration of FW_C is similar to that of FW_B.
After the configuration is complete, PC1 can access the public network at any time and ping the interface IP address 1.1.5.1 of FW_B. Meanwhile, you can view NAT session entries on FW_A.
<FW_A> display firewall session table
Current Total Sessions : 5
icmp VPN:public --> public 10.1.1.2:61251[1.1.3.1:2048]-->1.1.5.1:2048
icmp VPN:public --> public 10.1.1.2:62019[1.1.3.1:2049]-->1.1.5.1:2048
icmp VPN:public --> public 10.1.1.2:62275[1.1.3.1:2050]-->1.1.5.1:2048
icmp VPN:public --> public 10.1.1.2:62531[1.1.3.1:2051]-->1.1.5.1:2048
icmp VPN:public --> public 10.1.1.2:62787[1.1.3.1:2052]-->1.1.5.1:2048
PC2 can access the public network at any time and ping the interface IP address 1.1.3.1 of FW_A. Meanwhile, you can view NAT session entries on FW_B.
<FW_B> display firewall session table
Current Total Sessions : 5
icmp VPN:public --> public 10.1.2.2:61251[1.1.5.1:2048]-->1.1.3.1:2048
icmp VPN:public --> public 10.1.2.2:62019[1.1.5.1:2049]-->1.1.3.1:2048
icmp VPN:public --> public 10.1.2.2:62275[1.1.5.1:2050]-->1.1.3.1:2048
icmp VPN:public --> public 10.1.2.2:62531[1.1.5.1:2051]-->1.1.3.1:2048
icmp VPN:public --> public 10.1.2.2:62787[1.1.5.1:2052]-->1.1.3.1:2048
On FW_A, you can view IKE SA information.
<FW_A> display ike sa
IKE SA information :
Conn-ID Peer VPN Flag(s) Phase RemoteType RemoteID
-------------------------------------------------------------------------
83887864 1.1.5.1:500 RD|A v2:2 IP 1.1.5.1
83887652 1.1.5.1:500 RD|A v2:1 IP 1.1.5.1
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
On FW_B, you can view the IKE SA whose peer end is the headquarters. FW_B is the initiator and the flag bit is ST.
<FW_B> display ike sa
IKE SA information :
Conn-ID Peer VPN Flag(s) Phase RemoteType RemoteID
-------------------------------------------------------------------------
62887864 1.1.3.1:500 RD|ST|A v2:2 IP 1.1.3.1
62887652 1.1.3.1:500 RD|ST|A v2:1 IP 1.1.3.1
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_A> display ipsec sa brief
Current ipsec sa num:2
Spu board slot 1, cpu 1 ipsec sa information:
Number of SAs:2
Src address Dst address SPI VPN Protocol Algorithm
-------------------------------------------------------------------------------
1.1.5.1 1.1.3.1 3923280450 ESP E:AES-256 A:SHA2_256_128
1.1.3.1 1.1.5.1 787858613 ESP E:AES-256 A:SHA2_256_128
<FW_B> display ipsec sa brief
Current ipsec sa num:2
Spu board slot 1, cpu 1 ipsec sa information:
Number of SAs:2
Src address Dst address SPI VPN Protocol Algorithm
-------------------------------------------------------------------------------
1.1.3.1 1.1.5.1 787858613 ESP E:AES-256 A:SHA2_256_128
1.1.5.1 1.1.3.1 3923280450 ESP E:AES-256 A:SHA2_256_128
# sysname 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 rule 10 permit ip source 10.1.1.0 0.0.0.255 destination 10.1.3.0 0.0.0.255 # ipsec proposal tran1 esp authentication-algorithm sha2-256 esp encryption-algorithm aes-256 # ike proposal 10 encryption-algorithm aes-256 dh group14 authentication-algorithm sha2-256 authentication-method pre-share integrity-algorithm hmac-sha2-256 prf hmac-sha2-256 # ike peer c pre-shared-key %^%#9AGL!*(KJM2ImuCYi!QP,{6N%^%# ike-proposal 10 # ipsec policy-template temp 1 security acl 3000 ike-peer c proposal tran1 # ipsec policy map1 10 isakmp template temp # interface GigabitEthernet0/0/3 undo shutdown ip address 10.1.1.1 255.255.255.0 # interface GigabitEthernet0/0/1 undo shutdown ip address 1.1.3.1 255.255.255.0 ipsec policy map1 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/3 # firewall zone untrust set priority 5 add interface GigabitEthernet0/0/1 # ip route-static 0.0.0.0 0.0.0.0 1.1.3.2 # security-policy rule name policy1 source-zone trust destination-zone untrust source-address 10.1.1.0 24 destination-address 10.1.2.0 24 destination-address 10.1.3.0 24 action permit rule name policy2 source-zone untrust destination-zone trust source-address 10.1.2.0 24 source-address 10.1.3.0 24 destination-address 10.1.1.0 24 action permit rule name policy3 source-zone local destination-zone untrust source-address 1.1.3.1 32 action permit rule name policy4 source-zone untrust destination-zone local destination-address 1.1.3.1 32 action permit # nat-policy rule name policy_nat1 source-zone trust destination-zone untrust source-address 10.1.1.0 0.0.0.255 destination-address 10.1.2.0 0.0.0.255 destination-address 10.1.3.0 0.0.0.255 action no-nat rule name policy_nat2 source-zone trust destination-zone untrust source-address 10.1.1.0 0.0.0.255 action source-nat easy-ip # return
# sysname 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 # ipsec proposal tran1 esp authentication-algorithm sha2-256 esp encryption-algorithm aes-256 # ike proposal 10 encryption-algorithm aes-256 dh group14 authentication-algorithm sha2-256 authentication-method pre-share integrity-algorithm hmac-sha2-256 prf hmac-sha2-256 # ike peer a pre-shared-key %^%#LV|sQ=~fUQO:M$CeqaMEnwVD%^%# ike-proposal 10 remote-address 1.1.3.1 # ipsec policy map1 10 isakmp security acl 3000 ike-peer a proposal tran1 # interface GigabitEthernet0/0/3 undo shutdown ip address 10.1.2.1 255.255.255.0 # interface GigabitEthernet0/0/1 undo shutdown ip address 1.1.5.1 255.255.255.0 ipsec policy map1 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/3 # firewall zone untrust set priority 5 add interface GigabitEthernet0/0/1 # ip route-static 10.1.0.0 255.255.0.0 GigabitEthernet0/0/1 # security-policy rule name policy1 source-zone trust destination-zone untrust source-address 10.1.2.0 24 destination-address 10.1.1.0 24 destination-address 10.1.3.0 24 action permit rule name policy2 source-zone untrust destination-zone trust source-address 10.1.1.0 24 source-address 10.1.3.0 24 destination-address 10.1.2.0 24 action permit rule name policy3 source-zone local destination-zone untrust source-address 1.1.5.1 32 destination-address 1.1.3.1 32 action permit rule name policy4 source-zone untrust destination-zone local source-address 1.1.3.1 32 destination-address 1.1.5.1 32 action permit # nat-policy rule name policy_nat1 source-zone trust destination-zone untrust source-address 10.1.2.0 0.0.0.255 destination-address 10.1.1.0 0.0.0.255 destination-address 10.1.3.0 0.0.0.255 action no-nat rule name policy_nat2 source-zone trust destination-zone untrust source-address 10.1.2.0 0.0.0.255 action source-nat easy-ip # return
# sysname FW_C # acl number 3000 rule 5 permit ip source 10.1.3.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 # ipsec proposal tran1 esp authentication-algorithm sha2-256 esp encryption-algorithm aes-256 # ike proposal 10 encryption-algorithm aes-256 dh group14 authentication-algorithm sha2-256 authentication-method pre-share integrity-algorithm hmac-sha2-256 prf hmac-sha2-256 # ike peer a pre-shared-key %^%#Yb/Y7>%YK@K4sS#'Kjd9NGML%^%# ike-proposal 10 remote-address 1.1.3.1 # ipsec policy map1 10 isakmp security acl 3000 ike-peer a proposal tran1 # interface GigabitEthernet0/0/3 undo shutdown ip address 10.1.3.1 255.255.255.0 # interface GigabitEthernet0/0/1 undo shutdown ipsec policy map1 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/3 # firewall zone untrust set priority 5 add interface GigabitEthernet0/0/1 # ip route-static 10.1.0.0 255.255.0.0 GigabitEthernet0/0/1 # security-policy rule name policy1 source-zone trust destination-zone untrust source-address 10.1.3.0 24 destination-address 10.1.1.0 24 destination-address 10.1.2.0 24 action permit rule name policy2 source-zone untrust destination-zone trust source-address 10.1.1.0 24 source-address 10.1.2.0 24 destination-address 10.1.3.0 24 action permit rule name policy3 source-zone local destination-zone untrust destination-address 1.1.3.1 32 action permit rule name policy4 source-zone untrust destination-zone local source-address 1.1.3.1 32 action permit # nat-policy rule name policy_nat1 source-zone trust destination-zone untrust source-address 10.1.3.0 24 destination-address 10.1.1.0 24 destination-address 10.1.2.0 24 action no-nat rule name policy_nat2 source-zone trust destination-zone untrust source-address 10.1.3.0 24 action source-nat easy-ip # return