使用 Azure CLI 設定 ExpressRoute Direct
ExpressRoute Direct 可讓您透過策略性分散在世界各地的對等互連位置,直接連線至 Microsoft 的全球網路。 如需詳細資訊,請參閱關於 ExpressRoute Direct Connect。
開始之前
在使用 ExpressRoute Direct 之前,必須先註冊您的訂用帳戶。 在使用 ExpressRoute Direct 之前,必須先註冊您的訂用帳戶。 若要註冊,請透過 Azure PowerShell 進行下列動作:
登入 Azure,然後選取要註冊的訂用帳戶。
Connect-AzAccount Select-AzSubscription -Subscription "<SubscriptionID or SubscriptionName>"
使用下列命令,註冊供公開預覽的訂用帳戶:
Register-AzProviderFeature -FeatureName AllowExpressRoutePorts -ProviderNamespace Microsoft.Network
註冊後,請確認訂用帳戶已登錄 Microsoft.Network 資源提供者。 註冊資源提供者可將您的訂用帳戶設定為可搭配資源提供者使用。
建立資源
登入 Azure 並選取包含 ExpressRoute 的訂用帳戶。 ExpressRoute Direct 資源和 ExpressRoute 線路必須位於相同的訂用帳戶中。 在 Azure CLI 中,執行下列命令:
az login
檢查帳戶的訂用帳戶:
az account list
選取您想要建立 ExpressRoute 線路的訂用帳戶:
az account set --subscription "<subscription ID>"
重新註冊您的 Microsoft.Network 訂用帳戶,以存取 expressrouteportslocation 和 expressrouteport API
az provider register --namespace Microsoft.Network
列出支援 ExpressRoute Direct 的所有位置:
az network express-route port location list
範例輸出
[ { "address": "21715 Filigree Court, DC2, Building F, Ashburn, VA 20147", "availableBandwidths": [], "contact": "support@equinix.com", "id": "/subscriptions/<subscriptionID>/providers/Microsoft.Network/expressRoutePortsLocations/Equinix-Ashburn-DC2", "location": null, "name": "Equinix-Ashburn-DC2", "provisioningState": "Succeeded", "tags": null, "type": "Microsoft.Network/expressRoutePortsLocations" }, { "address": "1950 N. Stemmons Freeway, Suite 1039A, DA3, Dallas, TX 75207", "availableBandwidths": [], "contact": "support@equinix.com", "id": "/subscriptions/<subscriptionID>/providers/Microsoft.Network/expressRoutePortsLocations/Equinix-Dallas-DA3", "location": null, "name": "Equinix-Dallas-DA3", "provisioningState": "Succeeded", "tags": null, "type": "Microsoft.Network/expressRoutePortsLocations" }, { "address": "111 8th Avenue, New York, NY 10011", "availableBandwidths": [], "contact": "support@equinix.com", "id": "/subscriptions/<subscriptionID>/providers/Microsoft.Network/expressRoutePortsLocations/Equinix-New-York-NY5", "location": null, "name": "Equinix-New-York-NY5", "provisioningState": "Succeeded", "tags": null, "type": "Microsoft.Network/expressRoutePortsLocations" }, { "address": "11 Great Oaks Blvd, SV1, San Jose, CA 95119", "availableBandwidths": [], "contact": "support@equinix.com", "id": "/subscriptions/<subscriptionID>/providers/Microsoft.Network/expressRoutePortsLocations/Equinix-San-Jose-SV1", "location": null, "name": "Equinix-San-Jose-SV1", "provisioningState": "Succeeded", "tags": null, "type": "Microsoft.Network/expressRoutePortsLocations" }, { "address": "2001 Sixth Ave., Suite 350, SE2, Seattle, WA 98121", "availableBandwidths": [], "contact": "support@equinix.com", "id": "/subscriptions/<subscriptionID>/providers/Microsoft.Network/expressRoutePortsLocations/Equinix-Seattle-SE2", "location": null, "name": "Equinix-Seattle-SE2", "provisioningState": "Succeeded", "tags": null, "type": "Microsoft.Network/expressRoutePortsLocations" } ]
判斷前一個步驟中所列的其中一個位置是否具有可用頻寬:
az network express-route port location show -l "Equinix-Ashburn-DC2"
範例輸出
{ "address": "21715 Filigree Court, DC2, Building F, Ashburn, VA 20147", "availableBandwidths": [ { "offerName": "100 Gbps", "valueInGbps": 100 } ], "contact": "support@equinix.com", "id": "/subscriptions/<subscriptionID>/providers/Microsoft.Network/expressRoutePortsLocations/Equinix-Ashburn-DC2", "location": null, "name": "Equinix-Ashburn-DC2", "provisioningState": "Succeeded", "tags": null, "type": "Microsoft.Network/expressRoutePortsLocations" }
建立 ExpressRoute Direct 資源,該資源是以您在先前步驟中選擇的位置為基礎。
ExpressRoute Direct 支援 QinQ 與 Dot1Q 封裝。 如果選取 QinQ,則每個 ExpressRoute 線路都會動態獲得指派的 S-Tag,而且是整個 ExpressRoute Direct 資源中唯一的。 線路上的每個 C-Tag 必須是線路上唯一的,但不是 ExpressRoute Direct 資源中唯一的。
如果您選取 Dot1Q 封裝,則必須管理 C-Tag (VLAN) 在整個 ExpressRoute Direct 資源中的唯一性。
重要
ExpressRoute Direct 只能是一種封裝類型。 在您建立 ExpressRoute Direct 資源之後,便無法變更封裝類型。
az network express-route port create -n $name -g $RGName --bandwidth 100 gbps --encapsulation QinQ | Dot1Q --peering-location $PeeringLocationName -l $AzureRegion
注意
您也可以將 [封裝] 屬性設定為 Dot1Q。
範例輸出
{ "allocationDate": "Wednesday, October 17, 2018", "bandwidthInGbps": 100, "circuits": null, "encapsulation": "Dot1Q", "etag": "W/\"<etagnumber>\"", "etherType": "0x8100", "id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct", "links": [ { "adminState": "Disabled", "connectorType": "LC", "etag": "W/\"<etagnumber>\"", "id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct/links/link1", "interfaceName": "HundredGigE2/2/2", "name": "link1", "patchPanelId": "PPID", "provisioningState": "Succeeded", "rackId": "RackID", "resourceGroup": "Contoso-Direct-rg", "routerName": "tst-09xgmr-cis-1", "type": "Microsoft.Network/expressRoutePorts/links" }, { "adminState": "Disabled", "connectorType": "LC", "etag": "W/\"<etagnumber>\"", "id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct/links/link2", "interfaceName": "HundredGigE2/2/2", "name": "link2", "patchPanelId": "PPID", "provisioningState": "Succeeded", "rackId": "RackID", "resourceGroup": "Contoso-Direct-rg", "routerName": "tst-09xgmr-cis-2", "type": "Microsoft.Network/expressRoutePorts/links" } ], "location": "westus", "mtu": "1500", "name": "Contoso-Direct", "peeringLocation": "Equinix-Ashburn-DC2", "provisionedBandwidthInGbps": 0.0, "provisioningState": "Succeeded", "resourceGroup": "Contoso-Direct-rg", "resourceGuid": "02ee21fe-4223-4942-a6bc-8d81daabc94f", "tags": null, "type": "Microsoft.Network/expressRoutePorts" }
產生授權委託書 (LOA)
輸入最近建立的 ExpressRoute Direct 資源名稱、資源群組名稱和客戶名稱,以寫入 LOA 並 (選擇性) 定義文件要儲存的檔案位置。 若未參考檔案路徑,文件將下載至當前目錄。
az network express-route port generate-loa -n Contoso-Direct -g Contoso-Direct-rg --customer-name Contoso --destination C:\Users\SampleUser\Downloads\LOA.pdf
變更連結的 AdminState
使用此程序來進行第 1 層測試。 確保每個交叉連線都已在主要和次要連接埠的每個路由器中正確修補。
將連結設定為 [已啟用]。 重複此步驟,將每個連結設定為 [已啟用]。
連結 [0] 是主要連接埠,而連結 [1] 是次要連接埠。
az network express-route port update -n Contoso-Direct -g Contoso-Direct-rg --set links[0].adminState="Enabled"
az network express-route port update -n Contoso-Direct -g Contoso-Direct-rg --set links[1].adminState="Enabled"
範例輸出
{ "allocationDate": "Wednesday, October 17, 2018", "bandwidthInGbps": 100, "circuits": null, "encapsulation": "Dot1Q", "etag": "W/\"<etagnumber>\"", "etherType": "0x8100", "id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct", "links": [ { "adminState": "Enabled", "connectorType": "LC", "etag": "W/\"<etagnumber>\"", "id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct/links/link1", "interfaceName": "HundredGigE2/2/2", "name": "link1", "patchPanelId": "PPID", "provisioningState": "Succeeded", "rackId": "RackID", "resourceGroup": "Contoso-Direct-rg", "routerName": "tst-09xgmr-cis-1", "type": "Microsoft.Network/expressRoutePorts/links" }, { "adminState": "Enabled", "connectorType": "LC", "etag": "W/\"<etagnumber>\"", "id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct/links/link2", "interfaceName": "HundredGigE2/2/2", "name": "link2", "patchPanelId": "PPID", "provisioningState": "Succeeded", "rackId": "RackID", "resourceGroup": "Contoso-Direct-rg", "routerName": "tst-09xgmr-cis-2", "type": "Microsoft.Network/expressRoutePorts/links" } ], "location": "westus", "mtu": "1500", "name": "Contoso-Direct", "peeringLocation": "Equinix-Ashburn-DC2", "provisionedBandwidthInGbps": 0.0, "provisioningState": "Succeeded", "resourceGroup": "Contoso-Direct-rg", "resourceGuid": "<resourceGUID>", "tags": null, "type": "Microsoft.Network/expressRoutePorts" }
使用
AdminState = "Disabled"
,可使用相同的程序來關閉連接埠。
建立線路
根據預設,您可以在包含 ExpressRoute Direct 資源的訂用帳戶中建立 10 個線路。 Microsoft 支援服務可以提高預設限制。 您則負責追蹤已佈建和已使用的頻寬。 已佈建的頻寬是 ExpressRoute Direct 資源上所有線路的頻寬總和。 已使用的頻寬則是基礎實體介面的實際使用量。
您只可以在 ExpressRoute Direct 上使用額外線路頻寬來支援以上所述的案例。 頻寬是 40 Gbps 和 100 Gbps。
SkuTier可為本機、標準或進階。
SkuFamily 在建立時只能是 MeteredData。 您可以藉由更新 sku-family
,在建立線路之後變更為無限制。
注意
若您變更為無限制資料,則除非重新建立 ExpressRoute 線路,否則無法變更回去。
在 ExpressRoute Direct 資源上建立線路:
az network express-route create --express-route-port "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct" -n "Contoso-Direct-ckt" -g "Contoso-Direct-rg" --sku-family MeteredData --sku-tier Standard --bandwidth 100 Gbps --location $AzureRegion
其他頻寬包含:5 Gbps、10 Gbps 及 40 Gbps。
範例輸出
{
"allowClassicOperations": false,
"allowGlobalReach": false,
"authorizations": [],
"bandwidthInGbps": 100.0,
"circuitProvisioningState": "Enabled",
"etag": "W/\"<etagnumber>\"",
"expressRoutePort": {
"id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRoutePorts/Contoso-Direct",
"resourceGroup": "Contoso-Direct-rg"
},
"gatewayManagerEtag": "",
"id": "/subscriptions/<subscriptionID>/resourceGroups/Contoso-Direct-rg/providers/Microsoft.Network/expressRouteCircuits/ERDirect-ckt-cli",
"location": "westus",
"name": "ERDirect-ckt-cli",
"peerings": [],
"provisioningState": "Succeeded",
"resourceGroup": "Contoso-Direct-rg",
"serviceKey": "<serviceKey>",
"serviceProviderNotes": null,
"serviceProviderProperties": null,
"serviceProviderProvisioningState": "Provisioned",
"sku": {
"family": "MeteredData",
"name": "Standard_MeteredData",
"tier": "Standard"
},
"stag": null,
"tags": null,
"type": "Microsoft.Network/expressRouteCircuits"
}
下一步
如需有關 ExpressRoute Direct 的詳細資訊,請參閱概觀。