You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order for VPN connections from your on-premises Linux machines to be authenticated to access your virtual network, you must create two certificates: a root certificate, which will be provided to the virtual machine gateway, and a client certificate, which will be signed with the root certificate. The following script creates the required certificates.
@@ -132,60 +132,60 @@ Remember to replace `<desired-vpn-name-here>` with the name you would like for t
132
132
> P2S IKEv2/OpenVPN connections are not supported with the **Basic** SKU. This script uses the **VpnGw1** SKU for the virtual network gateway, accordingly.
133
133
134
134
```azurecli
135
-
vpnName="<desired-vpn-name-here>"
136
-
publicIpAddressName="$vpnName-PublicIP"
135
+
VPN_NAME="<desired-vpn-name-here>"
136
+
PUBLIC_IP_ADDR_NAME="$VPN_NAME-PublicIP"
137
137
138
-
publicIpAddress=$(az network public-ip create \
139
-
--resource-group $resourceGroupName \
140
-
--name $publicIpAddressName \
141
-
--location $region \
138
+
PUBLIC_IP_ADDR=$(az network public-ip create \
139
+
--resource-group $RESOURCE_GROUP_NAME \
140
+
--name $PUBLIC_IP_ADDR_NAME \
141
+
--location $REGION \
142
142
--sku "Basic" \
143
143
--allocation-method "Dynamic" \
144
144
--query "publicIp.id" | tr -d '"')
145
145
146
146
az network vnet-gateway create \
147
-
--resource-group $resourceGroupName \
148
-
--name $vpnName \
149
-
--vnet $virtualNetworkName \
150
-
--public-ip-addresses $publicIpAddress \
151
-
--location $region \
147
+
--resource-group $RESOURCE_GROUP_NAME \
148
+
--name $VPN_NAME \
149
+
--vnet $VIRTUAL_NETWORK_NAME \
150
+
--public-ip-addresses $PUBLIC_IP_ADDR \
151
+
--location $REGION \
152
152
--sku "VpnGw1" \
153
153
--gateway-typ "Vpn" \
154
154
--vpn-type "RouteBased" \
155
155
--address-prefixes "172.16.201.0/24" \
156
156
--client-protocol "IkeV2" > /dev/null
157
157
158
158
az network vnet-gateway root-cert create \
159
-
--resource-group $resourceGroupName \
160
-
--gateway-name $vpnName \
161
-
--name $rootCertName \
162
-
--public-cert-data $rootCertificate \
159
+
--resource-group $RESOURCE_GROUP_NAME \
160
+
--gateway-name $VPN_NAME \
161
+
--name $ROOT_CERT_NAME \
162
+
--public-cert-data $ROOT_CERTIFICATE \
163
163
--output none
164
164
```
165
165
166
166
## Configure the VPN client
167
167
The Azure virtual network gateway will create a downloadable package with configuration files required to initialize the VPN connection on your on-premises Linux machine. The following script will place the certificates you created in the correct spot and configure the `ipsec.conf` file with the correct values from the configuration file in the downloadable package.
0 commit comments