0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【忘備録】CCIE勉強メモ_20250915

Last updated at Posted at 2025-09-13

参考資料・時間

資料:
CCIE Enterprise Infrastructure Foundation lab
BGP lab 7-8

勉強時間:
約2.5時間

学習内容

ルートフィルタリングの続き。

bgp max-as-limit

ルータ全体に対し、BGPの最大AS-PATH数を指定。

変更前

R2#sh ip bgp | begin Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>   30.3.3.0/24      20.1.1.20                              0 300 i
 *>   31.3.3.0/24      20.1.1.20                              0 300 i
 *>   32.3.3.0/24      20.1.1.20                              0 300 i
 *>   33.3.3.0/24      20.1.1.20                              0 300 i
 *>   34.3.3.0/24      20.1.1.20                              0 300 i
 *>   200.1.1.1/32     20.1.1.20                              0 300 100 i
 *>   200.1.1.2/32     0.0.0.0                  0         32768 i
 *>   200.1.1.3/32     20.1.1.20                              0 300 i
 *>   200.1.1.4/32     20.1.1.20                              0 300 500 400 i
 *>   200.1.1.5/32     20.1.1.20                              0 300 500 i
 *>   200.1.1.6/32     6.6.6.6                  0             0 600 i
 *>   200.1.1.7/32     20.1.1.20                              0 300 100 700 700 700 700 700 i
 *>   200.1.1.8/32     20.1.1.20                              0 300 100 800 i
 *>   200.1.1.10/32    20.1.1.20                              0 300 100 i
 *>   200.1.1.20/32    20.1.1.20                0             0 300 i
 *>   200.1.1.30/32    20.1.1.20                              0 300 100 800 933 i

最大ASパス数を2に変更

R2(config)#router bgp 200
R2(config-router)#bgp maxas-limit 2

R2(config-router)#do sh ip bgp | begin Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>   30.3.3.0/24      20.1.1.20                              0 300 i
 *>   31.3.3.0/24      20.1.1.20                              0 300 i
 *>   32.3.3.0/24      20.1.1.20                              0 300 i
 *>   33.3.3.0/24      20.1.1.20                              0 300 i
 *>   34.3.3.0/24      20.1.1.20                              0 300 i
 *>   200.1.1.1/32     20.1.1.20                              0 300 100 i
 *>   200.1.1.2/32     0.0.0.0                  0         32768 i
 *>   200.1.1.3/32     20.1.1.20                              0 300 i
 *>   200.1.1.5/32     20.1.1.20                              0 300 500 i
 *>   200.1.1.6/32     6.6.6.6                  0             0 600 i
 *>   200.1.1.10/32    20.1.1.20                              0 300 100 i
 *>   200.1.1.20/32    20.1.1.20                0             0 300 i

BGP RIBテーブル

ここはchatGPT君の力も借りて書いてます。

BGPは内部に3つのテーブルを持つ。

①Adj-RIB-In
ピアルータから受け取ったルート情報を格納。
Inboundポリシーやフィルターの掛けられていない生のデータを扱う。

adj-RIB-Inに対し、route-map, filter-list, distribution-listがかけられた後、次に行く。

②Loc-RIB (Local-RIB)
adj-RIB-Inで処理したルートに加え、networkコマンドや再配布にて自分で生成したルートが対象となる。
これらのルートでBest Path Selectionが行われる。

③adj-RIB-Out
ここにあるルートがルーティングテーブルに載る。
この後、Outboundポリシー(route-map, filter-list, Community操作)が掛かりNeighborに広告される。


各RIBの確認方法

Adj-RIB-In

データを処理したのちに削除するため、通常では見えない。
確認するには事前設定として、以下のコマンドの投入が必要

router bgp 100
neighbor 3.3.3.3 soft-reconfiguration inbound

確認コマンドは以下

R1#show ip bgp neighbors 3.3.3.3 received-routes
BGP table version is 300, local router ID is 200.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   200.1.1.2/32     3.3.3.3                                0 300 200 i
 *>   200.1.1.3/32     3.3.3.3                  0             0 300 i
 *    200.1.1.4/32     3.3.3.3                                0 300 500 400 i
 *    200.1.1.5/32     3.3.3.3                                0 300 500 i
 *>   200.1.1.20/32    3.3.3.3                                0 300 i

また、show ip bgp neighbors [ip] routesでは、フィルター処理後のadj-RIB-Inが見れる。

R1#show ip bgp neighbors 3.3.3.3 routes
BGP table version is 270, local router ID is 200.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   200.1.1.2/32     3.3.3.3                                0 300 200 i
 *>   200.1.1.3/32     3.3.3.3                  0             0 300 i
 *    200.1.1.4/32     3.3.3.3                                0 300 500 400 i
 *    200.1.1.5/32     3.3.3.3                                0 300 500 i
 *>   200.1.1.20/32    3.3.3.3                                0 300 i

Loc-RIB

show ip bgp にて表示。特別な設定は不要

R1#show ip bgp
BGP table version is 300, local router ID is 200.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   200.1.1.1/32     0.0.0.0                  0         32768 i
 *>   200.1.1.2/32     3.3.3.3                                0 300 200 i
 *>   200.1.1.3/32     3.3.3.3                  0             0 300 i
 *                     4.4.4.4                                0 400 500 300 i
 *                     5.5.5.5                                0 500 300 i
 *    200.1.1.4/32     3.3.3.3                                0 300 500 400 i
 *                     5.5.5.5                                0 500 400 i
 *>                    4.4.4.4                  0             0 400 i
 *    200.1.1.5/32     3.3.3.3                                0 300 500 i
 *                     4.4.4.4                                0 400 500 i
 *>                    5.5.5.5                  0             0 500 i
 *>i  200.1.1.7/32     10.1.1.10                0    100      0 700 700 700 700 700 i
 *                     5.5.5.5                                0 500 400 700 700 700 700 700 i
 *                     4.4.4.4                                0 400 700 700 700 700 700 i
 *>i  200.1.1.8/32     10.1.1.10                0    100      0 800 i
 *>i  200.1.1.10/32    10.1.1.10                0    100      0 i
 *>   200.1.1.20/32    3.3.3.3                                0 300 i
 *>i  200.1.1.30/32    10.1.1.10                0    100      0 800 933 i

Adj-RIB-Out
R1#show ip bgp neighbors [neighbor-ip] advertised-routes

R1#show ip bgp neighbors 3.3.3.3 advertised-routes
BGP table version is 276, local router ID is 200.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
              t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>   200.1.1.1/32     0.0.0.0                  0         32768 i
 *>   200.1.1.3/32     3.3.3.3                  0             0 300 i
 *>   200.1.1.4/32     4.4.4.4                  0             0 400 i
 *>   200.1.1.5/32     5.5.5.5                  0             0 500 i
 *>i  200.1.1.7/32     10.1.1.10                0    100      0 700 700 700 700 700 i
 *>i  200.1.1.8/32     10.1.1.10                0    100      0 800 i
 *>i  200.1.1.10/32    10.1.1.10                0    100      0 i
 *>i  200.1.1.30/32    10.1.1.10                0    100      0 800 933 i

ORF (Outbound Route Filtering)

ここまではAdj-RIB-Inにプレフィックスが入力され、
そこからLoc-RIBに入るまでにInboundポリシー等によりフィルタリングされるという話だった。

このままではAdj-RIB-Inに入ることでメモリの圧迫につながるので、
特定のネイバーと事前にネゴシエーションすることでそもそも特定のプレフィックスがAdj-RIB-Inに入らないようにする。

初期設定

R1:1.1.1.1
router bgp 100
neighbor 2.2.2.2 remote-as 200
neighbor 2.2.2.2 update-source loopback0
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 2.2.2.2 prefix-list 1 in
ip prefix-list 1 deny 20.2.2.2/32
ip prefix-list 1 permit 0.0.0.0/0 le 32

-------------------------------------------------

R2:2.2.2.2
router bgp 200
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source loopback0
neighbor 1.1.1.1 ebgp-multihop 2
network 20.2.2.2 mask 255.255.255.255
network 200.2.2.2 mask 255.255.255.255

この時点では、R2はR1に向かって20.2.2.2/32と200.2.2.2/32を広告。
しかし、R1側のAdj-RIB-Inにて受け取った後にInboundフィルターで破棄される。

R1から「prefix-list 1を受信して20.2.2.2/32を破棄する」という情報を送り、
R2からprefix-list 1の内容にあたる20.2.2.2/32を送信しないようにする。

R1

R1(config)#router bgp 100
R1(config-router)#neighbor 2.2.2.2 capability orf prefix-list send

R2

R2(config)#router bgp 200
R2(config-router)#neighbor 1.1.1.1 capability orf prefix-list receive

これでR1には20.2.2.2/32が送信されない。
※200.2.2.2/32はpermitされてるので受信する。

また、capability orf prefix-list はsend/receiveだけでなく、bothもある。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?