配置
R1:
interface FastEthernet0/0
ip address 13.0.0.1 255.0.0.0
!
interface Serial0/0
ip address 31.0.0.1 255.0.0.0
clockrate 64000
!
router bgp 1
neighbor 13.0.0.3 remote-as 1
R3:
interface F0/0
ip address 13.0.0.3 255.0.0.0
!
interface S0/0
ip address 31.0.0.3 255.0.0.0
!
router bgp 1
neighbor 31.0.0.1 remote-as 1
注意一下上面的配置,配置邻居是R1与R3采用的一个为以太网接口地址,另一个采用串口,此时会发生什么问题呢
R1#debug ip packet detail
IP packet debugging is on (detailed)
! R3 sends R1 a TCP SYN to start a BGP session
IP: s=31.0.0.3 (Serial0/0), d=31.0.0.1 (
Serial0/0 ), len 44, rcvd 3
TCP src=11009, dst=179, seq=3354450520, ack=0, win=16384 SYN
! R1 rejects the connection with ACK RST, it has no peering to 31.0.0.3
IP: tableid=0, s=31.0.0.1 (local), d=31.0.0.3 (
Serial0/0 ), routed via RIB
IP: s=31.0.0.1 (local), d=31.0.0.3 (
Serial0/0 ), len 40, sending
TCP src=179, dst=11009, seq=0, ack=3354450521, win=0 ACK RST
! R1 tries to start a BGP session with R3
BGP: 13.0.0.3 went from Idle to Active
BGP: 13.0.0.3 open active, delay 6880ms
BGP: 13.0.0.3 open active, local address 13.0.0.1
IP: tableid=0, s=13.0.0.1 (local), d=13.0.0.3 (FastEthernet0/0), routed via RIB
! R3 rejects the connection with ACK RST, it has no peering to 13.0.0.1
IP: tableid=0, s=13.0.0.3 (
FastEthernet0/0 ), d=13.0.0.1 (FastEthernet0/0), routed via RIB
IP: s=13.0.0.3 (
(FastEthernet0/0 ), d=13.0.0.1 (FastEthernet0/0), len 40, rcvd 3
TCP src=179, dst=11020, seq=0, ack=123733113, win=0 ACK RST
BGP: 13.0.0.3 open failed: Connection refused by remote host,
我们看到连接被拒绝,R3上同样也是这样,这里就不写了
我们看一下问什么?
【原因是】当建立BGP对等关系时,如果不指定up-date source ,BGP会使用出接口IP地址作为默认的update-source,当BGP对端收到一个BGP包时,它首先会检查bgp中的neighbor *.*.*.* remote-as *配置,查看对端是否已经被配置为邻居,如果收到的这个地址与自己配置的neighbor不同时,此时它将无法与对端建立联系,因此连接被拒绝。
针对以上情况,我们如何配置,才能够让R1与R3建立对等关系呢?
方法:使用 update-source 配置
R1:
router bgp 1
neighbor 13.0.0.3 update-source s0/0
配置好之后,依然通过debug来查看
R3#debug ip packet detail
IP packet debugging is on (detailed)
! R3 sends TCP SYN to 31.0.0.1 to initiate BGP session with
R1
BGP: 31.0.0.1 open active, local address 31.0.0.3
IP: tableid=0, s=31.0.0.3 (local), d=31.0.0.1 (Serial0/0),
routed via RIB
! R1 denies the connection and responds with ACK RST
! R1 expected the connection from 13.0.0.3
IP: tableid=0, s=31.0.0.1 (Serial0/0), d=31.0.0.3 (Serial0/0), routed via RIB
IP: s=31.0.0.1 (Serial0/0), d=31.0.0.3 (Serial0/0), len 40,rcvd 3
TCP src=179, dst=11073, seq=0, ack=2264277676, win=0 ACK RST
BGP: 31.0.0.1 open failed: Connection refused by remote host
! R1 sends TCP SYN to 13.0.0.3 to initiate BGP session with
R1
IP: s=31.0.0.1 (FasteEhernet0/0), d=13.0.0.3 (FasteEhernet0/0), len44, rcvd 3
TCP src=11084, dst=179, seq=2524207563, ack=0,win=16384 SYN
! Since it came from the address that R3 expected, R3 responds with SYN ACK
IP: tableid=0, s=13.0.0.3 (local), d=31.0.0.1 (Serial0/0),
routed via RIB
! R1 responds with ACK, BGP session is established
IP: tableid=0, s=31.0.0.1 (FasteEhernet0/0), d=13.0.0.3 (FasteEhernet0/0), routed via RIB
IP: s=31.0.0.1 (FasteEhernet0/0), d=13.0.0.3 (FasteEhernet0/0), len 40, rcvd 3
TCP src=11084, dst=179, seq=2524207564, ack=2501470793,win=16384 ACK
%BGP-5-ADJCHANGE: neighbor 31.0.0.1 Up
本文转自zcm8483 51CTO博客,原文链接:http://blog.51cto.com/haolun/992978