你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
用于创建隔离域的配置示例
本文提供了如何在各种方案中配置隔离域的示例。
创建 L2 隔离域
在此示例中,我们将创建具有以下属性的第 2 层隔离域:
- 名称:
l2domain1
- 资源组:
rg1
- 位置:
eastus
- 网络结构 ID:
nf1
- VLAN ID:600
命令:
az networkfabric l2domain create \
--resource-group rg1 \
--name l2domain1 \
--location eastus \
--network-fabric-id nf1 \
--vlan-id 600
预期输出:
{
"administrativeState": "Enabled",
"id": "/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/resourceGroups/rg1/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/l2domain1",
"name": "l2domain1",
"networkFabricId": "/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/resourceGroups/NFResourceGroupName/providers/Microsoft.ManagedNetworkFabric/NetworkFabrics/nf1",
"provisioningState": "Succeeded",
"resourceGroup": "rg1",
"systemData": {
"createdAt": "2023-XX-XXT12:34:56.789012+00:00",
"createdBy": "email@address.com",
"createdByType": "User",
"lastModifiedAt": "2023-XX-XXT12:34:56.789012+00:00",
"lastModifiedBy": "email@address.com",
"lastModifiedByType": "User"
},
"type": "microsoft.managednetworkfabric/l2isolationdomains",[^2^][2]
"vlanId": 600
}
创建 L3 隔离域。
若要创建 L3 隔离域,可以按照以下步骤操作:
az networkfabric l3domain create
使用命令创建 L3 隔离域。 必须指定所需的参数:- 资源组
- 资源名称
- 位置
- 网络结构 ID。
还可以指定可选参数,例如:
- 重新分发连接的子网
- 重新分发静态路由
- 聚合路由配置
- 连接子网路由策略。
az networkfabric internalnetwork create
使用命令为 L3 隔离域创建一个或多个内部网络。 需要提供:- The VLAN ID
- 连接的 IPv4 或 IPv6 子网
- 每个内部网络的 BGP 配置。
还可以指定可选参数,例如:
- MTU
- 静态路由配置
- 扩展名。
az networkfabric externalnetwork create
使用命令为 L3 隔离域创建外部网络。 需要选择对等互连选项(选项 A 或选项 B),并提供相应的属性,例如对等 ASN、VLAN ID、主要和辅助 IPv4 或 IPv6 前缀以及路由目标。az networkfabric l3domain update-admin-state
使用命令启用 L3 隔离域。 必须启用隔离域才能将配置推送到网络结构设备。
示例:
在此示例中,我们将创建具有以下属性的 L3 隔离域:
- 名称:
example-l3domain
- 网络构造 ID
/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/resourceGroups/NFResourceGroupName/providers/Microsoft.ManagedNetworkFabric/NetworkFabrics/NFName
。
命令:
az networkfabric l3domain create \
--resource-group "ResourceGroupName" \
--resource-name "example-l3domain" \
--location "eastus" \
--nf-id "/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/resourceGroups/NFResourceGroupName/providers/Microsoft.ManagedNetworkFabric/NetworkFabrics/NFName"
创建内部网络
在此示例中,我们将创建具有以下属性的内部网络:
- VLAN ID:1001
- IPv4 子网:10.0.0.0/24
- L3 隔离域名:
example-l3domain
命令:
az networkfabric internalnetwork create \
--resource-group "ResourceGroupName" \
--l3-isolation-domain-name "example-l3domain" \
--resource-name "example-internalnetwork" \
--vlan-id 1001 \
--connected-ipv4-subnets '[{"prefix":"10.0.0.0/24"}]' \
--mtu 1500
以下示例使用 IPv6 地址而不是 IPv4:
az networkfabric internalnetwork create \
--resource-group "ResourceGroupName" \
--l3-isolation-domain-name "example-l3domain" \
--resource-name "example-internalnetwork" \
--vlan-id 1002 \
--connected-ipv6-subnets '[{"prefix":"10:101:1::0/64"}]' \
--mtu 1500
在此示例中,我们将添加 BGP 配置:
az networkfabric internalnetwork create \
--resource-group "ResourceGroupName" \
--l3-isolation-domain-name "example-l3domain" \
--resource-name "example-internalnetwork" \
--vlan-id 1003 \
--connected-ipv4-subnets '[{"prefix":"10.1.2.0/24"}]' \
--mtu 1500 \
--bgp-configuration '{"defaultRouteOriginate": "True", "allowAS": 2, "allowASOverride": "Enable", "PeerASN": 65535, "ipv4ListenRangePrefixes": ["10.1.2.0/28"]}'
创建外部网络
此示例使用选项 B 和 IPv4 和 IPv6 路由目标创建外部网络
命令:
az networkfabric externalnetwork create \
--resource-group "ResourceGroupName" \
--l3domain "example-l3domain" \
--resource-name "example-externalnetwork" \
--peering-option "OptionB" \
--option-b-properties "{routeTargets:{exportIpv4RouteTargets:['65045:2001'],importIpv4RouteTargets:['65045:2001'],exportIpv6RouteTargets:['65045:2002'],importIpv6RouteTargets:['65045:2002']}}"
预期输出:
{
"administrativeState": "Enabled",
"id": "/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/resourceGroups/NFResourceGroupName/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain/externalNetworks/example-externalnetwork",
"name": "example-externalnetwork",
"optionBProperties": {
"exportRouteTargets": [
"65045:2001",
"65045:2002"
],
"importRouteTargets": [
"65045:2001",
"65045:2002"
],
"routeTargets": {
"exportIpv4RouteTargets": [
"65045:2001"
],
"importIpv4RouteTargets": [
"65045:2001"
],
"exportIpv6RouteTargets": [
"65045:2002"
\,
"importIpv6RouteTargets": [
"65045:2002"
]
}
},
"peeringOption": "OptionB",
"provisioningState": "Succeeded",
"resourceGroup": "ResourceGroupName",
"systemData": {
"createdAt": "2023-XX-XXT15:45:31.938216+00:00",
"createdBy": "email@address.com",
"createdByType": "User",
"lastModifiedAt": "2023-XX-XXT15:45:31.938216+00:00",
"lastModifiedBy": "email@address.com",
"lastModifiedByType": "User"
},
"type": "microsoft.managednetworkfabric/l3isolationdomains/externalnetworks"
}
此示例使用具有 IPv4 和 IPv6 前缀的选项 A 创建外部网络:
az networkfabric externalnetwork create \
--resource-group "ResourceGroupName" \
--l3domain "example-l3domain" \
--resource-name "example-externalnetwork" \
--peering-option "OptionA" \
--option-a-properties '{"peerASN": 65026,"vlanId": 2423, "mtu": 1500, "primaryIpv4Prefix": "10.18.0.148/30", "secondaryIpv4Prefix": "10.18.0.152/30", "primaryIpv6Prefix": "fda0:d59c:da16::/127", "secondaryIpv6Prefix": "fda0:d59c:da17::/127"}'
预期输出:
{
"administrativeState": "Enabled",
"id": "/subscriptions/xxxxxx-xxxxxx-xxxx-xxxx-xxxxxx/resourceGroups/ResourceGroupName/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/example-l3domain/externalNetworks/example-externalnetwork",
"name": "example-externalnetwork",
"optionAProperties": {
"fabricASN": 65050,
"mtu": 1500,
"peerASN": 65026,
"primaryIpv4Prefix": "10.18.0.148/30",
"secondaryIpv4Prefix": "10.18.0.152/30",
"primaryIpv6Prefix": "fda0:d59c:da16::/127",
"secondaryIpv6Prefix": "fda0:d59c:da17::/127",
"vlanId": 2423
},
"peeringOption": "OptionA",
"provisioningState": "Succeeded",
"resourceGroup": "ResourceGroupName",
"systemData": {
"createdAt": "2023-XX-XXT09:54:00.4244793Z",
"createdAt": "2023-XX-XXT07:23:54.396679+00:00",
"createdBy": "email@address.com",
"lastModifiedAt": "2023-XX-XX1T07:23:54.396679+00:00",
"lastModifiedBy": "email@address.com",
"lastModifiedByType": "User"
},
"type": "microsoft.managednetworkfabric/l3isolationdomains/externalnetworks"
}