BGP学习过程-2

R1R2同属于AS1

(链路状态配置同学习过程-1

 

r1#show run

Building configuration...

!        

router bgp 1

 bgp log-neighbor-changes

 network 1.1.1.0 mask 255.255.255.0

 network 192.168.12.0

 neighbor 192.168.12.2 remote-as 1

!        

 

 

r2#show run

Building configuration...

!        

router bgp 1

 bgp log-neighbor-changes

 network 1.1.1.0 mask 255.255.255.0

 network 192.168.12.0

 neighbor 192.168.12.1 remote-as 1

!        

 

 

r1#debug ip bgp

BGP debugging is on

r1#clear ip bgp *

r1#

01:16:13: BGP: 192.168.12.2 went from Established to Idle

01:16:13: %BGP-5-ADJCHANGE: neighbor 192.168.12.2 Down User reset

r1#

01:16:13: BGP: 192.168.12.2 closing

r1#

01:16:33: BGP: 192.168.12.2 went from Idle to Active

01:16:33: BGP: 192.168.12.2 open active, delay 9716ms

r1#

01:16:43: BGP: 192.168.12.2 open active, local address 192.168.12.1

01:16:43: BGP: 192.168.12.2 went from Active to OpenSent

01:16:43: BGP: 192.168.12.2 sending OPEN, version 4, my as: 1

01:16:43: BGP: 192.168.12.2 send message type 1, length (incl. header) 45

01:16:43: BGP: 192.168.12.2 rcv message type 1, length (excl. header) 26

01:16:43: BGP: 192.168.12.2 rcv OPEN, version 4

01:16:43: BGP: 192.168.12.2 rcv OPEN w/ OPTION parameter len: 16

01:16:43: BGP: 192.168.12.2 rcvd OPEN w/ optional parameter type 2 (Capability) len 6

01:16:43: BGP: 192.168.12.2 OPEN has CAPABILITY code: 1, length 4

01:16:43: BGP: 192.168.12.2 OPEN has MP_EXT CAP for afi/safi: 1/1

01:16:43: BGP: 192.168.12.2 rcvd OPEN w/ optional parameter type 2 (Capability) len 2

01:16:43: BGP: 192.168.12.2 OPEN has CAPABILITY code: 128, length 0

01:16:43: BGP: 192.168.12.2 OPEN has ROUTE-REFRESH capability(old) for all address-families

01:16:43: BGP: 192.168.12.2 rcvd OPEN w/ optional parameter type 2 (Capab

r1#ility) len 2

01:16:43: BGP: 192.168.12.2 OPEN has CAPABILITY code: 2, length 0

01:16:43: BGP: 192.168.12.2 OPEN has ROUTE-REFRESH capability(new) for all address-families

01:16:43: BGP: 192.168.12.2 went from OpenSent to OpenConfirm

01:16:43: BGP: 192.168.12.2 went from OpenConfirm to Established

01:16:43: %BGP-5-ADJCHANGE: neighbor 192.168.12.2 Up

r1#

01:16:52: BGP: Applying map to find origin for 1.1.1.0/24

01:16:52: BGP: Applying map to find origin for 192.168.12.0/24

r1#

01:17:52: BGP: Applying map to find origin for 1.1.1.0/24

01:17:52: BGP: Applying map to find origin for 192.168.12.0/24

r1#un all

All possible debugging has been turned off

r1#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

       ia - IS-IS inter area, * - candidate default, U - per-user static route

       o - ODR, P - periodic downloaded static route

 

Gateway of last resort is not set

 

C    192.168.12.0/24 is directly connected, Serial1/1

     1.0.0.0/24 is subnetted, 1 subnets

C       1.1.1.0 is directly connected, Loopback0

r1#show ip bgp nei

r1#show ip bgp neighbors

BGP neighbor is 192.168.12.2,  remote AS 1, internal link

  BGP version 4, remote router ID 2.2.2.2

  BGP state = Established, up for 00:01:31

  Last read 00:00:31, 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:                  3          3

    Notifications:          0          0

    Updates:                3          3

    Keepalives:            10         10

    Route Refresh:          0          0

    Total:                 16         16

  Default minimum time between advertisement runs is 5 seconds

 

 For address family: IPv4 Unicast

  BGP table version 4, neighbor version 4

  Index 1, Offset 0, Mask 0x2

                                 Sent       Rcvd

  Prefix activity:               ----       ----

    Prefixes Current:               2          1 (Consumes 36 bytes)

    Prefixes Total:                 2          1

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

    Bestpath from this peer:              1        n/a

    Total:                                1          0

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

         

  Connections established 3; dropped 2

  Last reset 00:02:04, due to User reset

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

Local host: 192.168.12.1, Local port: 11003

Foreign host: 192.168.12.2, Foreign port: 179

         

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

         

Event Timers (current time is 0x47B04C):

Timer          Starts    Wakeups            Next

Retrans             7          0             0x0

TimeWait            0          0             0x0

AckHold             4          1             0x0

SendWnd             0          0             0x0

KeepAlive           0          0             0x0

GiveUp              0          0             0x0

PmtuAger            0          0             0x0

DeadWait            0          0             0x0

         

iss: 2578666033  snduna: 2578666214  sndnxt: 2578666214     sndwnd:  16204

irs: 3419201701  rcvnxt: 3419201878  rcvwnd:      16208  delrcvwnd:    176

         

SRTT: 182 ms, RTTO: 1073 ms, RTV: 891 ms, KRTT: 0 ms

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

Flags: higher precedence, nagle

         

Datagrams (max data segment is 1460 bytes):

Rcvd: 9 (out of order: 0), with data: 4, total data bytes: 176

Sent: 9 (retransmit: 0, fastretransmit: 0), with data: 6, total data bytes: 180

r1#

r1#show ip bgp

BGP table version is 4, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.0/24       0.0.0.0                  0         32768 i

*> 192.168.12.0     0.0.0.0                  0         32768 i

* i                 192.168.12.2             0    100      0 i

r1#show ip bgp su

r1#show ip bgp summary

BGP router identifier 1.1.1.1, local AS number 1

BGP table version is 4, main routing table version 4

2 network entries using 194 bytes of memory

3 path entries using 108 bytes of memory

2 BGP path attribute entries using 120 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 422 total bytes of memory

BGP activity 4/2 prefixes, 7/4 paths, scan interval 60 secs

 

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

192.168.12.2    4     1      17      17        4    0    0 00:02:02        1

 

 

得出结论:无论是AS间还是同一AS内部,邻居关系都能建立起来,但BGP是自治系统间的路由协议,不适用于同一自治系统内部。