BGP-- IBGP--EBGP综合大实验

要求R1-R5环回均可通

1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

****1、IGP使2、3、4内部可达

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
r2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255

[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255R
4同理·

2、EBGP 1与2 间建立tcp会话

[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
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

3、IBGP IBGP邻居关系建立

由于IBGP邻居处于同一个AS,那么他们之间正常存在大量的备份路径,建议使用双方的环回接口来作为源、目IP地址建立邻居关系;
前提为
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
[r2] bgp 2
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 3.3.3.3 as-number 2
[r2-bgp]peer 3.3.3.3 connect-interface lo 0
[r3]bgp 2
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 2.2.2.2 as-number 2
[r3-bgp]peer 2.2.2.2 connect-interface lo 0 ----更新源
一旦使用环回接口作为目标接口,同时本地的更新源也需要修改为环回
3与4 之间
[r3-bgp]peer 4.4.4.4 as-number 2
[r3-bgp]peer 4.4.4.4 connect-interface lo 0
[r4]bgp 2
[r4-bgp]router-id 4.4.4.4[
r4-bgp]peer 3.3.3.3 as-number 2
[r4-bgp]peer 3.3.3.3 connect-interface lo 0- —更新源1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

4、R4与R5之间EBGP

EBGP邻居存在多条链路,为了稳定性和可靠性,依然建议使用环回接口来建立
首先静态使4、5有对方的环回
[r4]ip route-static 5.5.5.5 32 45.1.1.2
[r4]ip route-static 5.5.5.5 32 54.1.1.2
[r5]ip route-static 4.4.4.4 32 45.1.1.1
[r5]ip route-static 4.4.4.4 32 54.1.1.1
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
[r4]bgp 2
[r4-bgp]peer 5.5.5.5 as-number 3
[r4-bgp]peer 5.5.5.5 connect-interface lo 0
[r4-bgp]peer 5.5.5.5 ebgp-max-hop 2
BGP协议中,IBGP邻居关系间TTL值255,EBGP邻居为1; 故使用环回建立EBGP邻居时,必须修改TTL值;
[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 lo 0
[r5-bgp]peer 4.4.4.4 ebgp-max-hop 2
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
**

5建邻完毕后宣告路由条目–宣告后生成bgp表

**(包含本地收发的所有路由条目)
BGP需要逐条宣告本地路由表中的路由条目,无论这些条目的产生方式,只要在本地的路由表中及可宣告;宣告时,条目的内容必须和本地路由表中完全一致;
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def在这里插入图片描述
若条目标识为优,则该条目既可以传递也可以加表
R1---->R2
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
R2---->R3时 因为AS-BY-AS的规则,导致通过在一个as内部传递时,属性不变,导致选路不佳,条目不优;
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
因此:
[r2]bgp 2
[r2-bgp]peer 3.3.3.3 next-hop-local
[r3]bgp 2
[r3-bgp]peer 2.2.2.2 next-hop-local
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
R3通过IBGP学到,由于水平分割无法将该条目传递至R4,因此需R2与R4直接建邻进行传递。
[r2]bgp 2
[r2-bgp]peer 4.4.4.4 as-number 2
[r2-bgp]peer 4.4.4.4 connect-interface lo 0
[r4]bgp 2
[r4-bgp]router-id 4.4.4.4
r4-bgp]peer 2.2.2.2 as-number 2
[r4-bgp]peer 2.2.2.2 connect-interface lo 0
R2上改属性
[r2]bgp 2
[r2-bgp]peer 4.4.4.4 next-hop-local
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
zR4----->R5 在EBGP邻居关系间传递路由时,下一跳将自动被修改为本地
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

6、R5----->R1

[r5]bgp 3
[r5-bgp]network 5.5.5.0 24(需与r4与r5之间建邻所用环回区分开)
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
[r4]bgp 2
[r4-bgp]peer 3.3.3.3 next-hop-local
[r4-bgp]peer 2.2.2.2 next-hop-local
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

到此R1可ping R5,不可ping 2、3、4

1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

在R2\3\4分别写各自环回
[r2]bgp 2
[r2-bgp]network 2.2.2.0 24
R3、4同理
由此 R1-R5可互通
1、配ip及环回2、R1为isp,在r2上写一条缺省指向r1,且下放缺省ip route-static 0.0.0.0  0.0.0.0  192.168.1.1[R2]rip 1[R2-rip-1]def

发布了31 篇原创文章 · 获赞 19 · 访问量 1466

猜你喜欢

转载自blog.csdn.net/Alkaid__3/article/details/103949287