ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

BGP

2020-07-30 09:00:56  阅读:218  来源: 互联网

标签:bgp R1 R2 0.0 GigabitEthernet0 BGP 1.1


自治系统-AS

·同一个技术管理机构管理

·统一选路策略

·路由器的集合

 

AS号相同的是自治系统内;AS号不同的是自治系统间

动态路由分类:IGP、EGP

 

BGP特性:

·传输协议:TCP,端口号179

·BGP是外部路由协议,用来在AS之间传递路由信息

·是一种增强的路径矢量路由协议

·拥有可靠的路由更新机制

·具备丰富的Metric度量方法

·无环路协议设计

·为路由条目附带多种属性信息

·支持CIDR(无类别域间选路)

·丰富的路由过滤和路由策略

·无需周期性更新

·路由更新时只发送增量路由

·周期性发送KeepAlive报文以保持TCP连通性

 

BGP报文:

·Open报文

·Update报文

·Notification报文

·Route-refresh

·KeepAlive

 

BGP状态机                                                  

·Idle状态

·Active状态

·OpenConfirm状态

·Established状态

 

 

 

BGP数据库:

·IP路由表(IP-RIB)

·BGP路由表(Loc-RIB)

 

 

 

 Display bgp routing-table命令查看BGP路由表

 

通告BGP路由的方法:

·Network方式

·Import方式

BGP的邻居关系类型:

·直连网段建立邻居

·环回口建立邻居

 

直连建邻居时需要注意的点:

建立IBGP邻居时要保证下一跳可达,处于边界的IBGP邻居需要将下一跳指向自己,这样才能建立IBGP邻居

用环回口建邻居时需要注意的点:

需要修改更新源,默认更新源是物理口,你需要修改成自己环回口

建立IBGP邻居时要保证下一跳可达,处于边界的IBGP邻居需要将下一跳指向自己,这样才能建立IBGP

建立EBGP邻居时因为EBGP路由只传一跳,因而,在建EBGP邻居时,需要修改EBGP多跳的跳数为2以上(自己环回到对端环口是2跳,默认只传一跳)

关于为什么要用环回口建邻居?

原因是环回口稳定,只要路由器启动着,环回口就不Down,而物理链路可能会受线路或者是接口等因素的影响导致邻居关系有问题,因而一般BGP建立邻居都是用环回口来建

 

例题1:

 

 

AR1:

      <Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R1

[R1]user-interface console 0

[R1-ui-console0]idle-timeout 0 0

[R1-ui-console0]quit

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24

[R1-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R1-GigabitEthernet0/0/0]int loop0

[R1-LoopBack0]ip add 1.1.1.1 32

[R1-LoopBack0]quit

[R1]ospf

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0

[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255

[R1-ospf-1-area-0.0.0.0]quit

[R1-ospf-1]quit

[R1]bgp 100

[R1-bgp]router-id 1.1.1.1

[R1-bgp]peer 12.1.1.2 as-number 100

[R1-bgp]bgp 100

[R1-bgp]network 1.1.1.1 32

[R1-bgp]network 12.1.1.0 24

[R1-bgp]display bgp routing-table

 *>   1.1.1.1/32         0.0.0.0         0                     0      i

 *>i  3.3.3.3/32         23.1.1.3        0          100        0      200i

 *>   12.1.1.0/24        0.0.0.0         0                     0      i

   i                     12.1.1.2        0          100        0      i

 *>i  23.1.1.0/24        12.1.1.2        0          100        0      i

 

AR2:

<Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R2

[R2]user-interface console 0

[R2-ui-console0]idle-timeout 0 0

[R2-ui-console0]quit

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24

[R2-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R2-GigabitEthernet0/0/0]int g0/0/1

[R2-GigabitEthernet0/0/1]ip add 23.1.1.2 24

[R2-GigabitEthernet0/0/1]undo shut

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R2-GigabitEthernet0/0/1]int loop 0

[R2-LoopBack0]ip add 2.2.2.2 32

[R2-LoopBack0]quit

[R2]ospf 1

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255

[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]quit

[R2-ospf-1]bgp 100

[R2-bgp]router-id 2.2.2.2

[R2-bgp]peer 12.1.1.1 as-number 100

[R2-bgp]peer 23.1.1.3 as-number 200

[R2-bgp]quit

[R2]bgp 100

[R2-bgp]network 12.1.1.0 24

[R2-bgp]network 23.1.1.0 24

[R2-bgp]display bgp routing-table

 *>i  1.1.1.1/32         12.1.1.1        0          100        0      i

 *>   3.3.3.3/32         23.1.1.3        0                     0      200i

 *>   12.1.1.0/24        0.0.0.0         0                     0      i

       i                     12.1.1.1        0          100        0      i

 *>   23.1.1.0/24        0.0.0.0         0                     0      i

                             23.1.1.3        0                     0      200i

 

AR3:

<Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R3

[R3]user-interface console 0

[R3-ui-console0]idle-timeout 0 0

[R3-ui-console0]quit

[R3]int g0/0/0

[R3-GigabitEthernet0/0/0]ip add 23.1.1.3 24

[R3-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R3-GigabitEthernet0/0/0]int loop 0

[R3-LoopBack0]ip add 3.3.3.3 32

[R3-LoopBack0]quit

[R3]bgp 200

[R3-bgp]router-id 3.3.3.3

[R3-bgp]peer 23.1.1.2 as-number 100

[R3-bgp]bgp 200

[R3-bgp]network 23.1.1.0 24

[R3-bgp]network 3.3.3.3 32

[R3-bgp]dis

[R3-bgp]display bgp rout

[R3-bgp]display bgp routing-table

*>   1.1.1.1/32         23.1.1.2                              0      100i

*>   3.3.3.3/32         0.0.0.0         0                     0      i

*>   12.1.1.0/24        23.1.1.2        0                     0      100i

*>   23.1.1.0/24        0.0.0.0         0                     0      i

                       23.1.1.2        0                     0      100i

 

例题2:

 

 

AR1: <Huawei>undo terminal mon

<Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R1

[R1]user-interface console 0

[R1-ui-console0]idle-timeout 0 0

[R1-ui-console0]quit

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip add 14.1.1.1 24

[R1-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R1-GigabitEthernet0/0/0]int g0/0/1

[R1-GigabitEthernet0/0/1]ip add 45.1.1.1 24

[R1-GigabitEthernet0/0/1]undo shut

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R1-GigabitEthernet0/0/1]int loop 0

[R1-LoopBack0]quit

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]undo ip add 45.1.1.1 24

[R1-GigabitEthernet0/0/1]ip add 12.1.1.1 24

[R1-GigabitEthernet0/0/1]undo shut

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R1-GigabitEthernet0/0/1]int loop 0

[R1-LoopBack0]ip add 1.1.1.1 32

[R1-LoopBack0]quit

[R1]ospf 1 router-id 1.1.1.1

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0

[R1-ospf-1-area-0.0.0.0]network 14.1.1.0 0.0.0.255

[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255

[R1-ospf-1-area-0.0.0.0]quit

[R1]bgp 100

[R1-bgp]router-id 1.1.1.1

[R1-bgp]peer 4.4.4.4 as-number 100

[R1-bgp]peer 4.4.4.4 connect-interface loop 0

[R1-bgp]peer 2.2.2.2 as-number 100

[R1-bgp]peer 2.2.2.2 connect-interface loop 0

[R1-bgp]bgp 100

[R1-bgp]network 1.1.1.1 32

[R1-bgp]network 14.1.1.0 24

[R1-bgp]network 12.1.1.0 24

 

 

AR2:

<Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R2

[R2]user-interface console 0

[R2-ui-console0]idle-timeout 0 0

[R2-ui-console0]quit

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24

[R2-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R2-GigabitEthernet0/0/0]int g0/0/1

[R2-GigabitEthernet0/0/1]ip add 23.1.1.2 24

[R2-GigabitEthernet0/0/1]undo shut

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R2-GigabitEthernet0/0/1]int loop 0

[R2-LoopBack0]ip add 2.2.2.2 32

[R2-LoopBack0]quit

[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 12.1.1.0 0.0.0.255

[R2-ospf-1-area-0.0.0.0]quit

[R2-ospf-1]bgp 100

[R2-bgp]router-id 2.2.2.2

[R2-bgp]peer 4.4.4.4 as-number 100

[R2-bgp]peer 4.4.4.4 connect-interface loop 0

[R2-bgp]peer 4.4.4.4 next-hop-local

[R2-bgp]peer 1.1.1.1 as-number 100

[R2-bgp]peer 1.1.1.1 connect-interface loop 0

[R2-bgp]peer 1.1.1.1 next-hop-local

[R2-bgp]peer 3.3.3.3 as-number 200

[R2-bgp]peer 3.3.3.3 connect-interface loop 0

[R2-bgp]peer 3.3.3.3 ebgp-max-hop 255

[R2-bgp]quit

[R2]ip route-static 3.3.3.3 32 23.1.1.3

[R2]bgp 100

[R2-bgp]network 2.2.2.2 32

[R2-bgp]network 12.1.1.0 24

[R2-bgp]network 23.1.1.0 24

[R2-bgp]network 1.1.1.1 32

[R2-bgp]network 4.4.4.4 32

[R2-bgp]network 3.3.3.3 32

 

AR3: <Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R3

[R3]user-interface console 0

[R3-ui-console0]idle-timeout 0 0

[R3-ui-console0]quit

[R3]int g0/0/0

[R3-GigabitEthernet0/0/0]ip add 23.1.1.3 24

[R3-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R3-GigabitEthernet0/0/0]int loop 0

[R3-LoopBack0]ip add 3.3.3.3 32

[R3-LoopBack0]quit

[R3]ip route-static 2.2.2.2 32 23.1.1.2

[R3]quit

[R3]bgp 200

[R3-bgp]router-id 3.3.3.3

[R3-bgp]peer 2.2.2.2 as-number 100

[R3-bgp]peer 2.2.2.2 con

[R3-bgp]peer 2.2.2.2 connect-interface loop 0

[R3-bgp]peer 2.2.2.2 e

[R3-bgp]peer 2.2.2.2 ebgp-max-hop 255

[R3-bgp]quit

[R3]bgp 200

[R3-bgp]network 3.3.3.3 32

[R3-bgp]network 23.1.1.0 24

 

AR4: <Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R4

[R4]user-interface console 0

[R4-ui-console0]idle-timeout 0 0

[R4-ui-console0]quit

[R4]int g0/0/0

[R4-GigabitEthernet0/0/0]ip add 14.1.1.4 24

[R4-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R4-GigabitEthernet0/0/0]int g0/0/1

[R4-GigabitEthernet0/0/1]ip add 45.1.1.4 24

[R4-GigabitEthernet0/0/1]undo shut

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[R4-GigabitEthernet0/0/1]int loop 0

[R4-LoopBack0]ip add 4.4.4.4 32

[R4-LoopBack0]quit

[R4]ospf 1 router-id 4.4.4.4

[R4-ospf-1]area 0

[R4-ospf-1-area-0.0.0.0]network 14.1.1.0 0.0.0.255

[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0

[R4-ospf-1-area-0.0.0.0]quit

[R4]ip route-static 5.5.5.5 32 45.1.1.5

[R4]quit

[R4]bgp 100

[R4-bgp]router-id 4.4.4.4

[R4-bgp]peer 5.5.5.5 as-number 300

[R4-bgp]peer 5.5.5.5 connect-interface loop 0

[R4-bgp]peer 5.5.5.5 ebgp-max-hop 255

[R4-bgp]peer 1.1.1.1 as-number 100

[R4-bgp]peer 1.1.1.1 connect-interface loop 0

[R4-bgp]peer 1.1.1.1 next-hop-local

[R4-bgp]peer 2.2.2.2 as-number 100

[R4-bgp]peer 2.2.2.2 connect-interface loop 0

[R4-bgp]peer 2.2.2.2 next-hop-local

[R4-bgp]bgp 100

[R4-bgp]network 45.1.1.0 24

[R4-bgp]network 5.5.5.5 32

[R4-bgp]network 14.1.1.0 24

[R4-bgp]network 4.4.4.4 32

[R4-bgp]network 2.2.2.2 32

 

 

AR5: <Huawei>undo terminal monitor

Info: Current terminal monitor is off.

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R5

[R5]user-interface console 0

[R5-ui-console0]idle-timeout 0 0

[R5-ui-console0]quit

[R5]int g0/0/0

[R5-GigabitEthernet0/0/0]ip add 45.1.1.5 24

[R5-GigabitEthernet0/0/0]undo shut

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R5-GigabitEthernet0/0/0]int loop 0

[R5-LoopBack0]ip add 5.5.5.5 32

[R5-LoopBack0]quit

[R5]bgp 300

[R5-bgp]router-id 5.5.5.5

[R5-bgp]peer 4.4.4.4 as-number 100

[R5-bgp]peer 4.4.4.4 connect-interface loop 0

[R5-bgp]peer 4.4.4.4 ebgp-max-hop 255

[R5-bgp]quit

[R5]ip route-static 4.4.4.4 32 45.1.1.4

[R5]bgp 300

[R5-bgp]network 5.5.5.5 32

[R5-bgp]network 45.1.1.0 24

[R5-bgp]quit

 

标签:bgp,R1,R2,0.0,GigabitEthernet0,BGP,1.1
来源: https://www.cnblogs.com/Xing88/p/13401806.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有