列出 BGP 路由政策
本頁面說明如何在 Cloud Router 上列出邊界閘道通訊協定 (BGP) 路徑政策,協助您排解 BGP 路徑政策的問題。
事前準備
gcloud
如要使用本指南中的指令列範例,請完成下列事項:
- 安裝或更新至最新版 Google Cloud CLI。
- 設定預設地區和區域。
API
如要使用本指南提供的 API 範例,請設定 API 存取權。
列出 BGP 路由政策
主控台
前往 Trusted Cloud 控制台的「Cloud Router」頁面。
在「Cloud Router」頁面中,按一下「BGP Route Policies」分頁。
如要查看 BGP 路由政策的 BGP 路由政策條款,請按一下 BGP 路由政策名稱。
gcloud
使用 gcloud compute routers list-route-policies
指令:
gcloud compute routers list-route-policies ROUTER_NAME \
--region=REGION
更改下列內容:
ROUTER_NAME
:Cloud Router 的名稱REGION
:Cloud Router 所在的地區
輸出結果會與下列內容相似:
NAME: test-policy-1
TYPE: ROUTE_POLICY_TYPE_EXPORT
NAME: test-policy-2
TYPE: ROUTE_POLICY_TYPE_IMPORT
API
請使用 routers.listRoutePolicies
方法:
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/routers/ROUTER_NAME/listRoutePolicies
更改下列內容:
PROJECT_ID
:包含 Cloud Router 的專案REGION
:Cloud Router 所在的地區ROUTER_NAME
:Cloud Router 的名稱
輸出結果會與下列內容相似:
{
"kind": "compute#routersListRoutePolicies",
"result": [
{
"name": "ROUTER_NAME",
"type": "ROUTE_POLICY_TYPE_IMPORT",
"terms": [
{
"priority": 1,
"match": {
"expression": "destination != \"192.168.10.0/24\" && communities.matchesEvery([\"65000:1\", \"65000:2\"])"
},
"actions": [
{
"expression": "med.set(12345)"
}
]
},
{
"priority": 2,
"match": {
"expression": "destination != \"192.168.10.0/24\""
},
"actions": [
{
"expression": "med.set(12345)"
}
]
}
],
"fingerprint": "ulgdg-dGCms="
}
]
}