閱讀813 返回首頁    go 阿裏雲 go 技術社區[雲棲]


搭建VPN網關__最佳實踐_用戶指南_專有網絡 VPC-阿裏雲

概述

以下以使用駐雲VPN鏡像建立site to site VPN(又稱L2L VPN)為例。

L2L VPN拓撲結構

兩個子網通過路由器A和路由器B接入互聯網,同時通過一個L2L 的ipsec 隧道在兩台路由器之間建立一個虛擬的連接,將A、B兩個網絡互通起來,效果與Router A、RouterB之間拉一根物理專線一樣。 兩端的vpn節點設備可以是路由器,也可以是專業的防火牆,也可以是基於x86服務器的係統軟件。

環境準備

本文檔環境如下:RouterA是VPC環境,采用一台ECS安裝FlexGW的鏡像,配置如下:

  • 操作係統:centos 6.5 64位
  • 軟件包:Strongswan5.3.2-Openvpn2.3.8-FlexGW2.0

Router B可以是思科或華為、華三的路由器、防火牆,也可以是另一個FlexGW服務器。

FlexGW配置

1.使用 VM的係統賬號密碼即可登錄係統,登錄方式:瀏覽器訪問”https: //公網IP”。

2.進入 VPN服務管理 –點擊啟動VPN服務。

3.增加隧道:點擊新增隧道,按照下圖內容填寫,以下配置屬於拓撲結構圖中右邊子網B的RouterB的配置。

  • 隧道ID:最好配一端的路由器的域名或者公網IP,兩端設備的這個部分要保持一致。
  • IKE版本:為了安全健壯性,建議使用版本2
  • 啟動類型:選擇自動連接
  • IKE 加密算法:一般選擇3DES模式
  • IKE 驗證算法:在以上選擇了3DES後,這裏一般選擇sha-1
  • IKE DH 組:默認第一項modp 768即可
  • ESP 加密算法:默認3DES
  • ESP 驗證算法:默認MD5
  • ESP DH 組:一般不需要
  • 與共享密鑰:請根據個人情況設置協商用密碼

基於ike V1的配置

對端配置一,路由器配置說明:

access-list 111 permit ip 10.1.1.0 0.0.0.255 172.16.2.0 0.0.0.255ip route 0.0.0.0 0.0.0.0 100.100.100.1 #增加默認路由與acl

crypto keyring 1 pre-shared-key address 200.200.200.200 key A1@456b

crypto isakmp policy 1 encr 3des authentication pre-share group 2crypto isakmp profile 1 keyring 1 self-identity address match identity address 200.200.200.200 255.255.255.255 local-address 100.100.100.100

crypto ipsec transform-set vsr esp-3des esp-sha-hmac

crypto map tunnel_1 100 ipsec-isakmp set peer 200.200.200.200 set security-association lifetime seconds 86400 set transform-set vsr set pfs group2 match address 111

interface Ethernet1/0 ip address 100.100.100.100 255.255.255.0 full-duplex crypto map tunnel_1 #將配置應用到接口下

注意:一定要使能配置:crypto isakmp enable 路由器默認此信息不顯示,但必須配置。配置示例:

`R1#show runBuilding configuration…

Current configuration : 2106 bytes!version 12.4service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname RouterA!boot-start-markerboot-end-marker!!no aaa new-model!resource policy!memory-size iomem 5no ip icmp rate-limit unreachableip tcp synwait-time 5!!ip cefno ip domain lookup!!crypto keyring 1 pre-shared-key address 200.200.200.200 key A1@456b!crypto isakmp policy 1 encr 3des authentication pre-share group 2crypto isakmp profile 1 keyring 1 self-identity address match identity address 200.200.200.200 255.255.255.255 local-address 100.100.100.100!!crypto ipsec transform-set vsr esp-3des esp-sha-hmac!crypto map tunnel_1 100 ipsec-isakmp set peer 200.200.200.200 set security-association lifetime seconds 86400 set transform-set vsr set pfs group2 match address 111!!!!interface Loopback0 ip address 10.1.1.1 255.255.255.0!interface FastEthernet0/0!

!interface Ethernet1/0 ip address 100.100.100.100 255.255.255.0 full-duplex crypto map tunnel_1!interface Ethernet1/1 no ip address half-duplex!interface Ethernet1/2 no ip address shutdown half-duplex!interface Ethernet1/3 no ip address shutdown half-duplex!interface Vlan1 no ip address!no ip http serverno ip http secure-serverip route 0.0.0.0 0.0.0.0 100.100.100.1!!!access-list 111 permit ip 10.1.1.0 0.0.0.255 172.16.2.0 0.0.0.255no cdp log mismatch duplex!!!control-plane!!!!!!!!!!line con 0 exec-timeout 0 0 privilege level 15 logging synchronousline aux 0 exec-timeout 0 0 privilege level 15 logging synchronousline vty 0 4 login!

`

對端配置二,ASA防火牆說明(IOS:8.2):

access-list 100 extended permit ip 172.16.2.0 255.255.255.0 10.1.1.0 255.255.255.0

isakmp identity autocrypto isakmp policy 1authentication pre-shareencryption 3deshash shagroup 2lifetime 86400crypto isakmp enable OutSide

crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac

crypto map OutSide_map 10 match address 100crypto map OutSide_map 10 set pfscrypto map OutSide_map 12 set peer 200.200.200.200crypto map OutSide_map 12 set transform-set ESP-3DES-SHAcrypto map OutSide_map interface OutSide

tunnel-group 200.200.200.200 type ipsec-l2ltunnel-group 200.200.200.200 ipsec-attributespre-shared-key A1@456bpeer-id-validate nocheck

基於ike V2的配置

其他不變,當web上選擇ike V2時,對方設備配置如下:

對端配置一,路由器配置說明:

crypto ikev2 proposal R1-proposal 創建一個proposal

encryption 3des aes-cbc-256 integrity md5 sha256 group 1 2 5

crypto ikev2 policy R1-policy 創建一個策略,以便可以調用proposal proposal R1-proposal

crypto ikev2 keyring R1-key 創建一個密鑰文件 peer ASA 名字本地有效,作為一個標識而已。 address 200.200.200.200 對方地址 pre-shared-key A1@345b 預共享密鑰

crypto ikev2 profile ike-profile 創建一個ike的profile。 match identity remote address 200.200.200.200 255.255.255.255 對方加密點地址 identity local address 100.100.100.100 本地加密點地址。

authentication remote pre-share 認證方式 authentication local pre-share keyring local R1-key 調用KEY文件

crypto ipsec transform-set aa esp-des esp-md5-hmac mode tunnelcrypto map VPN 1 ipsec-isakmp set peer 200.200.200.200 set transform-set aa

set ikev2-profile ike-profile 調用 IKe的profile match address 100 crypto map VPN

接口下應用與路由配置同ike V1注意:一定要使能配置:crypto isakmp enable 路由器默認此信息不顯示,但必須配置

對端配置二,防火牆配置說明(IOS 8.4以上):

Crypto ikev2 enable outside 使能邏輯域crypto ikev2 policy 10 創建一個策略 encryption aes-256 3des integrity sha256 md5 group 5 2 1 prf sha256 md5 偽隨機數。切記,這裏默認是sha,如果兩邊不一樣會建立不起來

tunnel-group 100.100.100.100 type ipsec-l2ltunnel-group 100.100.100.100 ipsec-attributes ikev2 remote-authentication pre-shared-key A1@345b ikev2 local-authentication pre-shared-key A1@345b

crypto ipsec ikev2 ipsec-proposal aa 相當於路由器上的轉換集 protocol esp encryption des protocol esp integrity md5

crypto map VPN 1 match address 100crypto map VPN 1 set peer 100.100.100.100crypto map VPN 1 set ikev2 ipsec-proposal aa 在map上調用轉換集crypto map VPN interface outside

最後更新:2016-12-06 14:28:54

  上一篇:go 物理專線接入__最佳實踐_用戶指南_專有網絡 VPC-阿裏雲
  下一篇:go 多應用共享公網帶寬__最佳實踐_用戶指南_專有網絡 VPC-阿裏雲