思科BGP技術詳解二

來源:本站原創 網絡技術詳解 超過1,672 views圍觀 0條評論

clip_image002

五、配置:

只要TCP可達,鄰居關系就可以建立。BGP是通過TCP建立的。要建立BGP鄰居,必須保證TCP可達,必須路由是可達的。

先建立鄰居:

R1#router bgp 100 (一個路由器上只能配置一個AS,否則會提示是:BGP is already running AS is 100 )

Neighbor 12.1.1.2 remote-as 200 指定鄰居關系,指定遠端的AS號(也就是對端的AS號)

注:在bgp路由器上也有router ID ,選舉規則是和OSPF一樣的,也可以手動指router ID

Router bgp 100

Bgp router-id 1.1.1.1

R2#router bgp 200

Neighbor 12.1.1.1 remote-as 100

Bgp router-id 2.2.2.2.

R1上配置完后提示:neighbor 12.1.1.2 up

R1#show ip bgp neighbors

BGP neighbor is 12.1.1.2, remote AS 200, external link外部鏈路(即是EBGP

R1的鄰居的12.1.1.2,遠端的AS200

BGP version 4, remote router ID 2.2.2.2

本是,2000年集本升級。遠端的ROUTER ID

BGP state = Established, up for 00:00:17

BGP狀態:看到Established時,表示和鄰居關系已經建立。

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

Keepalive保持TCP的連接,保活消息:時間周期60s

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: 1 1

Notifications: 0 0

Updates: 0 0

Keepalives: 1 1

Route Refresh: 0 0

Total: 2 2

Default minimum time between advertisement runs is 30 seconds

For address family: IPv4 Unicast

BGP table version 1, neighbor version 0/0

BGP table version 1BGp表默認1,每變化一次增加1.如果BGP建立的時間非常短,Version非常高,說明網絡變化非常頻繁,不穩定。可以進R2router bgp 200下,neighbor 12.1.1.1 shut,然后再打開,這樣經過幾次來試驗,再看此號,變化了。

Output queue size: 0

Index 1, Offset 0, Mask 0x2

1 update-group member

Sent Rcvd

Prefix activity: —- —-

Prefixes Current: 0 0

Prefixes Total: 0 0

Implicit Withdraw: 0 0

Explicit Withdraw: 0 0

Used as bestpath: n/a 0

Used as multipath: n/a 0

Outbound Inbound

Local Policy Denied Prefixes: ——– ——-

Total: 0 0

Number of NLRIs in the update sent: max 0, min 0

Connections established 1; dropped 0

Last reset never

Connection state is ESTAB, I/O status: 1, unread input bytes: 0

Connection is ECN Disabled, Mininum incoming TTL 0, Outgoing TTL 1

Local host: 12.1.1.1, Local port: 43320

Foreign host: 12.1.1.2, Foreign port: 179

Connection tableid (VRF): 0

Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes)

Event Timers (current time is 0x128AAC):

Timer Starts Wakeups Next

Retrans 3 0 0x0

TimeWait 0 0 0x0

AckHold 1 0 0x0

SendWnd 0 0 0x0

KeepAlive 0 0 0x0

GiveUp 0 0 0x0

PmtuAger 0 0 0x0

DeadWait 0 0 0x0

Linger 0 0 0x0

ProcessQ 0 0 0x0

iss: 1734781539 snduna: 1734781604 sndnxt: 1734781604 sndwnd: 16320

irs: 3945826168 rcvnxt: 3945826233 rcvwnd: 16320 delrcvwnd: 64

SRTT: 99 ms, RTTO: 1539 ms, RTV: 1440 ms, KRTT: 0 ms

minRTT: 76 ms, maxRTT: 300 ms, ACK hold: 200 ms

Status Flags: active open

Option Flags: nagle

IP Precedence value : 6

Datagrams (max data segment is 1460 bytes):

Rcvd: 4 (out of order: 0), with data: 2, total data bytes: 64

Sent: 4 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 2, total data bytes: 64

Packets received in fast path: 0, fast processed: 0, slow path: 0

Packets send in fast path: 0

fast lock acquisition failures: 0, slow path: 0

R1#show ip bgp summary 查看鄰居的匯總信息

BGP router identifier 1.1.1.1, local AS number 100

本地Router id 1.1.1.1 本地的AS 是 100

BGP table version is 1, main routing table version 1

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

12.1.1.2 4 200 18 18 1 0 0 00:15:59 0 如果是數字,表示鄰居已建立

在每臺路由器上各啟一個loop 0

R1#int loop 0

Ip addr 1.1.1.1 255.255.255.0

Router bgp 100

Network 1.1.1.0 mask 255.255.255.0 僅僅將網絡加入到BGP

R2#int loop 0

Ip addr 2.2.2.2 255.255.255.0

Router bgp 200

Network 1.1.1.0 mask 255.255.255.0

R1# show ip router 應該出現:

B 2.2.2.0 [20/0] via 12.1.1.2, 00:00:24

12.0.0.0/24 is subnetted, 1 subnets 收到一條B路由。是通過“ B- BGP”學到的。

R3:啟一個loop 0 啟AS 300

Int loop 0

Ip address 3.3.3.3. 255.255.255.0

Router bgp 300

Neighbot 23.1.1.1 romote-as 200

Bgp router-id 3.3.3.3

Network 3.3.3.0 mask 255.255.255.0

R3#Show ip bgp nei

只要:State/pfxrcd 是個數字,是鄰居建立了。

R1#show ip route

學到了兩條B路由:

1.0.0.0/24 is subnetted, 1 subnets

C 1.1.1.0 is directly connected, Loopback0

2.0.0.0/24 is subnetted, 1 subnets

B 2.2.2.0 [20/0] via 12.1.1.2, 00:24:38

是通過EBGP學來的距離是20,IBGP是200.

3.0.0.0/24 is subnetted, 1 subnets

B 3.3.3.0 [20/0] via 12.1.1.2, 00:00:08

12.0.0.0/24 is subnetted, 1 subnets

C 12.1.1.0 is directly connected, FastEthernet0/0

六、此試驗全部的配置總結:

R1#int loop 0 Ip addr 1.1.1.1 255.255.255.0

Int f0/0 Ip addr 12.1.1.1 255.255.255.0

No shut

router bgp 100 注:一個路由器上只能配置一個AS號。

Network 1.1.1.0 mask 255.255.255.0

Bgp router-id 1.1.1.1

Nei 12.1.1.1 remote-as 200

R2#int loop 0 Ip addr 2.2.2.2 255.255.255.0

Int f0/0 Ip addr 12.1.1.2 255.255.255.0

Int f0/1 Ip addr 23.1.1.1 255.255.255.0

No shut

Router bgp 200

Neighbor 12.1.1.1 remote-as 100

Neighbor 23.1.1.2 remoe-as 300

Bgp router-id 2.2.2.2.

R3:Int loop 0 Ip address 3.3.3.3. 255.255.255.0

Router bgp 300

Neighbot 23.1.1.1 romote-as 200

Bgp router-id 3.3.3.3

Network 3.3.3.0 mask 255.255.255.0

注:R1R2R3只是用neibghor建立了鄰居關系,并沒把所連接的端口的地址加入到bgp域中,通過在R1show ip route ,看出R1能學到2.03.0的網絡,說明了:1.0到達3.0是通過neighbor建立的鄰居關系,再通過bgp的承載到達的。

如果把R2FO/0接口shutdown,R1上查看bgp表:show ip bgp sum顯示:狀態是Active.

R1#show ip bgp summ

BGP router identifier 1.1.1.1, local AS number 100

BGP table version is 1, main routing table version 1

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

12.1.1.2 4 200 26 26 0 0 0 00:00:07 Active

文章出自:CCIE那點事 http://www.qdxgqk.live/ 版權所有。本站文章除注明出處外,皆為作者原創文章,可自由引用,但請注明來源。 禁止全文轉載。
本文鏈接:http://www.qdxgqk.live/?p=3031轉載請注明轉自CCIE那點事
如果喜歡:點此訂閱本站
?
?
萌宠夺宝游戏