天天看點

操縱BGP AS-PATH 屬性案例(配圖+詳細驗證過程)

BGP總是優先選擇具有最短AS路徑的路由。本案例中,我們将配置R1,将1.0.0.0通告給R2、R3之前預先添加兩個額外的AS路徑到1.0.0.0上(AS300、AS400)

具體配置如下:

//// r1 ////

int f2/0

  ip ad 192.1.1.1 255.255.255.0

int f3/0

  ip ad 193.1.1.1 255.255.255.0

int lo0

  ip ad 1.1.1.1 255.255.255.0

int lo1

  ip ad 2.2.2.2 255.255.255.0

router bgp 100

  no syn

  neighbor 192.1.1.2 remote-as 200

  neighbor 193.1.1.3 remote-as 200

  network 1.0.0.0

  neighbor 193.1.1.3 route-map aspath out

access-list 1 permit 1.0.0.0 0.255.255.255

route-map aspath 10

  match ip ad 1

  set as-path prepend 300 400

route-map aspath 20

//// r2 ////

  ip ad 192.1.1.2 255.255.255.0

int f4/0

  ip ad 194.1.1.2 255.255.255.0

router os 1

  netw 0.0.0.0 255.255.255.255 a 0

  passive-interface f2/0

router bgp 200

  neighbor 192.1.1.1 remote-as 100

  neighbor 194.1.1.4 remote-as 200

  neighbor 195.1.1.3 remote-as 200

  neighbor 194.1.1.4 next-hop-self

//// r3 ////

  ip ad 193.1.1.3 255.255.255.0

int f5/0

  ip ad 195.1.1.3 255.255.255.0

  passive-interface f3/0

  neighbor 193.1.1.1 remote-as 100

  neighbor 195.1.1.4 remote-as 200

  neighbor 195.1.1.4 next-hop-self

  neighbor 194.1.1.2 remote-as 200

//// r4 ////

  ip ad 194.1.1.4 255.255.255.0

  ip ad 195.1.1.4 255.255.255.0

  ip ad 4.4.4.4 255.255.255.0

  netw 4.0.0.0

驗證:

r3#sh ip b

   Network          Next Hop            Metric LocPrf Weight Path

*>i1.0.0.0          192.1.1.1                0    100      0 100 i

*                   193.1.1.1                0             0 100 300 400 i

* i2.0.0.0          192.1.1.1                0    100      0 100 i

*>                  193.1.1.1                0             0 100 i

*>i4.0.0.0          195.1.1.4                0    100      0 i

r3#sh ip ro

B    1.0.0.0/8 [200/0] via 192.1.1.1, 00:05:23

B    2.0.0.0/8 [20/0] via 193.1.1.1, 00:05:23

     4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

O       4.4.4.4/32 [110/65] via 195.1.1.4, 00:10:38, Serial5/0

B       4.0.0.0/8 [200/0] via 195.1.1.4, 00:10:13

C    193.1.1.0/24 is directly connected, Serial3/0

O    192.1.1.0/24 [110/192] via 195.1.1.4, 00:10:38, Serial5/0

C    195.1.1.0/24 is directly connected, Serial5/0

O    194.1.1.0/24 [110/128] via 195.1.1.4, 00:10:38, Serial5/0

本文轉自 ciscodocu51CTO部落格,原文連結:http://blog.51cto.com/ciscodocu/52841,如需轉載請自行聯系原作者

繼續閱讀