拓扑
建立BGP邻居关系
单链路的EBGP邻居关系
1 2 3 4 5 6 7 [R1]bgp 1 [R1-bgp]router-id 1.1 .1.1 [R1-bgp]peer 12.1 .1.2 as -number 2 [R2]bgp 2 [R2-bgp]router-id 2.2 .2.2 [R2-bgp]peer 12.1 .1.1 as -number 1
两端配置完成后,邻居间先进行TCP的三次握手,建立TCP会话
1 2 3 4 5 6 [R1]display tcp status TCPCB Tid/Soid Local Add:port Foreign Add:port VPNID State b4c2eb08 6 /1 0.0 .0.0 :23 0.0 .0.0 :0 23553 Listening b4c2eed4 164 /1 0.0 .0.0 :179 12.1 .1.2 :0 0 Listening b4c2f018 164 /8 12.1 .1.1 :179 12.1 .1.2 :50230 0 Established
当TCP会话建立后,邻居间收发一次Open 包(携带RID),建立邻居关系,生成 ==邻居表 ==
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [R1]display bgp peer BGP local router ID : 1.1 .1.1 Local AS number : 1 Total number of peers : 1 Peers in established state : 1 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv 12.1 .1.2 4 2 7 8 0 00 :05 :15 Established 0
建立IBGP邻居关系 — 由于一个AS的内部大多拓扑冗余比较丰富,若使用物理接口来作为源、目IP地址建立BGP邻居,将浪费冗余资源,建议使用环回接口作为源、目IP地址; 稳定,且可以同时使用多条链路资源
1 2 3 4 5 6 7 8 9 10 11 12 [R2]bgp 2 [R2-bgp]router-id 2.2 .2.2 [R2-bgp]peer 3.3 .3.3 as -number 2 --- [R3]bgp 2 [R3-bgp]router-id 3.3 .3.3 [R3-bgp]peer 2.2 .2.2 as -number 2 [R2-bgp]peer 3.3 .3.3 connect-interface LoopBack 0 --- [R3 -bgp ]peer 2.2.2.2 connect -interface LoopBack 0
多链路的EBGP邻居关系 建议使用环回作为源、目标接口 1、IP可达 — 一般使用静态
1 2 3 4 5 [R4]ip route-static 5.5 .5.0 24 45.1 .1.5 [R4]ip route-static 5.5 .5.0 24 54.1 .1.5 --- [R5]ip route-static 4.4 .4.0 24 45.1 .1.4 [R5]ip route-static 4.4 .4.0 24 54.1 .1.4
2、建立EBGP邻居关系
1 2 3 4 5 6 7 8 9 [R4]bgp 2 [R4-bgp]router-id 4.4 .4.4 [R4-bgp]peer 5.5 .5.5 as -number 3 [R4-bgp]peer 5.5 .5.5 connect-interface LoopBack 0 --- [R5 ]bgp 3 [R5 -bgp ]router -id 5.5.5.5 [R5 -bgp ]peer 4.4.4.4 as -number 2 [R5 -bgp ]peer 4.4.4.4 connect -interface LoopBack 0
3、TTL问题,默认IBGP邻居间的数据包TTL值为255,EBGP邻居间TTL值为1,因此若使用环回来建立EBGP邻居关系,TTL值不够
1 2 3 4 [R4-bgp]peer 5.5 .5.5 ebgp-max-hop 2 --- [R5-bgp]peer 4.4 .4.4 ebgp-max-hop 2
宣告路由 BGP协议所宣告路由为本地路由表中任何来源 产生的路由 宣告时可逐条选择本地路由表中的路由信息宣告
1 2 3 [R1]bgp 1 [R1-bgp]network 1.1 .1.0 24
当宣告配置完成后,本地生成 ==BGP表 == — 装载本地发出及接收到所有BGP路由
1 2 3 4 5 6 [R1]display bgp routing-table Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn *> 1.1 .1.0 /24 0.0 .0.0 0 0 i
条目优秀条件 :
同步问题 — 目前的设备同步规则默认关闭,该问题在当下已经不需要关注了 同步问题 — 本地必须先通告IGP徐熙到该路由,再通过BGP学习(不可行)
下一跳不可达问题 — 因为 AS-BY-AS规则,使得下一跳地址在一个AS内部传递时,默认不修改,故通过本地IBGP邻居学习到的路由,大多下一跳不可达
1 2 [R2]bgp 2 [R2-bgp]peer 3.3 .3.3 next-hop-local
逻辑悖论 :
过河是为了取河对面的木板修船; 修船是为了过河!
1 2 3 4 <R4>dis bgp routing-table Total Number of Routes: 1 Network NextHop MED LocPrf PrefVal Path/Ogn 5.5 .5.0 /24 5.5 .5.5 0 0 3 i
R5 给 R4 的 5.5.5.0/24
网段不优,正是因为此逻辑悖论 结局方法:将R4-5建邻时的静态写到 5.5.5.5/32
即可
路由表展示: 连通性测试: