
# AR路由器侧操作步骤
#### 操作步骤
1. 登录AR路由器配置界面。
2. 进入系统视图。 
   ```
   <AR651>system-view
   ```
   
   
3. 配置公网接口的IP地址。 
   ```
   [AR651]interface GigabitEthernet 0/0/8
   [AR651-GigabitEthernet0/0/8]ip address 1.1.1.1 255.255.255.0
   [AR651-GigabitEthernet0/0/8]quit
   ```
   
   
4. 配置默认路由。 
   ```
   [AR651]ip route-static 0.0.0.0 0.0.0.0 1.1.1.254
   ```
   其中，1.1.1.254为AR路由器公网IP的网关地址，请根据实际替换。
   
   
5. 配置VPN网关主EIP/主EIP2到AR路由器的路由信息。 
   ```
   [AR651]ip route-static 1.1.1.2 255.255.255.255 1.1.1.254
   [AR651]ip route-static 2.2.2.2 255.255.255.255 1.1.1.254
   ```
   - 1.1.1.2/2.2.2.2为VPN网关的主EIP、主EIP2。
   
   - 1.1.1.254为AR路由器公网IP的网关地址。
   
   
   
   
6. 开启SHA-2算法兼容RFC标准算法功能。 
   ```
   [AR651]IPsec authentication sha2 compatible enable
   ```
   
   
7. 配置IPsec安全提议。 
   ```
   [AR651]IPsec proposal hwproposal1
   [AR651-IPsec-proposal-hwproposal1]esp authentication-algorithm sha2-256
   [AR651-IPsec-proposal-hwproposal1]esp encryption-algorithm aes-128
   [AR651-IPsec-proposal-hwproposal1]quit
   ```
   
   
8. 配置IKE安全提议。 
   ```
   [AR651]ike proposal 2
   [AR651-ike-proposal-2]encryption-algorithm aes-128
   [AR651-ike-proposal-2]dh Group14
   [AR651-ike-proposal-2]authentication-algorithm sha2-256
   [AR651-ike-proposal-2]authentication-method pre-share
   [AR651-ike-proposal-2]integrity-algorithm hmac-sha2-256
   [AR651-ike-proposal-2]prf hmac-sha2-256
   [AR651-ike-proposal-2]quit
   ```
   
   
9. 配置IKE对等体。 
   ```
   [AR651]ike peer hwpeer1
   [AR651-ike-peer-hwpeer1]undo version 1
   [AR651-ike-peer-hwpeer1]pre-shared-key cipher Test@123
   [AR651-ike-peer-hwpeer1]ike-proposal 2
   [AR651-ike-peer-hwpeer1]local-address 1.1.1.1
   [AR651-ike-peer-hwpeer1]remote-address 1.1.1.2
   [AR651-ike-peer-hwpeer1]rsa encryption-padding oaep
   [AR651-ike-peer-hwpeer1]rsa signature-padding pss
   [AR651-ike-peer-hwpeer1]ikev2 authentication sign-hash sha2-256
   [AR651-ike-peer-hwpeer1]quit
   #
   [AR651]ike peer hwpeer2
   [AR651-ike-peer-hwpeer2]undo version 1
   [AR651-ike-peer-hwpeer2]pre-shared-key cipher Test@123
   [AR651-ike-peer-hwpeer2]ike-proposal 2
   [AR651-ike-peer-hwpeer2]local-address 1.1.1.1
   [AR651-ike-peer-hwpeer2]remote-address 2.2.2.2
   [AR651-ike-peer-hwpeer2]rsa encryption-padding oaep
   [AR651-ike-peer-hwpeer2]rsa signature-padding pss
   [AR651-ike-peer-hwpeer2]ikev2 authentication sign-hash sha2-256
   [AR651-ike-peer-hwpeer2]quit
   ```
   相关命令说明如下：
   - ike peer hwpeer1、ike peer hwpeer2：对应两条VPN连接。
   
   - pre-shared-key cipher：预共享密钥。
   
   - local-address：AR路由器的公网地址。
   
   - remote-address：VPN网关的主EIP、主EIP2。
   
   
   
   
10. 配置IPsec安全框架。 
    ```
    [AR651]IPsec profile hwpro1
    [AR651-IPsec-profile-hwpro1]ike-peer hwpeer1
    [AR651-IPsec-profile-hwpro1]proposal hwproposal1
    [AR651-IPsec-profile-hwpro1]pfs dh-Group14
    [AR651-IPsec-profile-hwpro1]quit
    #
    [AR651]IPsec profile hwpro2
    [AR651-IPsec-profile-hwpro2]ike-peer hwpeer2
    [AR651-IPsec-profile-hwpro2]proposal hwproposal1
    [AR651-IPsec-profile-hwpro2]pfs dh-Group14
    [AR651-IPsec-profile-hwpro2]quit
    ```
    
    
11. 配置虚拟隧道接口。 
    ```
    [AR651]interface Tunnel0/0/1
    [AR651-Tunnel0/0/1]mtu 1400
    [AR651-Tunnel0/0/1]ip address 169.254.70.2 255.255.255.252
    [AR651-Tunnel0/0/1]tunnel-protocol IPsec
    [AR651-Tunnel0/0/1]source 1.1.1.1
    [AR651-Tunnel0/0/1]destination 1.1.1.2
    [AR651-Tunnel0/0/1]IPsec profile hwpro1
    [AR651-Tunnel0/0/1]quit
    #
    [AR651]interface Tunnel0/0/2
    [AR651-Tunnel0/0/2]mtu 1400
    [AR651-Tunnel0/0/2]ip address 169.254.71.2 255.255.255.252
    [AR651-Tunnel0/0/2]tunnel-protocol IPsec
    [AR651-Tunnel0/0/2]source 1.1.1.1
    [AR651-Tunnel0/0/2]destination 2.2.2.2
    [AR651-Tunnel0/0/2]IPsec profile hwpro2
    [AR651-Tunnel0/0/2]quit
    ```
    相关命令说明如下：
    - interface Tunnel0/0/1、interface Tunnel0/0/2：两条VPN连接对应的Tunnel隧道。 本示例中，Tunnel0/0/1对应VPN网关主EIP所在的VPN连接；Tunnel0/0/2对应VPN网关主EIP2所在的VPN连接。
      
    
    - ip address：AR路由器的Tunnel接口地址。
    
    - source：AR路由器的公网地址。
    
    - destination：VPN网关的主EIP、主EIP2。
    
    
    
    
12. 配置NQA。 
    ```
    [AR651]nqa test-instance IPsec_nqa1 IPsec_nqa1
    [AR651-nqa-IPsec_nqa1-IPsec_nqa1]test-type icmp
    [AR651-nqa-IPsec_nqa1-IPsec_nqa1]destination-address ipv4 169.254.70.1
    [AR651-nqa-IPsec_nqa1-IPsec_nqa1]source-address ipv4 169.254.70.2
    [AR651-nqa-IPsec_nqa1-IPsec_nqa1]frequency 15
    [AR651-nqa-IPsec_nqa1-IPsec_nqa1]ttl 255
    [AR651-nqa-IPsec_nqa1-IPsec_nqa1]start now
    [AR651-nqa-IPsec_nqa1-IPsec_nqa1]quit
    #
    [AR651]nqa test-instance IPsec_nqa2 IPsec_nqa2
    [AR651-nqa-IPsec_nqa2-IPsec_nqa2]test-type icmp
    [AR651-nqa-IPsec_nqa2-IPsec_nqa2]destination-address ipv4 169.254.71.1
    [AR651-nqa-IPsec_nqa2-IPsec_nqa2]source-address ipv4 169.254.71.2
    [AR651-nqa-IPsec_nqa2-IPsec_nqa2]frequency 15
    [AR651-nqa-IPsec_nqa2-IPsec_nqa2]ttl 255
    [AR651-nqa-IPsec_nqa2-IPsec_nqa2]start now
    [AR651-nqa-IPsec_nqa2-IPsec_nqa2]quit
    ```
    相关命令说明如下：
    - nqa test-instance IPsec_nqa1 IPsec_nqa1、nqa test-instance IPsec_nqa2 IPsec_nqa2：NQA名称。 本示例中，IPsec_nqa1对应VPN网关主EIP所在的VPN连接；IPsec_nqa2对应VPN网关主EIP2所在的VPN连接。
      
    
    - destination-address：VPN网关的Tunnel接口地址。
    
    - source-address：AR路由器的Tunnel接口地址。
    
    
    
    
13. 配置静态路由联动NQA功能。 
    ```
    [AR651]ip route-static 192.168.0.0 255.255.255.0 Tunnel0/0/1 track nqa IPsec_nqa1 IPsec_nqa1
    [AR651]ip route-static 192.168.1.0 255.255.255.0 Tunnel0/0/1 track nqa IPsec_nqa1 IPsec_nqa1
    [AR651]ip route-static 192.168.0.0 255.255.255.0 Tunnel0/0/2 preference 100 track nqa IPsec_nqa2 IPsec_nqa2
    [AR651]ip route-static 192.168.1.0 255.255.255.0 Tunnel0/0/2 preference 100 track nqa IPsec_nqa2 IPsec_nqa2
    ```
    相关参数说明如下：
    - 192.168.0.0/192.168.1.0：VPC本端子网。
      - 每个子网需要分别独立配置路由track nqa。
      
      - 同一条命令中，Tunnel*x* 和IPsec_nqa*x*需要同属于一条VPN连接。
       
    
    - preference 100：路由优先级，不配置默认为60。 本示例中，流量优先走VPN网关主EIP所在的VPN连接；两条VPN连接为双活模式。
      如果希望流量从两条流量各走一半，即负载分担模式，则需要删除preference 100。
      
    
    
    
    
 
