本文檔介紹如何配置與Azure的自適應安全裝置(ASA)IPsec虛擬隧道介面(VTI)連線。
思科建議您瞭解以下主題:
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
在ASA 9.8.1中,IPsec VTI功能已擴展為使用IKEv2,但是,它仍然限製為使用IPv4的sVTI IPv4。此配置指南是使用ASA CLI介面和Azure門戶生成的。也可以使用PowerShell或使用API執行Azure門戶的配置。有關Azure配置方法的詳細資訊,請參閱Azure文檔。
附註:目前,僅在單情景路由模式下支援VTI。
本指南假設尚未配置Azure雲。如果資源已建立,則可以跳過其中的一些步驟。
步驟1.在Azure中配置網路
這是位於Azure雲中的網路地址空間。此地址空間必須足夠大,以容納其中的子網,如圖所示。


![]() ![]() |
|
步驟2.修改虛擬網路以建立網關子網
1.導航到虛擬網路並新增Gateway子網。本範例中使用的是10.1.1.0/24。

步驟3.建立虛擬網路網關
1.這是託管在雲中的VPN端點。這是ASA用來構建IPsec隧道的裝置。此步驟還建立一個公共IP,將其分配給虛擬網路網關。完成此步驟可能需要15 - 20分鐘。


![]() |
|
步驟4.建立本地網路網關
1.本地網路網關是代表ASA的資源。

|
|
步驟5.在虛擬網路閘道與本地網路閘道之間建立一個新連線,如下圖所示



步驟6.配置ASA
1.首先,在外部接口上啟用IKEv2並配置IKEv2策略。
crypto ikev2 policy 10 encryption aes-gcm-256 aes-gcm-192 aes-gcm integrity null group 14 5 2 prf sha512 sha384 sha256 sha lifetime seconds 86400 crypto ikev2 policy 20 encryption aes-256 aes-192 aes integrity sha512 sha384 sha256 sha group 14 5 2 prf sha512 sha384 sha256 sha lifetime seconds 86400 crypto ikev2 enable outside
步驟6.配置IPsec轉換集和IPsec配置檔案
crypto ipsec ikev2 ipsec-proposal AZURE-PROPOSAL protocol esp encryption aes-256 protocol esp integrity sha-256 crypto ipsec profile AZURE-PROPOSAL set ikev2 ipsec-proposal AZURE-PROPOSAL
步驟7.配置tunnel-group。
1.檢索步驟3中建立的虛擬網路網關的公用IPv4地址,如下圖所示。

2.然後,在ASA上使用步驟3中定義的預共用金鑰配置group-policy和tunnel-group。
group-policy AZURE internal group-policy AZURE attributes vpn-tunnel-protocol ikev2 tunnel-group A.A.A.A type ipsec-l2l tunnel-group A.A.A.A general-attributes default-group-policy AZURE tunnel-group A.A.A.A ipsec-attributes ikev2 remote-authentication pre-shared-key ***** ikev2 local-authentication pre-shared-key *****
步驟8.配置隧道介面
1.在步驟4中,為已配置的BGP連線配置本地網路網關、網路地址和IP地址。這是要在VTI上配置的IP地址和網路。
interface Tunnel1 nameif AZURE ip address 192.168.100.1 255.255.255.252 tunnel source interface outside tunnel destination A.A.A.A tunnel mode ipsec ipv4 tunnel protection ipsec profile AZURE-PROPOSAL no shutdown
2. 選項1.使用BGP配置Azure的動態路由交換路由。
2a..在Azure中找到BGP路由器的IP地址,以檢視步驟3中建立的虛擬網路網關的配置。在本示例中,該地址為10.1.2.254。

3.在ASA上,配置從VTI隧道引出10.1.2.254的靜態路由。在本示例中,192.168.100.2與VTI位於同一個子網中。雖然沒有裝置具有該IP地址,但ASA會安裝指向VTI介面的路由。
route AZURE 10.1.2.254 255.255.255.255 192.168.100.2 1
4.然後在ASA上配置BGP。網路192.168.2.0/24是ASA內部介面以及傳播到雲中的路由。此外,在Azure中配置的網路將通告給ASA。
router bgp 65000 bgp log-neighbor-changes bgp graceful-restart address-family ipv4 unicast neighbor 10.1.2.254 remote-as 65515 neighbor 10.1.2.254 ebgp-multihop 255 neighbor 10.1.2.254 activate
network 192.168.2.0 network 192.168.100.0 mask 255.255.255.252 no auto-summary no synchronization exit-address-family
選項2.配置靜態路由,在ASA和Azure上靜態配置路由。配置ASA以通過VTI隧道將流量傳送到Azure網路。
route AZURE 10.1.0.0 255.255.0.0 192.168.100.2 1
1.使用位於ASA後面的網路和隧道介面上的子網修改步驟4中建立的本地網路網關。然後,在Add Additional Network Spaces部分下面新增字首。
使用本節內容,確認您的組態是否正常運作。
步驟1.通過運行show crypto ikev2 sa 命令驗證IKEv2會話是否已建立。
ciscoasa# show crypto ikev2 sa
IKEv2 SAs:
Session-id:6, Status:UP-ACTIVE, IKE count:1, CHILD count:1
Tunnel-id Local Remote Status Role
2006974029 B.B.B.B. /500 A.A.A.A/500 READY INITIATOR
Encr: AES-CBC, keysize: 256, Hash: SHA96, DH Grp:2, Auth sign: PSK, Auth verify: PSK
Life/Active Time: 86400/4640 sec
Child sa: local selector 0.0.0.0/0 - 255.255.255.255/65535
remote selector 0.0.0.0/0 - 255.255.255.255/65535
ESP spi in/out: 0x74e90416/0xba17723a
步驟2.通過運行show crypto ipsec sa命令來驗證IPsec SA是否已協商。
ciscoasa# show crypto ipsec sa
interface: AZURE
Crypto map tag: __vti-crypto-map-3-0-1, seq num: 65280, local addr: B.B.B.B
local ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
current_peer: A.A.A.A
#pkts encaps: 240, #pkts encrypt: 240, #pkts digest: 240
#pkts decaps: 377, #pkts decrypt: 377, #pkts verify: 377
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 240, #pkts comp failed: 0, #pkts decomp failed: 0
#pre-frag successes: 0, #pre-frag failures: 0, #fragments created: 0
#PMTUs sent: 0, #PMTUs rcvd: 0, #decapsulated frgs needing reassembly: 0
#TFC rcvd: 0, #TFC sent: 0
#Valid ICMP Errors rcvd: 0, #Invalid ICMP Errors rcvd: 0
#send errors: 0, #recv errors: 0
local crypto endpt.: B.B.B.B/500, remote crypto endpt.: A.A.A.A/500
path mtu 1500, ipsec overhead 78(44), media mtu 1500
PMTU time remaining (sec): 0, DF policy: copy-df
ICMP error validation: disabled, TFC packets: disabled
current outbound spi: BA17723A
current inbound spi : 74E90416
inbound esp sas:
spi: 0x74E90416 (1961427990)
SA State: active
transform: esp-aes-256 esp-sha-256-hmac no compression
in use settings ={L2L, Tunnel, IKEv2, VTI, }
slot: 0, conn_id: 1722, crypto-map: __vti-crypto-map-3-0-1
sa timing: remaining key lifetime (kB/sec): (3962863/24100)
IV size: 16 bytes
replay detection support: Y
Anti replay bitmap:
0xFFFFFFFF 0xFFFFFFFF
outbound esp sas:
spi: 0xBA17723A (3122098746)
SA State: active
transform: esp-aes-256 esp-sha-256-hmac no compression
in use settings ={L2L, Tunnel, IKEv2, VTI, }
slot: 0, conn_id: 1722, crypto-map: __vti-crypto-map-3-0-1
sa timing: remaining key lifetime (kB/sec): (4008947/24100)
IV size: 16 bytes
replay detection support: Y
Anti replay bitmap:
0x00000000 0x00000001
ciscoasa#
步驟3.如果使用靜態路由,請運行ping和ping tcp命令以驗證BGP或終端資源的第3層路由和第4層連線,驗證通過隧道與BGP遠端路由器的連線。
ciscoasa# ping 10.1.2.254 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.2.254, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 40/42/50 ms ciscoasa# ping tcp 10.1.2.254 179 Type escape sequence to abort. No source specified. Pinging from identity interface. Sending 5 TCP SYN requests to 10.1.2.254 port 179 from 192.168.100.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 41/42/42 ms ciscoasa#
步驟4.使用BGP時,請驗證是否收到並向Azure和ASA的路由表通告BGP連線路由。
ciscoasa# show bgp summary
BGP router identifier 192.168.100.1, local AS number 65000
BGP table version is 6, main routing table version 6
4 network entries using 800 bytes of memory
5 path entries using 400 bytes of memory
2/2 BGP path/bestpath attribute entries using 416 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1640 total bytes of memory
BGP activity 14/10 prefixes, 17/12 paths, scan interval 60 secs
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.2.254 4 65515 73 60 6 0 0 01:02:26 3
ciscoasa# show bgp neighbors 10.1.2.254 routes
BGP table version is 6, local router ID is 192.168.100.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/16 10.1.2.254 0 65515 i <<< This is the virtual network defined in Azure
* 192.168.100.0/30 10.1.2.254 0 65515 i
r> 192.168.100.1/32 10.1.2.254 0 65515 i
Total number of prefixes 3
ciscoasa# show bgp neighbors 10.1.2.254 advertised-routes
BGP table version is 6, local router ID is 192.168.100.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 192.168.2.0 0.0.0.0 0 32768 i <<< These are the routes being advertised to Azure
*> 192.168.100.0/30 0.0.0.0 0 32768 i <<<
Total number of prefixes 2
ciscoasa#
ciscoasa# show route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, V - VPN
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, + - replicated route
Gateway of last resort is 10.1.251.33 to network 0.0.0.0
S* 0.0.0.0 0.0.0.0 [1/0] via B.B.B.C, outside
B 10.1.0.0 255.255.0.0 [20/0] via 10.1.1.254, 01:03:33
S 10.1.2.254 255.255.255.255 [1/0] via 192.168.100.2, AZURE
C B.B.B.A 255.255.255.224 is directly connected, outside
L B.B.B.B 255.255.255.255 is directly connected, outside
C 192.168.2.0 255.255.255.0 is directly connected, inside
L 192.168.2.2 255.255.255.255 is directly connected, inside
C 192.168.100.0 255.255.255.252 is directly connected, AZURE
L 192.168.100.1 255.255.255.255 is directly connected, AZURE
步驟5.透過通道ping裝置。在本示例中,它是在Azure中運行的Ubuntu VM。
ciscoasa# ping 10.1.0.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.1.0.4, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 40/42/50 ms
步驟6.立即檢視遠端VM上的有效路由。它們必須顯示ASA向雲通告的路由,如圖所示。

目前尚無特定資訊可用於排解此組態的疑難問題。
| 修訂 | 發佈日期 | 意見 |
|---|---|---|
5.0 |
02-Jul-2026
|
已更新拼寫、語法、CCW警報、句子結構和間距。 |
4.0 |
24-Sep-2024
|
更新的格式。 |
3.0 |
19-Mar-2024
|
更新的技術內容、機器翻譯、替代文字和格式。 |
2.0 |
11-Jul-2022
|
此最新文章的內容仍然有效。
已刪除PII。對格式、樣式要求、電腦翻譯和檔進行更新。 |
1.0 |
18-Feb-2019
|
初始版本 |