一、拓撲圖
二、BGP基本配置:
1、配置兩台路由器的IP位址,保證直連鍊路的連通性。
2、配置兩台路由器的BGP協定:
R1(config-if)#router bgp 64512
R1(config-router)#net 10.1.255.0 mask 255.255.255.252
R1(config-router)#net 172.16.1.0 mask 255.255.255.0
R1(config-router)#nei 10.1.255.2 remote 64513
R2(config)#router bgp 64513
R2(config-router)#net 10.1.255.0 mask 255.255.255.252
R2(config-router)#net 192.168.1.0 mask 255.255.255.0
R2(config-router)#nei 10.1.255.1 remote 64512
3、檢視一下R1和R2的BGP路由表,能學到對方的BGP路由:
R1#sh ip route bgp
B 192.168.1.0/24 [20/0] via 10.1.255.2, 00:09:20
R2#sh ip route bgp
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 10.1.255.1, 00:10:17
三、配置BGP的鄰居認證:
1、先在R1上做上鄰居認證,并設定密碼為supercisco:
R1(config)#router bgp 64512
R1(config-router)#nei 10.1.255.2 password supercisco
2、發現一配置上去就有反映了:
*Mar 1 00:40:15.767: %TCP-6-BADAUTH: No MD5 digest from 10.1.255.2(59707) to 10.1.255.1(179)
*Mar 1 00:40:16.287: %TCP-6-BADAUTH: No MD5 digest from 10.1.255.2(59707) to 10.1.255.1(179)
3、檢視一下簡單BGP彙總:
R1#sh ip bgp summary
………………
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.255.2 4 64513 42 46 0 0 0 00:00:43 Active
4、檢視一下BGP路由表,發現沒有172.16.1.0/24的路由:
R2#sh ip route
10.0.0.0/30 is subnetted, 1 subnets
C 10.1.255.0 is directly connected, Serial1/0
C 192.168.1.0/24 is directly connected, Loopback0 (沒有學到R1的BGP路由)
R2#sh ip bgp
BGP table version is 7, local router ID is 192.168.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.255.0/30 0.0.0.0 0 32768 i
*> 192.168.1.0 0.0.0.0 0 32768 i(沒有R1 loopback BGP路由存在)
5、再到R2去配上鄰居認證:
R2(config-router)#nei 10.1.255.1 password supercisco
四、驗證鄰居認證:
1、一配置上去,發現鄰居馬上就起來了:
R2(config-router)#
*Mar 1 00:53:36.203: %BGP-5-ADJCHANGE: neighbor 10.1.255.1 Up
2、到R2上看一下BGP 簡單彙總和BGP路由:
R2#sh ip bgp summary
……………………
10.1.255.1 4 64512 58 57 8 0 0 00:07:09 2 (通過鄰居學到了兩條)
BGP table version is 9, local router ID is 192.168.1.1
*> 10.1.255.0/30 0.0.0.0 0 32768 i
*> 192.168.1.0 0.0.0.0 0 32768 i
3、看一下的路由表,兩邊都有了:
R1#sh ip route
C 172.16.1.0 is directly connected, Loopback0
C 10.1.255.0 is directly connected, Serial1/1
B 192.168.1.0/24 [20/0] via 10.1.255.2, 00:01:41
B 172.16.1.0 [20/0] via 10.1.255.1, 00:01:54
C 192.168.1.0/24 is directly connected, Loopback0
本文轉自wxs-163 51CTO部落格,原文連結:http://blog.51cto.com/supercisco/269372