Set-AzRouteConfig
语法
Default (默认值)
Set-AzRouteConfig
-RouteTable <PSRouteTable>
[-Name <String>]
[-AddressPrefix <String>]
[-NextHopType <String>]
[-NextHopIpAddress <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Set-AzRouteConfig cmdlet 更新路由表的路由配置。
示例
示例 1:修改路由
Get-AzRouteTable -ResourceGroupName "ResourceGroup11" -Name "RouteTable01" | Set-AzRouteConfig -Name "Route02" -AddressPrefix 10.4.0.0/16 -NextHopType VnetLocal | Set-AzRouteTable
Name : Routetable01
ResourceGroupName : ResourceGroup11
Location : eastus
Id : /subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Microsoft.Networ
k/routeTables/RouteTable01
Etag : W/"58c2922e-9efe-4554-a457-956ef44bc718"
ProvisioningState : Succeeded
Tags :
Routes : [
{
"Name": "Route07",
"Etag": "W/\"58c2922e-9efe-4554-a457-956ef44bc718\"",
"Id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Micro
soft.Network/routeTables/Routetable01/routes/Route07",
"AddressPrefix": "10.1.0.0/16",
"NextHopType": "VnetLocal",
"NextHopIpAddress": null,
"ProvisioningState": "Succeeded"
},
{
"Name": "route02",
"Etag": "W/\"58c2922e-9efe-4554-a457-956ef44bc718\"",
"Id": "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/ResourceGroup11/providers/Micro
soft.Network/routeTables/routetable01/routes/route02",
"AddressPrefix": "10.4.0.0/16",
"NextHopType": "VnetLocal",
"NextHopIpAddress": null,
"ProvisioningState": "Succeeded"
}
]
Subnets : []
此命令使用 Get-AzRouteTable cmdlet 获取名为 RouteTable01 的路由表。
该命令使用管道运算符将该表传递到当前 cmdlet。
当前 cmdlet 修改名为 Route02 的路由,然后将结果 传递给 Set-AzRouteTable cmdlet,该 cmdlet 将更新表以反映更改。
示例 2:使用服务标记修改路由(公共预览版)
Set-AzRouteConfig -Name "Route02" -AddressPrefix "AppService" -NextHopType "VirtualAppliance" -NextHopIpAddress "10.0.2.4"
此命令将修改名为 Route02 的路由,并将服务标记作为 AddressPrefix 参数提供。
参数
-AddressPrefix
以无类别域际路由选择(CIDR)格式指定路由应用到的目标。 还可以在此处指定服务标记(此功能为公共预览版)。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Name
指定此 cmdlet 修改的路由的名称。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-NextHopIpAddress
指定添加到 Azure 虚拟网络的虚拟设备的 IP 地址。
此路由将数据包转发到该地址。
仅当为 NextHopType 参数指定 VirtualAppliance 值时,才指定此参数。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-NextHopType
指定此路由如何转发数据包。
此参数的可接受值为:
- Internet。
Azure 提供的默认 Internet 网关。
- 没有。
如果指定此值,则路由不会转发数据包。
- VirtualAppliance。
添加到 Azure 虚拟网络的虚拟设备。
- VirtualNetworkGateway。
Azureserver-to-server 虚拟专用网络网关。
- VnetLocal。
本地虚拟网络。
如果同一虚拟网络中有两个子网,即 10.1.0.0/16 和 10.2.0.0/16,请为每个子网选择 VnetLocal 的值以转发到其他子网。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-RouteTable
指定与此路由关联的路由表。
参数属性
参数集
(All)
Position: | Named |
必需: | True |
来自管道的值: | True |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 命令脚本未运行。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出