天天看點

配置基本的bgp

      這幾天由于去學曆考試,幾天沒寫部落格了。今天把bgp做了一下,配置比較簡單,但當中有一些細節還是值得看的,好了下面就來做一下bgp的實驗:

一、拓撲圖:

二、詳細配置及說明:

1、配置各路由器的IP位址,保證直連鍊路的直通性,確定有TCP的連接配接

2、在R1上的配置:

R1(config)#router bgp 64600 (啟用bgp)

R1(config-router)#nei 172.16.255.2 remote 64600 (指定bgp 對端鄰居,加AS号為了區分ibgp和ebgp)

R1(config-router)#net 172.16.255.0 mask 255.255.255.252(注入直連網絡,無類位址中帶掩碼釋出)

R1(config-router)#net 172.16.1.0 mask 255.255.255.0

R1(config-router)#net 172.16.2.0 mask 255.255.255.0

R1(config-router)#net 172.16.3.0 mask 255.255.255.0

3、在R2上的配置,由于R2有兩個直連的路由,是以要指定兩個鄰居:

R2(config-router)#nei 172.16.255.1 remote 64600

R2(config-router)#nei 10.1.255.2 remote 64800

R2(config-router)#net 172.16.255.0 mask 255.255.255.252(無類位址帶有掩碼釋出)

R2(config-router)#network 10.1.255.0 mask 255.255.255.252

4、在R3上的配置:

R3(config)#router bgp 64513

R3(config-router)#neighbor 10.1.255.1 remote-as 64800

R3(config-router)#network 10.1.255.0 mask 255.255.255.252

R3(config-router)#network 192.168.0.0  (有類位址,我沒有帶掩碼釋出)

R3(config-router)#network 192.168.1.0

R3(config-router)#network 192.168.2.0

R3(config-router)#network 192.168.3.0

5、在R2上檢視一下bgp的路由表:

R2#sh ip route bgp

     172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks

B       172.16.0.0/24 [200/0] via 172.16.255.1, 00:08:50

B       172.16.1.0/24 [200/0] via 172.16.255.1, 00:08:50

B       172.16.2.0/24 [200/0] via 172.16.255.1, 00:08:50

B       172.16.3.0/24 [200/0] via 172.16.255.1, 00:08:50

B    192.168.0.0/24 [20/0] via 10.1.255.2, 00:07:32

B    192.168.1.0/24 [20/0] via 10.1.255.2, 00:07:32

B    192.168.2.0/24 [20/0] via 10.1.255.2, 00:07:32

B    192.168.3.0/24 [20/0] via 10.1.255.2, 00:07:32

6、檢視一下簡單的bgp彙總資訊:

R2#sh ip bgp summary

BGP router identifier 172.16.255.2, local AS number 64600

BGP table version is 11, main routing table version 11

10 network entries using 1170 bytes of memory

12 path entries using 624 bytes of memory

4/3 BGP path/bestpath attribute entries using 496 bytes of memory

1 BGP AS-PATH entries using 24 bytes of memory

0 BGP route-map cache entries using 0 bytes of memory

0 BGP filter-list cache entries using 0 bytes of memory

BGP using 2314 total bytes of memory

BGP activity 10/0 prefixes, 12/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

10.1.255.2      4 64800      33      34       11    0    0 00:28:14        5

172.16.255.1    4 64600      34      35       11    0    0 00:29:31        5(通過鄰居學到的路由數量。)

7、在BGP中clear ip bgp * 會造成鄰居的down 然後再up的過程。但可以用clear ip bgp *soft 軟清除指令去涮新bgp路由表而不會重置鄰居關系,因為BGP建立鄰居是要基于TCP連接配接的,是以TCP連接配接不會重置。

R1#clear ip bgp *

R1#

*Mar  1 00:52:32.927: %BGP-5-ADJCHANGE: neighbor 172.16.255.2 Down User reset

*Mar  1 00:52:33.959: %BGP-5-ADJCHANGE: neighbor 172.16.255.2 Up     (鄰居關系重置了)

R1#clear ip bgp * soft

R1#                               (鄰居關系沒有重置)

8、檢視bgp的鄰居:

R1#show ip bgp neighbors

BGP neighbor is 172.16.255.2,  remote AS 64600, internal link(指出了bgp鄰居和AS号且是IBGP)

  BGP version 4, remote router ID 172.16.255.2

  BGP state = Established, up for 00:25:06  (鄰居關系的狀态已建立)

  Last read 00:00:06, last write 00:00:06, hold time is 180, keepalive interval is 60 seconds

  Neighbor capabilities:

    Route refresh: advertised and received(old & new)

    Address family IPv4 Unicast: advertised and received

  Message statistics:

    InQ depth is 0

    OutQ depth is 0

                         Sent       Rcvd

    Opens:                  2          2

    Notifications:          0          0

    Updates:                3          6

    Keepalives:            67         67

    Route Refresh:          1          0

    Total:                 73         75               (bgp幾種資料包發送和接收數量)

  Default minimum time between advertisement runs is 0 seconds

……………………

三、通過上面的配置,我們了解了bgp的基本配置以及如何去檢視一些bgp的路由特性。

本文轉自wxs-163 51CTO部落格,原文連結:http://blog.51cto.com/supercisco/264053

繼續閱讀