BGP学习历程(实验+理论分析)

BGP

注意事项:
1.BGP配置之前,需要内网(OSPF,ISIS,RIP或者静态路由)相互通信,ping通
2.同个AS域是IBGP,不同的AS域之间的互联是EBGP
在这里插入图片描述拓扑描述:左中右分别是AS100,AS200,AS300;蓝色的区域是使用OSPF;

OSPF配置

前言:OSPF使用环回地址进行配置,防止出现单点故障。分别配置各个设备的环回地址,端口地址,OSPF的router-id与环回地址相同,均使用区域0,各端口之间使用192.168.X.X网段。
1.R2配置(分别使用精确宣告和网段宣告,精确宣告是宣告本端接口地址

ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 192.168.23.0 0.0.0.255        

2.R3配置

ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 192.168.23.0 0.0.0.255 
  network 192.168.34.3 0.0.0.0 

3.R4配置

ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 4.4.4.4 0.0.0.0 
  network 192.168.34.0 0.0.0.255 

4.结果
OSPF区域的各个设备建立邻居并且相互访问环回地址互通。

[R2]ping 3.3.3.3
  PING 3.3.3.3: 56  data bytes, press CTRL_C to break
    Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=10 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=10 ms
[R2]ping 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=254 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=30 ms
[R3]ping 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=255 time=20 ms
[R4]ping 2.2.2.2
  PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=254 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=254 time=20 ms

IBGP建立邻居配置

R2配置

[R2]bgp 200
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 3.3.3.3 as-number 200      //指定对端的环回口地址为建立TCP连接的目的地址,对端所在的AS域
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0     //指定建立TCP连接的源地址

R3配置

[R3]bgp 200
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 2.2.2.2 as-number 200
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]peer 4.4.4.4 as-number 200
[R3-bgp]peer 4.4.4.4 connect-interface LoopBack 0

R4配置

[R4]bgp 200
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 3.3.3.3 as-number 200
[R4-bgp]peer 3.3.3.3 connect-interface LoopBack 0

IBGP验证(Established 状态为IBGP邻居建立成功)

[R3]dis bgp peer
 BGP local router ID : 3.3.3.3
 Local AS number : 200
 Total number of peers : 2		  Peers in established state : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv
  2.2.2.2         4         200       37       37     0 00:35:41 Established    
   0
  4.4.4.4         4         200        4        6     0 00:02:58 Established    
   0

EBGP配置

EBGP直连配置
R1配置

[R1]bgp 100
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 192.168.12.2 as-number 200         //对端所在的AS域

R2配置

[R2]bgp 200
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 192.168.12.1 as-number 100

验证

[R1]dis bgp peer

 BGP local router ID : 1.1.1.1
 Local AS number : 100
 Total number of peers : 1		  Peers in established state : 1

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  192.168.12.2    4         200        2        2     0 00:00:25 Established    
   0

EBGP环回口配置(需写静态路由,默认的最大的TTL值为1,需修改)
R4配置

[R4]ip route-static 5.5.5.5 32 192.168.45.5
[R4]bgp 200
[R4-bgp]peer 5.5.5.5 as-number 300
[R4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R4-bgp]peer 5.5.5.5 ebgp-max-hop 2

R5配置

[R5]ip route-static 4.4.4.4 32 192.168.45.4
[R5]bgp 300
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 4.4.4.4 as-number 200
[R5-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[R5-bgp]peer 4.4.4.4 ebgp-max-hop 2

验证

[R4-bgp]dis bgp peer

 BGP local router ID : 4.4.4.4
 Local AS number : 200
 Total number of peers : 2		  Peers in established state : 2

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  3.3.3.3         4         200       71       71     0 01:09:58 Established    
   0
  5.5.5.5         4         300        2        4     0 00:00:12 Established    
   0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值