View a markdown version of this page

教學課程:設定 BYOIP 字首的委派 RPKI - Amazon Virtual Private Cloud

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

教學課程:設定 BYOIP 字首的委派 RPKI

本教學課程會逐步解說所有 BGP 路由保護功能。您可以在任何步驟之後停止,並使用您目前設定的內容。步驟 1 和 2 不需要 RIR 互動。步驟 3 和更新版本需要使用 RIR 進行一次性設定。如需 BGP 路由保護概念、層要求和支援 RIRs背景,請參閱 監控 BGP 路由保護

先決條件

  • 在進階方案中建立的 IPAM。

  • 佈建至 IPAM 集區的一或多個 BYOIP 字首。

  • 存取您的區域網際網路登錄帳戶 (ARIN、RIPE、APNIC 或 LACNIC)。

步驟 1:檢視您的 BGP 路由

將 BYOIP 字首佈建至 IPAM 後,請在集中式儀表板中檢視所有公告的路由。

AWS Management Console
檢視您的 BGP 路由
  1. 請在 https://console.aws.amazon.com/ipam/ 開啟 IPAM 主控台。

  2. 在導覽窗格中,選擇 IPAM,然後選擇您的 IPAM。

  3. 監控下,選擇路由監控

儀表板會顯示具有字首、地區設定、公告狀態、ASN、RPKI 有效性、ROA 強度和路由重疊的所有 BYOIP 路由。

Command line

使用 get-ipam-discovered-routes 來檢視探索的路由。免費方案和進階方案客戶皆可使用此命令。

aws ec2 get-ipam-discovered-routes \ --ipam-resource-discovery-id ipam-res-disco-0365d2977fc1672fe \ --resource-region us-west-2

以下為範例輸出。

{ "IpamDiscoveredRoutes": [ { "IpamResourceDiscoveryId": "ipam-res-disco-0365d2977fc1672fe", "ResourceRegion": "us-west-2", "ResourceOwnerId": "123456789012", "Cidr": "203.0.113.0/24", "Asn": "64512", "State": "advertised", "AdvertisementType": "regional", "NetworkBorderGroup": "us-west-2", "PoolId": "ipv4pool-ec2-0a1b2c3d4e5f6g7h8", "IpamPoolId": "ipam-pool-0da89c821626f1e4b", "SampleTime": "2026-03-10T15:30:00+00:00" } ] }

步驟 2:檢閱路由保護問題清單

對於進階方案客戶,IPAM 會根據發佈的 ROA 資料評估路由,並使用 get-ipam-route-protection-findings 顯示調查結果。

注意

get-ipam-route-protection-findings 需要進階層。免費方案客戶會收到UnsupportedOperation錯誤。

  1. 列出所有問題清單。

    aws ec2 get-ipam-route-protection-findings \ --ipam-id ipam-0a1b2c3d4e5f6g7h8
  2. 篩選無效或缺少的 ROAs。

    aws ec2 get-ipam-route-protection-findings \ --ipam-id ipam-0a1b2c3d4e5f6g7h8 \ --filters "Name=rpki-status,Values=invalid,unknown"
  3. 依特定區域中的狀態篩選。

    aws ec2 get-ipam-route-protection-findings \ --ipam-id ipam-0a1b2c3d4e5f6g7h8 \ --filters "Name=rpki-status,Values=invalid" "Name=resource-region,Values=us-west-2"

以下為範例輸出。

{ "IpamId": "ipam-0a1b2c3d4e5f6g7h8", "RouteProtectionFindings": [ { "ResourceOwnerId": "123456789012", "ResourceRegion": "us-west-2", "IpamPoolId": "ipam-pool-0da89c821626f1e4b", "Cidr": "203.0.113.0/24", "State": "advertised", "AdvertisementType": "regional", "NetworkBorderGroup": "us-west-2", "PoolId": "ipv4pool-ec2-0a1b2c3d4e5f6g7h8", "Asn": "64512", "RpkiStatus": "valid", "RpkiStrength": "strict", "Roas": [ { "Asn": "64512", "Prefix": "203.0.113.0/24", "MaxLength": 24, "Match": true, "Expiration": "2027-06-15T00:00:00Z" } ], "RouteOverlaps": [ { "Prefix": "203.0.113.128/25", "Asn": "64513", "DetectedAt": "2026-03-10T15:45:00+00:00" } ], "SampleTime": "2026-03-10T15:30:00+00:00", "RoaSampleTime": "2026-03-10T16:00:00+00:00" } ] }

有效的篩選條件名稱為 cidraccount-idresource-regionbyoip-cidr-stateadvertisement-typenetwork-border-groupipam-pool-idrpki-statusasn。這些 EC2-style的篩選條件名稱不一定符合傳回的欄位。例如,您篩選 ,account-id但回應會傳回 ResourceOwnerId,而您篩選 ,byoip-cidr-state但 欄位為 State。ROA 強度不可篩選。

步驟 3:設定委派的 RPKI

委派的 RPKI 可讓您授權 代表您 AWS 管理 ROAs。

  1. 建立網際網路登錄檔關聯。

    aws ec2 create-ipam-internet-registry-association --region us-east-1 \ --ipam-id ipam-0de83dba6694560a9 \ --rir ARIN --org-handle my-arin-org

    以下為範例輸出。

    { "IpamInternetRegistryAssociation": { "IpamInternetRegistryAssociationId": "ipam-internet-registry-assoc-036486dfa6af58ee0", "State": "create-in-progress" } }

    執行下列命令,直到狀態達到 pending-enable

    aws ec2 describe-ipam-internet-registry-associations --region us-east-1 \ --ipam-internet-registry-association-ids ipam-internet-registry-assoc-036486dfa6af58ee0

    一旦狀態為 pending-enable,ChildRequestXml 即可提交至 RIR。IPAM 會根據公有 VRP (已驗證的 ROAs 承載) 資料來階段 ROA。它們處於待定狀態,一旦啟用網際網路登錄關聯,就會啟用。

  2. 檢閱暫存 ROAs。

    aws ec2 get-ipam-route-origin-authorizations --region us-east-1 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0

    以下為範例輸出。

    { "Roas": [ { "prefix": "18.96.0.0/14", "asn": "77221", "maxLength": "24", "state": "pending-activate" } ] }
  3. 啟用網際網路登錄檔關聯。

    將 ChildRequestXml 移至 RIR 入口網站,然後提交委派請求。RIR 會傳回父回應 XML。從該回應中擷取下列欄位:RpkiVersion、ServiceUri、ChildHandle、ParentHandle 和 ParentBpkiTa。然後呼叫下列命令。

    aws ec2 enable-ipam-internet-registry-association --region us-east-1 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0 \ --rpki-version "..." \ --service-uri "..." \ --child-handle "..." \ --parent-handle "..." \ --parent-bpki-ta "..."

    以下為範例輸出。

    { "IpamInternetRegistryAssociation": { "IpamInternetRegistryAssociationId": "ipam-internet-registry-assoc-036486dfa6af58ee0", "State": "enable-in-progress" } }

    執行下列命令,直到狀態達到 enable-complete

    aws ec2 describe-ipam-internet-registry-associations --region us-east-1 \ --ipam-internet-registry-association-ids ipam-internet-registry-assoc-036486dfa6af58ee0

    一旦狀態為 enable-complete,暫存 ROAs 轉換為 create-complete. AWS now 會管理此關聯下所有 CIDRs ROA 生命週期。

  4. 檢視相關聯的 CIDRs。

    aws ec2 get-ipam-internet-registry-association-cidrs --region us-east-1 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0

    以下為範例輸出。

    { "IpamInternetRegistryAssociationCidrs": [ { "Cidr": "18.96.0.0/14", "LastObservedAt": "2026-07-30T18:00:00.000Z" } ] }
  5. 檢視相關聯的 ASNs。

    aws ec2 get-ipam-internet-registry-association-asns --region us-east-1 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0

    以下為範例輸出。

    { "IpamInternetRegistryAssociationAsns": [ { "Asn": "77221", "LastObservedAt": "2026-07-30T18:00:00.000Z" } ] }

步驟 4:使用自動 ROA 建立佈建 BYOIP

使用委派的 RPKI 時,可簡化佈建。

之前 (不含委派的 RPKI) After (使用委派的 RPKI)
必須提供 --cidr-authorization-context 仍然通過 --cidr-authorization-context,但使用 Message="CoveredByInternetRegistryAssociation",Signature=""- 不需要簽署的訊息
必須透過 WHOIS 或 DNS TXT 記錄進行驗證 非必要 — IPAM 驗證關聯 CIDRs
在公告之前,必須在 RIR 手動建立 ROAs 佈建時自動建立的 ROAs
必須在過期前手動續約 ROAs AWS 自動續約 — 不需要任何動作
aws ec2 provision-ipam-pool-cidr \ --cidr 18.97.16.0/24 \ --ipam-pool-id ipam-pool-0da89c821626f1e4b \ --cidr-authorization-context Message="CoveredByInternetRegistryAssociation",Signature="" \ --region us-east-1

IPAM 透過網際網路註冊協會驗證擁有權,並建立符合集區地區設定和 ASN 的嚴格 ROAs。沒有手動 ROA 步驟。

步驟 5:管理內部部署字首的 ROAs

對於未帶到其中的 IP 空間 AWS,請使用路由政策註冊 (RPRs)。

  1. 建立 RPR。

    aws ec2 create-ipam-routing-policy-registration --region us-east-1 \ --ipam-id ipam-0de83dba6694560a9 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0 \ --cidr 18.96.0.0/14 --asns 77221,13446 \ --permit-more-specific-announcements

    以下為範例輸出。

    { "deltaId": "0130c368-1f8c-4283-8f16-66e67e633086", "state": "PENDING" }
  2. 檢查差異狀態。如果變更會使現有路由失效,則會失敗並顯示錯誤。使用 --force 覆寫。

    aws ec2 get-ipam-routing-policy-registration-deltas --region us-east-1 \ --ipam-id ipam-0de83dba6694560a9 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0 \ --delta-id 0130c368-1f8c-4283-8f16-66e67e633086
  3. 批次更新 (原子)。批次更新會以原子方式成功或失敗。沒有部分應用程式。

    aws ec2 batch-modify-ipam-routing-policy-registrations --region us-east-1 \ --ipam-id ipam-0de83dba6694560a9 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0 \ --delta-json file://delta.json

    其中 delta.json包含下列項目。

    { "Add": [ { "prefix": "18.96.0.0/14", "asns": ["77221", "13446"], "permit-more-specific-announcements": "false" } ], "Delete": [ { "prefix": "18.97.16.0/24", "asns": ["77221", "13446"], "permit-more-specific-announcements": "false" } ] }
  4. 檢視關聯的所有註冊。

    aws ec2 get-ipam-routing-policy-registrations --region us-east-1 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0

    以下為範例輸出。

    { "IpamRoutingPolicyRegistrations": [ { "Cidr": "18.96.0.0/14", "Asns": ["77221", "13446"], "PermitMoreSpecificAnnouncements": false, "MaxLength": 14, "LatestDeltaId": "0130c368-1f8c-4283-8f16-66e67e633086", "State": "create-complete" }, { "Cidr": "18.97.16.0/24", "Asns": ["77221", "13446"], "PermitMoreSpecificAnnouncements": false, "MaxLength": 24, "LatestDeltaId": "0130c368-1f8c-4283-8f16-66e67e633086", "State": "create-complete" } ] }
  5. 篩選至特定字首。

    aws ec2 get-ipam-routing-policy-registrations --region us-east-1 \ --ipam-internet-registry-association-id ipam-internet-registry-assoc-036486dfa6af58ee0 \ --cidr 18.96.0.0/14

步驟 6:設定路由異常的 CloudWatch 警示

IPAM 會將每個 BYOIP 路由的 CloudWatch 指標發佈至全域 IPAM 帳戶。RoaExpiration 指標會發佈至具有維度 CidrAsnRoaPrefix和 的AWS/IPAM命名空間MaxLength

Type 名稱 描述
指標 RoaExpiration ROA 過期前的天數
維度 Asn 字首的 ASN
維度 Cidr 透過 BYOIP 帶來的 CIDR
維度 MaxLength ROA 的最大MaxLength
維度 RoaPrefix ROA 的字首

由於 RoaExpiration會報告 ROA 過期前的剩餘天數,當值降至閾值或低於閾值時發出警示。指定全部四個維度以單一 ROA 為目標。在發佈指標的相同帳戶和區域中建立警示。

aws cloudwatch put-metric-alarm --region us-east-1 \ --alarm-name "IPAM-RoaExpiration-203.0.113.0-24" \ --alarm-description "Alert when the ROA for 203.0.113.0/24 is within 30 days of expiration" \ --namespace "AWS/IPAM" \ --metric-name RoaExpiration \ --dimensions Name=Cidr,Value=203.0.113.0/24 Name=RoaPrefix,Value=203.0.113.0/24 Name=Asn,Value=64512 Name=MaxLength,Value=24 \ --statistic Minimum \ --period 86400 \ --evaluation-periods 1 \ --threshold 30 \ --comparison-operator LessThanOrEqualToThreshold \ --treat-missing-data notBreaching \ --alarm-actions arn:aws:sns:us-east-1:123456789012:roa-expiry-notifications

清除

若要移除委派的 RPKI 資源:

  1. 刪除所有路由政策註冊。

  2. 取消網際網路登錄檔關聯的關聯。

  3. (選用) 移除 RIR 入口網站的授權。

重要

刪除網際網路登錄檔關聯會移除該關聯的所有 AWS受管 ROAs。在取消關聯之前,請確定您的路由具有替代 ROA 涵蓋範圍。