概要 †
以下のような構成をデプロイします。
VNet(ASM)[ VPN Gateway ] - VNet(ARM)[ VPN Gateway ]
従来の VNet を新しい VNet に接続するを参考にし、テンプレートも流用しています。
手順 †
- ログイン
1
2
3
4
5
6
7
8
9
10
| -
!
-
!
-
|
!
-
!
| Add-AzureAccount
Add-AzureRmAccount
Select-AzureSubscription -SubscriptionName <サブスクリプション名> -Current
Select-AzureRMSubscription -SubscriptionName <サブスクリプション名>
|
- ASMのネットワーク設定取得
1
2
3
|
-
!
| Get-AzureVNetConfig -ExportToFile <エクスポートパス>
Get-AzureVNetConfig -ExportToFile "Z:\a.xml"
|
- ASMのネットワーク設定更新
今回はこのサンプル用に空のサブスクリプションで行っているため、以下のようにシンプルですが
サブスクリプション内に既にほかのネットワーク設定がある場合は、エクスポートした設定にLocalNetworkSite(vnet-arm)とVirtualNetworkSite(vnet-asm)を追記してください。
この段階では、vnet-armのVPNGatewayAddressは、まだ作成していないので仮の値です。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
| <?xml version="1.0" encoding="utf-8"?>
<NetworkConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration">
<VirtualNetworkConfiguration>
<Dns />
<LocalNetworkSites>
<LocalNetworkSite name="vnet-arm">
<AddressSpace>
<AddressPrefix>10.2.0.0/16</AddressPrefix>
</AddressSpace>
<VPNGatewayAddress>2.0.0.2</VPNGatewayAddress>
</LocalNetworkSite>
</LocalNetworkSites>
<VirtualNetworkSites>
<VirtualNetworkSite name="vnet-asm" Location="Japan East">
<AddressSpace>
<AddressPrefix>10.1.0.0/16</AddressPrefix>
</AddressSpace>
<Subnets>
<Subnet name="Subnet-1">
<AddressPrefix>10.1.0.0/24</AddressPrefix>
</Subnet>
<Subnet name="GatewaySubnet">
<AddressPrefix>10.1.200.0/29</AddressPrefix>
</Subnet>
</Subnets>
</VirtualNetworkSite>
</VirtualNetworkSites>
</VirtualNetworkConfiguration>
</NetworkConfiguration>
|
- ASMのネットワーク設定更新
1
2
3
|
-
!
| Set-AzureVNetConfig -ConfigurationPath <インポートパス>
Set-AzureVNetConfig -ConfigurationPath "Z:\a.xml"
|
- ASMポータルで、vnet-asmを開き、[構成]-[サイト間接続]-[ローカルネットワークに接続する]にチェック
ローカルネットワークはvnet-arm
- [ダッシュボード]-[ゲートウェイの作成]-[動的ルーティング]
数十分~1時間程度作成に時間がかかります
完了すると、以下のようにVPN GatewayのIPアドレスが表示されます。この値は、後で使用します。
- ARMのネットワーク構成をデプロイ
これも、数十分~1時間程度作成に時間がかかります
https://github.com/Azure/azure-quickstart-templates/blob/master/arm-asm-s2s/azuredeploy.parameters.jsonを使ってデプロイします
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| -
!
-
!
-
!
-
!
-
|
|
|
|
|
|
|
|
|
|
| New-AzureRmResourceGroup -Name <リソース名> -Location <ロケーション名>
New-AzureRmResourceGroup -Name "foo" -Location "Japan East"
New-AzureRmResourceGroupDeployment -Name <名前> -TemplateFile <テンプレートパス> -TemplateParameterFile <テンプレートパラメータパス>
New-AzureRmResourceGroupDeployment `
-Name deploy1 `
-TemplateFile "z:\azuredeploy.json"`
-TemplateParameterFile "z:\azuredeploy-parameters.json"
|
- ASM側の仮設定を更新
1
2
3
4
5
6
7
8
9
10
| -
!
-
|
|
!
| Get-AzureRmPublicIpAddress | ?{$_.Name -eq "gpip"}
Get-AzureVNetConfig -ExportToFile "Z:\a.xml"
Set-AzureVNetConfig -ConfigurationPath "Z:\a.xml"
|
- ASM側のVPN GatewayにIPSecの共有キーを設定
1
2
3
|
-
!
| Set-AzureVNetGatewayKey -VNetName <VNet名> -LocalNetworkSiteName <ローカルネット名> -SharedKey <共有キー>
Set-AzureVNetGatewayKey -VNetName "vnet-asm" -LocalNetworkSiteName "vnet-arm" -SharedKey "abc123"
|
- ARM側のVPN GatewayにIPSecの共有キーを設定
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-
!
| $asmgw = Get-AzureRmLocalNetworkGateway -Name "vnet-asm" -ResourceGroupName "foo"
$armgw = Get-AzureRmVirtualNetworkGateway -Name "gn" -ResourceGroupName "foo"
New-AzureRmVirtualNetworkGatewayConnection `
-Name <名前> `
-ResourceGroupName <リソースグループ名>
-Location <ロケーション名>
-VirtualNetworkGateway1 <VNet object> `
-LocalNetworkGateway2 <ローカルネット object> `
-ConnectionType <接続タイプ(e.g, IPsec,Vnet2Vnet,ExpressRoute,VPNClient)> `
-RoutingWeight <> `
-SharedKey <共有キー>
New-AzureRmVirtualNetworkGatewayConnection `
-Name "arm-asm-s2s-connection" `
-ResourceGroupName "foo" `
-Location "Japan East" `
-VirtualNetworkGateway1 $armgw `
-LocalNetworkGateway2 $asmgw `
-ConnectionType IPsec `
-RoutingWeight 10 `
-SharedKey "abc123"
|
- 接続
ASMポータルで、vnet-asmを開き、[構成]-[接続]
このような表示になれば、接続完了です
あとは、ASM, ARMのVNet内に、VMやCloud Servicesなどを自由に配置してください
検証時の環境 †
- Windows 10 Pro x64
- Windows Server 2012 R2 Datacenter
参考 †