建立IBGP邻居

建立IBGP邻居_第1张图片
实验过程:
第一步  预配置
R1(config)#int s2/1
R1(config-if)#ip add 12.0.0 .1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#router ospf 1
R1(config-router)#net 0.0.0.0 0.0.0.0 area 0
R1(config-router)#end
R2(config)#int s2/1
R2(config-if)#ip add 12.0.0 .2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s2/2
R2(config-if)#ip add 23.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#router ospf 1
R2(config-router)#net 0.0.0.0 0.0.0.0 area 0
R2(config-router)#end
R3(config)#int s2/1
R3(config-if)#ip add 23.0.0 .3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#router ospf 1
R3(config-router)#net 0.0.0.0 0.0.0.0 area 0
R3(config-router)#end
 
第二步  检查预配置
R1#show ip route
Codes: C - connected, S - static, 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
       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
     1.0.0 .0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] vi a 12.0.0 .2, 00:00:49, Serial2/1
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/129] vi a 12.0.0 .2, 00:00:49, Serial2/1
     23.0.0.0/24 is subnetted, 1 subnets
O       23.0.0.0 [110/128] vi a 12.0.0 .2, 00:00:49, Serial2/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, Serial2/1
R2#show ip route
Codes: C - connected, S - static, 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
       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
     1.0.0 .0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/65] vi a 12.0.0 .1, 00:00:44, Serial2/1
     2.0.0.0/32 is subnetted, 1 subnets
C       2.2.2.2 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/65] vi a 23.0.0 .3, 00:00:44, Serial2/2
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, Serial2/2
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, Serial2/1
R3#show ip route
Codes: C - connected, S - static, 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
       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
     1.0.0 .0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/129] vi a 23.0.0 .2, 00:00:54, Serial2/1
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] vi a 23.0.0 .2, 00:00:54, Serial2/1
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, Serial2/1
     12.0.0.0/24 is subnetted, 1 subnets
O       12.0.0.0 [110/128] vi a 23.0.0 .2, 00:00:54, Serial2/1
R3#ping 1.1.1 .1 source lo0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1 .1, timeout is 2 seconds:
Packet sent with a source address of 3.3.3.3
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/45/68 ms
 
第三步  使用Loopback口建立R1R3IBGP邻居
R1#conf t
R1(config)#router bgp 64521
R1(config-router)#neighbor 3.3.3 .3 remote-as 64521
R1(config-router)#neighbor 3.3.3.3 update-source lo0
R1(config-router)#end
R3#conf t
R3(config)#router bgp 64521
R3(config-router)#neighbor 1.1.1 .1 remote-as 64521
R3(config-router)#neighbor 1.1.1.1 update-source lo0
R3(config-router)#end
// 
如果不指定update-source路由器只能使用到对等路由器最近的IP接口,使用任何时候都正常工作的回环接口提供了BGP的稳定性,即使到最近接口的链路失效了仍然可以维持BGP连接。另外,因为EBGP会话通常是点对点的,所以不需要在EBGP中使用该命令
 
第四步  观察R1R3的邻居建立情况
R1#show ip bgp summary
BGP router identifier 1.1.1 .1, local AS number 64521
BGP table version is 1, main routing table version 1
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
3.3.3 .3         4 64521       6       6        1    0    0 00:03:41        0
R3#show ip bgp summary
BGP router identifier 3.3.3 .3, local AS number 64521
BGP table version is 1, main routing table version 1
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1 .1         4 64521       7       7        1    0    0 00:04:09        0
R3#
R3#show ip bgp neighbors
BGP neighbor is 1.1.1.1,  remote AS 64521, internal link
  BGP version 4, remote router ID 1.1.1.1
  BGP state = Established, up for 00:04:43

// 
目前状态Established
BGP
邻居之间共有6种状态:1. Idle 查找路由表;2. Connect 找到路由表后进行TCP三次握手 ;3. Active 连接TCP握手失败;4. Open Sent 握手后发送Open Message5. Open Confirm 确认收到对方发来的Open消息;6. Established 会话建立,交换信息
  Last read 00:00:42, last write 00:00:42, 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:                  1          1
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             6          6
    Route Refresh:          0          0
    Total:                  7          7
  Default minimum time between advertisement runs is 0 seconds
 For address family: IPv4 Unicast
  BGP table version 1, neighbor version 1/0
 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 255
Local host: 3.3.3 .3, Local port: 179
//  BGP
使用基于TCP179端口
Foreign host: 1.1.1.1, Foreign port: 33992
Enqueued packets for retransmit: 0, input: 0  mis-ordered: 0 (0 bytes)
Event Timers (current time is 0x 1C 4A 98):
Timer          Starts    Wakeups            Next
Retrans             7          0             0x0
TimeWait            0          0             0x0
AckHold             7          6             0x0
SendWnd             0          0             0x0
KeepAlive           0          0             0x0
GiveUp              0          0             0x0
PmtuAger            0          0             0x0
DeadWait            0          0             0x0
iss:  936055164  snduna:  936055324  sndnxt:  936055324     sndwnd:  16225
irs: 1759342839  rcvnxt: 1759342999  rcvwnd:      16225  delrcvwnd:    159
SRTT: 182 ms, RTTO: 1073 ms, RTV: 891 ms, KRTT: 0 ms
minRTT: 56 ms, maxRTT: 300 ms, ACK hold: 200 ms
Flags: passive open, nagle, gen tcbs
IP Precedence value : 6
Datagrams (max data segment is 536 bytes):
Rcvd: 13 (out of order: 0), with data: 7, total data bytes: 159
Sent: 13 (retransmit: 0, fastretransmit: 0, partialack: 0, Second Congestion: 0), with data: 6, total data bytes: 159
 
第五步  IGP路由引入BGP
R1(config)#router bgp 64521
R1(config-router)#net 1.1.1 .1 mask 255.255.255.255
R1(config-router)#end
 
第六步  查看BGP
R1#show ip bgp
BGP table version is 2, local router ID is 1.1.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
*> 1.1.1 .1/32       0.0.0.0                  0         32768 i
R1#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
     1        
  Local
    0.0.0.0 from 0.0.0.0 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local, best
R3#show ip bgp
BGP table version is 3, local router ID is 3.3.3 .3
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
r>i 1.1.1 .1/32       1.1.1.1                  0    100      0 i
//  r-RIB-failure
放置路由表失败
R3#show ip bgp rib-failure
Network            Next Hop                      RIB-failure   RIB-NH Matches
1.1.1.1/32         1.1.1.1             Higher admin distance              n/a
// 
原因是IBGP的管理距离更高
 
第七步  查看路由表
R3#show ip route
Codes: C - connected, S - static, 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
       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
     1.0.0 .0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/129] vi a 23.0.0 .2, 00:25:56, Serial2/1
// 
可以看到这条路由用的是OSPF的并没有用BGP的,因为OSPF的管理距离为110,小于IBGP的管理距离200
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] vi a 23.0.0 .2, 00:25:56, Serial2/1
     3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.0.0.0 is directly connected, Serial2/1
     12.0.0.0/24 is subnetted, 1 subnets
O       12.0.0.0 [110/128] vi a 23.0.0 .2, 00:25:56, Serial2/1

你可能感兴趣的:(职场,休闲,邻居,IBGP)