H3C BGP属性实验
- 格式:doc
- 大小:301.50 KB
- 文档页数:7
实验十、BGP实验实验要求:1、掌握BGP的基本配置方法。
2、掌握如何查看BGP的各种配置信息。
3、掌握基于回环口的BGP的邻居关系建立的配置方法。
4、理解需要使用回环口为目的。
5、理解BGP同步功能的作用和配置。
6、掌握使用指向NULL0接口的静态路由的汇总配置方法。
7、掌握使用聚合属性的路由汇总配置方法。
实验拓扑:根据实验要求,实验拓扑如图10-1所示。
图10-1 BGP实验拓扑注:R1和R2属于自治系统65001,R3属于自治系统65002实验步骤:1、根据实验拓扑,对路由器各接口配置IP地址,使直连链路相互间可以进行通信。
2、在R1和R2上配置EIGRP,关闭自动汇总。
参考命令如下:R1(config)#router eigrp 50 50修改为自己学号后两位R1(config-router)#network 192.168.1.0R1(config-router)#network 1.0.0.0R1(config-router)#no auto-summaryR2(config)#router eigrp 50 50修改为自己学号后两位R2(config-router)#network 192.168.1.0R2(config-router)#network 2.0.0.0R2(config-router)#no auto-summary3、首先在R1和R2配置BGP协议,使用回环口创建邻居关系,参考命令如下:R1(config)#router bgp 65001 65001修改为65000+自己学号后两位R1(config-router)#neighbor 2.2.2.2 remote-as 65001 65001修改为65000+自己学号后两位R1(config-router)#network 1.1.1.1 mask 255.255.255.255R1(config-router)#network 172.16.0.0 mask 255.255.255.0R1(config-router)#network 172.16.1.0 mask 255.255.255.0R1(config-router)#network 172.16.2.0 mask 255.255.255.0R1(config-router)#network 172.16.3.0 mask 255.255.255.0R1(config-router)#network 192.168.1.0R2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#neighbor 1.1.1.1 remote-as 65001 65001修改为65000+自己学号后两位R2(config-router)#network 2.2.2.2 mask 255.255.255.255R2(config-router)#network 192.168.1.0R2(config-router)#network 192.168.2.04、配置后在路由器R1中查看BGP邻居关系和汇总信息,参考命令如下:R1#show ip bgp neighborsR1#show ip bgp summary问题1:R1中邻居关系的状态是什么?5、查看路由器R1和R2的BGP的路由链路数据库信息,参考命令如下:R1#show ip bgp ipv4 unicast问题2:在数据库中是否有非直连链路信息?6、在路由器R1和R2中分别指定回环接口建立邻居关系,参考命令如下:R1(config)#router bgp 65001 65001修改为65000+自己学号后两位R1(config-router)#neighbor 2.2.2.2 update-source lo1 lo1为地址1.1.1.1的接口R2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#neighbor 1.1.1.1 update-source lo0 lo0为地址2.2.2.2的接口问题3:再次查看R1的邻居关系,邻居关系状态为什么?问题4:在路由器R2中查看路由链路数据库,能否看到R1上面的路由?如果能看到的话这些路由是否为最佳路由?(提示:最佳路由提示符为“*>”)问题5:查看R2路由表,能否看到172.16.1.0路由?7、在路由器R1、R2中关闭同步功能R1(config)#router bgp 65001 65001修改为65000+自己学号后两位R1(config-router)#no synchronizationR2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#no synchronization问题6:过一段时间查看路由器R2的路由表,是否能看到172.16.1.0的路由?8、在路由器R2和R3中配置不同自治系统的BGP路由,参考命令如下:R2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#neighbor 3.3.3.3 remote-as 65002 65002修改为65001+自己学号后两位R2(config-router)#neighbor 3.3.3.3 update-source lo0 lo0为地址2.2.2.2的接口R2(config-router)#neighbor 3.3.3.3 ebgp-multihop 2R2(config)#ip route 3.3.3.3 255.255.255.255 192.168.2.3注:添加静态路由,使得R2能够访问3.3.3.3R3(config)#router bgp 65002 65002修改为65001+自己学号后两位R3(config-router)#neighbor 2.2.2.2 remote-as 65001 65001修改为65000+自己学号后两位R3(config-router)#neighbor 2.2.2.2 update-source lo1 lo1为3.3.3.3的接口R3(config-router)#neighbor 2.2.2.2 ebgp-multihop 2R3(config-router)#network 192.168.2.0R3(config-router)#network 192.168.3.0R3(config-router)#network 192.168.4.0R3(config-router)#network 192.168.5.0R3(config-router)#network 192.168.6.0R3(config-router)#network 192.168.7.0R3(config)#ip route 2.2.2.2 255.255.255.255 192.168.2.2注:添加静态路由,使得R2能够访问2.2.2.2问题7:查看路由器R3的路由表,能否得到全网的路由信息?问题8:查看路由器R1的路由器,能否得到全网的路由信息?9、在路由器R1中添加静态路由,使得能够访问3.3.3.3R1(config)#ip route 3.3.3.3 255.255.255.255 192.168.1.2问题9:过一段时间后再查看路由器R1的路由表,能否看到全网路由信息?10、通过路由汇总配置,有效的减少路由表的大小,提高路由效率。
要点总结:bgp的next-hop属性取值有三种情况1、bgp路由器把自己产生的路由发给ibgp对等体时,将下一跳属性设为自己与对端连接的接口的地址。
2、bgp路由器把自己收到的路由发给ebgp对等体时,把下一跳属性设置为自己与对端连接的接口的地址。
3、bgp路由器把从ebgp学到的路由发给ibgp对等体时,并不改变路由信息的属性。
如果配置了负载分担,则会修改下一跳属性。
BGP路由的Origin属性有以下三种:IGP---路由起源于同一AS域内,用show ip bgp时由I代表EGP---路由通过Exterior Gateway Protocol学得,EGP也是一种自治系统间通讯的路由协议,在BGP 出现前使用,已经被BGP取代。
用show ip bgp时由e代表。
Incomplete---路由起源未知或通过其他方式学得,用?表示实验拓扑1、验证AS-PATH属性启动RA/RB/RC/RF配置接口IP,按图示启动各路由器BGP的协议查看RA的路由表RA#show ip route1.0.0.0/32 is subnetted, 1 subnetsC 1.1.1.1 is directly connected, Loopback0C 200.1.0.0/24 is directly connected, FastEthernet0/0C 200.2.0.0/24 is directly connected, Serial1/0B 200.3.0.0/24 [200/0] via 200.2.0.2, 00:01:37C 192.168.1.0/24 is directly connected, Serial1/1B 192.168.2.0/24 [200/0] via 200.2.0.2, 00:01:37红色字第一条,RA到200.3.0.0网段的下一跳是RC,而不是用快速以太网链路连接的RB。
bgp实验报告总结
BGP实验报告总结
背景
BGP(Border Gateway Protocol)是用于在互联网中交换路由信息的协议。
它是一种路径矢量协议,用于确定最佳路径,并且能够适应网络拓扑的变化。
在本次实验中,我们对BGP进行了实验,并对实验结果进行了总结和分析。
实验过程
在实验中,我们使用了模拟器来模拟网络环境,并配置了多个路由器和主机。
我们通过配置BGP协议来模拟网络中的路由器之间的路由信息交换。
我们还模拟了网络中的故障情况,以观察BGP协议对网络拓扑变化的适应能力。
实验结果
通过实验,我们观察到BGP协议在网络拓扑变化时能够快速地重新计算最佳路径,并更新路由表。
当网络中发生故障时,BGP能够及时地发现并通知其他路由器,从而保证了网络的稳定性和可靠性。
此外,我们还观察到BGP协议在处理大规模网络时的效率和性能表现良好。
总结与分析
通过本次实验,我们对BGP协议的工作原理和性能有了更深入的了解。
BGP作为互联网中最重要的路由协议之一,具有很强的稳定性和可靠性。
它能够适应网络拓扑的变化,并且能够处理大规模网络的路由信息交换。
因此,BGP协议在互联网中扮演着至关重要的角色。
结论
通过本次实验,我们对BGP协议有了更深入的了解,并且验证了其在网络中的
稳定性和可靠性。
BGP协议的高效性和性能表现使其成为互联网中不可或缺的一部分,对于构建稳定和可靠的互联网具有重要意义。
我们将继续深入研究BGP协议,并将其应用于实际网络中,以提高网络的稳定性和可靠性。
BGP配置实验案例BGP(边界网关协议)是一个用于在互联网中交换路由信息的协议。
在本篇文章中,我们将探讨一个BGP配置实验案例,其中包括两个自治系统(AS)之间的BGP邻居关系的建立和路由的传递。
这个实验案例可以帮助读者更好地理解BGP协议的工作原理和配置步骤。
在这个实验案例中,我们有两个自治系统:AS1和AS2、AS1拥有IP 地址段192.168.0.0/24,AS2拥有IP地址段10.0.0.0/24、我们的目标是在两个自治系统之间建立BGP邻居关系,并实现路由的传递。
首先,我们需要在两个自治系统中配置BGP路由器。
在AS1中,我们选择一个路由器作为BGP路由器,并配置其Loopback接口的IP地址为192.168.0.1、在AS2中,选择另一个路由器作为BGP路由器,并配置其Loopback接口的IP地址为10.0.0.1、这些Loopback接口的IP地址将用作BGP邻居之间的通信地址。
接下来,我们开始配置BGP邻居关系。
在AS1中,我们需要告诉BGP 路由器与AS2的BGP路由器建立邻居关系。
假设AS2的BGP路由器的IP 地址为10.0.0.2,我们将在AS1的BGP路由器上执行以下命令:``````同样地,在AS2的BGP路由器上,我们需要告诉其与AS1的BGP路由器建立邻居关系。
假设AS1的BGP路由器的IP地址为192.168.0.1,我们将在AS2的BGP路由器上执行以下命令:``````配置完BGP邻居关系后,我们可以开始传递路由信息。
在AS1中,我们希望将本地的IP地址段192.168.0.0/24传输给AS2、我们需要在AS1的BGP路由器上执行以下命令:```network 192.168.0.0 mask 255.255.255.0```这些命令告诉AS1的BGP路由器将地址段192.168.0.0/24传输给BGP邻居。
同样地,在AS2中,我们希望将本地的IP地址段10.0.0.0/24传输给AS1、我们需要在AS2的BGP路由器上执行以下命令:```network 10.0.0.0 mask 255.255.255.0```这些命令告诉AS2的BGP路由器将地址段10.0.0.0/24传输给BGP邻居。
H3C-BGP属性实例-图文BGP路由属性实例AS_path属性某AS_PATH属性按一定次序记录了某条路由从本地到目的地址所要经过的所有AS号。
当BGP将一条路由通告到其他AS时,便会把本地AS号添加在AS_PATH列表的最前面。
收到此路由的BGP路由器根据AS_PATH属性就可以知道去目的地址所要经过的AS。
离本地AS最近的相邻AS号排在前面,其他AS号按顺序依次排列。
例如:某通常BGP不会接受AS_PATH中已包含本地AS号的路由,从而避免形成环路的可能.Ne某t_hop属性BGP的下一跳属性和IGP的有所不同,不一定就是邻居路由器的IP地址。
主要分以下三种情况:BGP发言者把自己产生的路由发给所有邻居时,将把该路由信息的下一跳属性设置为自己与对端连接的接口地址;如图:BGP发言者把接收到的路由发送给EBGP对等体时,将把该路由信息的下一跳属性设置为本地与对端连接的接口地址;如图:BGP发言者把从EBGP邻居得到的路由发给IBGP邻居时,并不改变路由信息的下一跳属性。
Local_pref属性Local_pref属性仅在IBGP对等体之间交换,不通告给其他AS。
它表明BGP路由器的优先级。
Local_pref属性用于判断流量离开本AS时的最佳路由。
当BGP的路由器通过不同的IBGP对等体得到目的地址相同但下一跳不同的多条路由时,将优先选择Local_pref属性值较高的路由。
如图:Med属性MED属性仅在相邻两个AS之间交换,收到此属性的AS一方不会再将其通告给任何其他第三方AS。
MED属性相当于IGP使用的度量值,它用于判断流量进入AS时的最佳路由。
当一个运行BGP的路由器通过不同的EBGP对等体得到目的地址相同但下一跳不同的多条路由时,在其它条件相同的情况下,将优先选择MED值较小者作为最佳路由。
如图:.常用BGP属性配置实例【1】BGP常用属性实例配置1.BGP基本配置要求:如下图所示:所有路由器运行BGP协议,R1与R2、R3与R4建立EBGP对等体,R2与R3建立IBGP对等体。
组网说明:本案例采用H3C HCL模拟器来模拟IPV6 BGP联盟典型组网配置。
R1、R2、R3都属于同一个联盟内,联盟自治域编号为AS100,其中R1属于AS65001,R2属于AS65002,R3属于AS65003。
R1与R2建立EBGP邻居关系,R1与R3建立EBGP邻居关系。
R4属于非联盟的路由器,与R3建立EBGP邻居关系。
配置思路:1、按照网络拓扑图正确配置IP地址2、R1与R2建立EBGP邻居关系,并划分到联盟中。
3、R1与R3建立EBGP邻居关系,并划分到联盟中。
4、R3与R4建立EBGP邻居关系配置过程:R1:<H3C>sysSystem View: return to User View with Ctrl+Z.[H3C]sysname R1[R1]int loopback 1[R1-LoopBack1]ip address 1.1.1.1 32[R1-LoopBack1]quit[R1]int loopback 0[R1-LoopBack0]ipv6 address 4::1 64[R1-LoopBack0]quit[R1]int gi 0/1[R1-GigabitEthernet0/1]des <connect to R3>[R1-GigabitEthernet0/1]ipv6 address 1::1 64[R1-GigabitEthernet0/1]quit[R1]bgp 65002[R1-bgp-default]router-id 1.1.1.1[R1-bgp-default]confederation id 100[R1-bgp-default]confederation peer-as 65001 65003 [R1-bgp-default]peer 1::2 as-number 65001[R1-bgp-default]address-family ipv6 unicast[R1-bgp-default-ipv6]peer 1::2 enable[R1-bgp-default-ipv6]network 4:: 64[R1-bgp-default-ipv6]quit[R1-bgp-default]quit[R1]R2:<H3C>sysSystem View: return to User View with Ctrl+Z.[H3C]sysname R2[R2]int loopback 1[R2-LoopBack1]ip address 2.2.2.2 32[R2-LoopBack1]quit[R2]int loopback 0[R2-LoopBack0]ipv6 address 5::1 64[R2-LoopBack0]quit[R2]int gi 0/0[R2-GigabitEthernet0/0]des <connect to R3>[R2-GigabitEthernet0/0]ipv6 address 2::1 64[R2-GigabitEthernet0/0]quit[R2]bgp 65003[R2-bgp-default]router-id 2.2.2.2[R2-bgp-default]confederation id 100[R2-bgp-default]confederation peer-as 65001 65002 [R2-bgp-default]peer 2::2 as-number 65001[R2-bgp-default]address-family ipv6 unicast[R2-bgp-default-ipv6]peer 2::2 enable[R2-bgp-default-ipv6]network 5:: 64[R2-bgp-default-ipv6]quit[R2-bgp-default]quitR3:<H3C>sysSystem View: return to User View with Ctrl+Z.[H3C]sysname R3[R3]int loopback 1[R3-LoopBack1]ip address 3.3.3.3 32[R3-LoopBack1]quit[R3]int loopback 0[R3-LoopBack0]ipv6 address 6::1 64[R3-LoopBack0]quit[R3]int gi 0/1[R3-GigabitEthernet0/1]des <connect to R1>[R3-GigabitEthernet0/1]ipv6 address 1::2 64[R3-GigabitEthernet0/1]quit[R3]int gi 0/0[R3-GigabitEthernet0/0]des <connect to R2>[R3-GigabitEthernet0/0]ipv6 address 2::2 64[R3-GigabitEthernet0/0]quit[R3]int gi 0/2[R3-GigabitEthernet0/2]des <connect to R4>[R3-GigabitEthernet0/2]ipv6 address 3::1 64[R3-GigabitEthernet0/2]quit[R3]bgp 65001[R3-bgp-default]router-id 3.3.3.3[R3-bgp-default]confederation id 100[R3-bgp-default]confederation peer-as 65002 65003 [R3-bgp-default]peer 1::1 as-number 65002[R3-bgp-default]peer 2::1 as-number 65003[R3-bgp-default]peer 3::2 as-number 200[R3-bgp-default]address-family ipv6 unicast[R3-bgp-default-ipv6]peer 3::2 enable[R3-bgp-default-ipv6]peer 1::1 enable[R3-bgp-default-ipv6]peer 2::1 enable[R3-bgp-default-ipv6]import-route direct[R3-bgp-default-ipv6]network 6:: 64[R3-bgp-default-ipv6]quit[R3-bgp-default]quitR4:<H3C>sysSystem View: return to User View with Ctrl+Z.[H3C]sysname R4[R4]int loopback 1[R4-LoopBack1]ip address 4.4.4.4 32[R4-LoopBack1]quit[R4]int loopback 0[R4-LoopBack0]ipv6 address 7::1 64[R4-LoopBack0]quit[R4]int gi 0/2[R4-GigabitEthernet0/2]des <connect to R3>[R4-GigabitEthernet0/2]ipv6 address 3::2 64[R4-GigabitEthernet0/2]quit<H3C>sysSystem View: return to User View with Ctrl+Z.[H3C]sysname R4[R4]int loopback 1[R4-LoopBack1]ip address 4.4.4.4 32[R4-LoopBack1]quit[R4]int loopback 0[R4-LoopBack0]ipv6 address 7::1 64[R4-LoopBack0]quit[R4]int gi 0/2[R4-GigabitEthernet0/2]des <connect to R3>[R4-GigabitEthernet0/2]ipv6 address 3::2 64[R4-GigabitEthernet0/2]quit[R4]bgp 200[R4-bgp-default]router-id 4.4.4.4[R4-bgp-default]peer 3::1 as-number 100[R4-bgp-default]address-family ipv6 unicast[R4-bgp-default-ipv6]peer 3::1 enable[R4-bgp-default-ipv6]network 7:: 64[R4-bgp-default-ipv6]quit[R4-bgp-default]quit分别查看R1、R2、R3、R4的IPV6路由表:[R1]dis ipv6 routing-tableDestinations : 12 Routes : 12Destination: ::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 1::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : GE0/1 Cost : 0Destination: 1::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 2::/64 Protocol : BGP4+ NextHop : 1::2 Preference: 255 Interface : GE0/1 Cost : 0Destination: 3::/64 Protocol : BGP4+ NextHop : 1::2 Preference: 255 Interface : GE0/1 Cost : 0Destination: 4::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : Loop0 Cost : 0Destination: 4::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 5::/64 Protocol : BGP4+ NextHop : 2::1 Preference: 255 Interface : GE0/1 Cost : 0Destination: 6::/64 Protocol : BGP4+ NextHop : 1::2 Preference: 255 Interface : GE0/1 Cost : 0Destination: 7::/64 Protocol : BGP4+ NextHop : 3::2 Preference: 255 Interface : GE0/1 Cost : 0Destination: FE80::/10 Protocol : Direct NextHop : :: Preference: 0 Interface : InLoop0 Cost : 0Destination: FF00::/8 Protocol : Direct NextHop : :: Preference: 0 Interface : NULL0 Cost : 0 [R1][R2]dis ipv6 routing-tableDestinations : 12 Routes : 12Destination: ::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 1::/64 Protocol : BGP4+ NextHop : 2::2 Preference: 255 Interface : GE0/0 Cost : 0Destination: 2::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : GE0/0 Cost : 0Destination: 2::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 3::/64 Protocol : BGP4+ NextHop : 2::2 Preference: 255 Interface : GE0/0 Cost : 0Destination: 4::/64 Protocol : BGP4+ NextHop : 1::1 Preference: 255 Interface : GE0/0 Cost : 0Destination: 5::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : Loop0 Cost : 0Destination: 5::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 6::/64 Protocol : BGP4+ NextHop : 2::2 Preference: 255 Interface : GE0/0 Cost : 0Destination: 7::/64 Protocol : BGP4+ NextHop : 3::2 Preference: 255 Interface : GE0/0 Cost : 0Destination: FE80::/10 Protocol : Direct NextHop : :: Preference: 0 Interface : InLoop0 Cost : 0Destination: FF00::/8 Protocol : Direct NextHop : :: Preference: 0 Interface : NULL0 Cost : 0 [R2][R3]dis ipv6 routing-tableDestinations : 14 Routes : 14Destination: ::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 1::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : GE0/1 Cost : 0Destination: 1::2/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 2::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : GE0/0 Cost : 0Destination: 2::2/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 3::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : GE0/2 Cost : 0Destination: 3::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 4::/64 Protocol : BGP4+ NextHop : 1::1 Preference: 255 Interface : GE0/1 Cost : 0Destination: 5::/64 Protocol : BGP4+ NextHop : 2::1 Preference: 255 Interface : GE0/0 Cost : 0Destination: 6::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : Loop0 Cost : 0Destination: 6::1/128 Protocol : Direct NextHop : ::1 Preference: 0Interface : InLoop0 Cost : 0Destination: 7::/64 Protocol : BGP4+ NextHop : 3::2 Preference: 255 Interface : GE0/2 Cost : 0Destination: FE80::/10 Protocol : Direct NextHop : :: Preference: 0 Interface : InLoop0 Cost : 0Destination: FF00::/8 Protocol : Direct NextHop : :: Preference: 0 Interface : NULL0 Cost : 0 [R3][R4]dis ipv6 routing-tableDestinations : 12 Routes : 12Destination: ::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 1::/64 Protocol : BGP4+ NextHop : 3::1 Preference: 255 Interface : GE0/2 Cost : 0Destination: 2::/64 Protocol : BGP4+ NextHop : 3::1 Preference: 255 Interface : GE0/2 Cost : 0Destination: 3::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : GE0/2 Cost : 0Destination: 3::2/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: 4::/64 Protocol : BGP4+ NextHop : 3::1 Preference: 255 Interface : GE0/2 Cost : 0Destination: 5::/64 Protocol : BGP4+NextHop : 3::1 Preference: 255 Interface : GE0/2 Cost : 0Destination: 6::/64 Protocol : BGP4+ NextHop : 3::1 Preference: 255 Interface : GE0/2 Cost : 0Destination: 7::/64 Protocol : Direct NextHop : :: Preference: 0 Interface : Loop0 Cost : 0Destination: 7::1/128 Protocol : Direct NextHop : ::1 Preference: 0 Interface : InLoop0 Cost : 0Destination: FE80::/10 Protocol : Direct NextHop : :: Preference: 0 Interface : InLoop0 Cost : 0Destination: FF00::/8 Protocol : Direct NextHop : :: Preference: 0 Interface : NULL0 Cost : 0 [R4]查看R1的BGP邻居信息:查看R2的BGP邻居信息:查看R3的BGP邻居信息:查看R4的BGP邻居信息:查看R1的IPV6 BGP路由表:[R1]dis bgp routing-table ipv6Total number of routes: 7BGP local router ID is 1.1.1.1Status codes: * - valid, > - best, d - dampened, h - historys - suppressed, S - stale, i - internal, e - externala - additional-pathOrigin: i - IGP, e - EGP, ? - incomplete* >i Network : 1:: PrefixLen : 64 NextHop : 1::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001)?* >i Network : 2:: PrefixLen : 64 NextHop : 1::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001)?* >i Network : 3:: PrefixLen : 64 NextHop : 1::2 LocPrf : 100 PrefVal : 0 OutLabel : NULLMED : 0Path/Ogn: (65001)?* > Network : 4:: PrefixLen : 64 NextHop : :: LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: i* >i Network : 5:: PrefixLen : 64 NextHop : 2::1 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001 65003)i* >i Network : 6:: PrefixLen : 64 NextHop : 1::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001)i* >i Network : 7:: PrefixLen : 64 NextHop : 3::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001) 200i[R1]查看R2的IPV6 BGP路由表:[R2]dis bgp routing-table ipv6Total number of routes: 7BGP local router ID is 2.2.2.2Status codes: * - valid, > - best, d - dampened, h - historys - suppressed, S - stale, i - internal, e - externala - additional-pathOrigin: i - IGP, e - EGP, ? - incomplete* >i Network : 1:: PrefixLen : 64 NextHop : 2::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001)?* >i Network : 2:: PrefixLen : 64 NextHop : 2::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001)?* >i Network : 3:: PrefixLen : 64 NextHop : 2::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001)?* >i Network : 4:: PrefixLen : 64 NextHop : 1::1 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001 65002)i* > Network : 5:: PrefixLen : 64 NextHop : :: LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: i* >i Network : 6:: PrefixLen : 64 NextHop : 2::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001)i* >i Network : 7:: PrefixLen : 64 NextHop : 3::2 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65001) 200i[R2]查看R3的IPV6 BGP路由表:[R3]dis bgp routing-table ipv6Total number of routes: 11BGP local router ID is 3.3.3.3Status codes: * - valid, > - best, d - dampened, h - historys - suppressed, S - stale, i - internal, e - externala - additional-pathOrigin: i - IGP, e - EGP, ? - incomplete* > Network : 1:: PrefixLen : 64 NextHop : :: LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: ?* > Network : 1::2 PrefixLen : 128 NextHop : ::1 LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: ?* > Network : 2:: PrefixLen : 64 NextHop : :: LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: ?* > Network : 2::2 PrefixLen : 128 NextHop : ::1 LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: ?* > Network : 3:: PrefixLen : 64 NextHop : :: LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: ?* > Network : 3::1 PrefixLen : 128 NextHop : ::1 LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: ?* >i Network : 4:: PrefixLen : 64 NextHop : 1::1 LocPrf : 100 PrefVal : 0 OutLabel : NULLMED : 0Path/Ogn: (65002)i* >i Network : 5:: PrefixLen : 64 NextHop : 2::1 LocPrf : 100 PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: (65003)i* > Network : 6:: PrefixLen : 64 NextHop : :: LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: i* > Network : 6::1 PrefixLen : 128 NextHop : ::1 LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: ?* >e Network : 7:: PrefixLen : 64 NextHop : 3::2 LocPrf :PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: 200i[R3]查看R4的IPV6 BGP路由表:[R4]dis bgp routing-table ipv6Total number of routes: 7BGP local router ID is 4.4.4.4Status codes: * - valid, > - best, d - dampened, h - historys - suppressed, S - stale, i - internal, e - externala - additional-pathOrigin: i - IGP, e - EGP, ? - incomplete* >e Network : 1:: PrefixLen : 64 NextHop : 3::1 LocPrf :PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: 100?* >e Network : 2:: PrefixLen : 64 NextHop : 3::1 LocPrf :PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: 100?* >e Network : 3:: PrefixLen : 64 NextHop : 3::1 LocPrf :PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: 100?* >e Network : 4:: PrefixLen : 64 NextHop : 3::1 LocPrf :PrefVal : 0 OutLabel : NULL MED :Path/Ogn: 100i* >e Network : 5:: PrefixLen : 64 NextHop : 3::1 LocPrf :PrefVal : 0 OutLabel : NULL MED :Path/Ogn: 100i* >e Network : 6:: PrefixLen : 64 NextHop : 3::1 LocPrf :PrefVal : 0 OutLabel : NULL MED : 0Path/Ogn: 100i* > Network : 7:: PrefixLen : 64 NextHop : :: LocPrf :PrefVal : 32768 OutLabel : NULL MED : 0Path/Ogn: i[R4]在R1使用loopback0作为源,能PING通R2、R3、R4的loopback0:在R2使用loopback0作为源,能PING通R1、R3、R4的loopback0:在R3使用loopback0作为源,能PING通R1、R2、R4的loopback0:在R4使用loopback0作为源,能PING通R1、R2、R3的loopback0:由以上测试结果可知,R1、R2、R3、R4的loopback0均可相互PING通。
BGP实验集合实验人:高承旺实验目录:1.BGP基本实验2.非等级负载分担3.LOCAL_PREF属性实现离开本地AS时的最佳路由4.MED属性实现进入AS时的最佳路径5.Prefered-value(首选值)属性6.BGP反射7.同步实验拓扑:1.EBGP对等体之间的基本配置[R1]bgp 10[R1-bgp]router-id 1.1.1.1[R1-bgp]peer 192.168.1.2 as-number 20[R1-bgp]peer 192.168.4.1 as-number 20(没用到)[R1-bgp]net 1.1.1.1 32[R1-bgp]q[R2]bgp 20[R2-bgp]router-id 2.2.2.2[R2-bgp]peer 192.168.1.1 as-number 10[R2-bgp]network 2.2.2.2 322.建立邻居关系必须要求tcp可达,ospf宣告直连网段[R2]ospf[R2-ospf-1]area 0[R2-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.0.255[R2-ospf-1-area-0.0.0.0]q[R2-ospf-1]q[R3]ospf[R3-ospf-1]area 0[R3-ospf-1-area-0.0.0.0]net 192.168.2.0 0.0.0.255[R3-ospf-1-area-0.0.0.0]net 192.168.3.0 0.0.0.255[R3-ospf-1-area-0.0.0.0]q[R3-ospf-1]q[R4]ospf[R4-ospf-1]area 0[R4-ospf-1-area-0.0.0.0]net 192.168.3.0 0.0.0.255[R4-ospf-1-area-0.0.0.0]q[R4-ospf-1]q3.R2和R3是建立邻居关系[R2-bgp]peer 192.168.2.2 as-number 20[R3]bgp 20[R3-bgp]router-id 3.3.3.3[R3-bgp]peer 192.168.2.1 as-number 20[R3-bgp]network 3.3.3.3 32[R2-bgp]display bgp routing-tableTotal Number of Routes: 3BGP Local router ID is 2.2.2.2Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteNetwork NextHop MED LocPrf PrefVal Path/Ogn*> 1.1.1.1/32 192.168.1.1 0 0 10i*> 2.2.2.2/32 0.0.0.0 0 0 i*>i 3.3.3.3/32 192.168.2.2 0 100 0 i*代表有效路由>代表最有路由[R3-bgp]display bgp routing-tableTotal Number of Routes: 3BGP Local router ID is 3.3.3.3Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteNetwork NextHop MED LocPrf PrefVal Path/Ogni 1.1.1.1/32 192.168.1.1 0 100 0 10i*>i 2.2.2.2/32 192.168.2.1 0 100 0 i*> 3.3.3.3/32 0.0.0.0 0 0 i关于到1.1.1。
BGP基本配置引入本章介绍了BGP协议的配置步骤、BGP对等体和路由信息查看以及BGP的维护调试命令。
课程目标学习完本课程,您应该能够:⏹掌握BGP路由协议的基本功能配置⏹掌握BGP同步配置⏹掌握BGP路由协议的显示维护目录⏹配置BGP协议基本功能⏹配置BGP同步⏹BGP基本配置示例⏹BGP协议的基本显示和维护启动BGP并创建BGP连接●启动BGP[Router] bgp as-number●配置Router ID[Router bgp] router id router id[Router-bgp]router-id router-id●指定BGP对等体及AS号[Router bgp] peer ip address as number as number [Router-bgp]peer ip-address as-number as-number优化BGP连接●指定建立TCP连接使用的源接口[Router-bgp] peer ip-address connect-interface interface-type interface-number●配置允许同非直接相连网络上的邻居建立EBGP连接[Router-bgp] peer ip-address ebgp-max-hop[ hop-count ]count配置BGP生成路由●将本地路由发布到BGP路由表中[Router-bgp] network ip-address [ mask | mask-length ][route policy route policy name ]length[route-policy route-policy-name●引入其它路由协议的路由[Router-bgp] import-route protocol[ process-id|all-[Router-bgp]import-route[processes] [ med med-value| route-policy route-p y]policy-name目录⏹配置BGP协议基本功能⏹配置BGP同步⏹BGP基本配置示例⏹BGP协议的基本显示和维护配置BGP 同步●BGP [Router-bgp] synchronization 启用同步特性●关闭BGP 同步特性→MSR 路由器缺省关闭[Router-bgp] undo synchronization目录⏹配置BGP协议基本功能⏹配置BGP同步⏹BGP基本配置示例⏹BGP协议的基本显示和维护BGP 基本配置示例AS 65223AS 65101AS 65223RTDLoopback 04444/32Loopback 02222/32Loopback 01111/32OSPFOSPF 10.3.3.1/30RTARTBRTC10.3.3.2/304.4.4.4/322.2.2.2/321.1.1.1/32IBGP[RTB] bgp 65223[RTB-bgp]router-id 2.2.2.2[RTB-bgp]peer 10.3.3.1 as-number 65101[RTB-bgp]peer 4.4.4.4 as-number 65223[RTB-bgp]peer 4.4.4.4 connect-interface LoopBack 0[RTB-bgp]import-route ospf 1[RTB-ospf-1]import-route bgp[RTA] bgp 65101[RTA b ]t id 1111[RTB ospf 1]import route bgp [RTC] bgp 65223[RTC-bgp]router-id 4444[RTA-bgp]router-id 1.1.1.1[RTA-bgp]peer 10.3.3.2 as-number 65223 [RTA-bgp] network 10.3.3.0 255.255.255.252[RTA-bgp] network 1.1.1.1 255.255.255.255[RTC bgp]router id 4.4.4.4[RTC-bgp]peer 2.2.2.2 as-number 65223[RTC-bgp]peer 2.2.2.2 connect-interface LoopBack 0目录⏹配置BGP协议基本功能⏹配置BGP同步⏹BGP基本配置示例⏹BGP协议的基本显示和维护显示BGP 对等体的信息<RTB> display bgp peerBGP local router ID :172163130本地的路由器ID 本地自治系统号BGP local router ID : 172.16.3.130Local AS number : 65002Total number of peers : 2 Peers in established state : 2Peer V AS MsgRcvd MsgSent OutQ PrefRcv Up/Down State 1010101465001440000:02:23Established 10.10.10.1 4 65001 4 4 0 0 00:02:23 Established 10.10.10.6 4 65002 2 3 0 0 00:00:05 Established对等体有限状对等体的IP 地址对等体所在的AS 号会话已建立的时长/态机当状态(会话未建立时)当前状态的时长显示BGP 路由信息路由的AS_PATH/ORIGIN 属性值路由首选值<RTB> display bgp routing-table Total Number of Routes: 4BGP Local router ID is 172.16.3.130Status codes: * -valid, > -best, d -damped,h -history, i -internal, s -suppressed, S -Stale Origin : i -IGP , e -EGP , ? -incomplete g pNetwork NextHop MED LocPrf PrefVal Path/Ogn *> 1.1.1.1/32 10.10.10.1 0 0 65001i *>i 4.4.4.4/32 10.10.10.6 0 100 0 ?目的网络地址下跳地址MULTI EXIT DISC路由状态代码下一跳地址MULTI_EXIT_DISC 属性值本地优先级local-preference 属性值查看BGP 的debugging 信息BGP 有限状态机<Router>debugging bgp event*May 11 10:09:14:468 2009 H3C RM/6/RMDEBUG:BGP .: 10.10.10.2 State is changed from IDLE to CONNECT.*M 111009144682009H3C RM/6/RMDEBUG 状态切换*May 11 10:09:14:468 2009 H3C RM/6/RMDEBUG:BGP .: 10.10.10.2 State is changed from CONNECT to ACTIVE.*May 11 10:09:14:469 2009 H3C RM/6/RMDEBUG:BGP .: 10.10.10.2 State is changed from ACTIVE to OPENSENT.*M 111009144722009H3C RM/6/RMDEBUG *May 11 10:09:14:472 2009 H3C RM/6/RMDEBUG:BGP .: 10.10.10.2 Current event is ReceiveOpenMessage.*May 11 10:09:14:473 2009 H3C RM/6/RMDEBUG:BGP .: 10.10.10.2 State is changed from OPENSENT to OPENCONFIRM.%M 111009144752009H3C RM/3/RMLOG %May 11 10:09:14:475 2009 H3C RM/3/RMLOG:BGP .: 10.10.10.2 State is changed from OPENCONFIRM to ESTABLISHED.*May 11 10:09:14:617 2009 H3C RM/6/RMDEBUG:BGP .: 10.10.10.2 Current event is RecvKeepAliveMessage接收到的BGP 协议消息报文类型消报文类型本章总结⏹配置BGP建立连接⏹配置BGP协议生成路由协生路由⏹配置BGP同步⏹BGP对等体、路由信息查看。
一、实验步骤
配置各台设备的ip地址
测试直连的连通性
配置OSPF 路由协议
配置BGP路由协议
宣告BGP网络
合理修改BGP路由的属性来改变路由的选择
测试网络的连通性
二、配置命令及其实验结果
配置物理接口IP地址和loopback地址,并测试直连的连通性--------------略Loopback 0 :10.1.1.1/32 RT1
Loopback 0 :10.2.2.2/32 RT2
Loopback 0 :10.3.3.3/32 RT3
Loopback 0 :10.4.4.4/32 RT4
配置OSPF协议
wcg-RT2:
ospf 1 router-id 10.2.2.2
area 0.0.0.0
network 192.168.23.1 0.0.0.0
network 10.2.2.2 0.0.0.0
wcg-RT3:
ospf 1 router-id 10.3.3.3
area 0.0.0.0
network 192.168.23.2 0.0.0.0 network 10.3.3.3 0.0.0.0 network 192.168.34.2 0.0.0.0
wcg-RT4:
ospf 1 router-id 10.4.4.4
area 0.0.0.0
network 192.168.34.1 0.0.0.0 network 10.4.4.4 0.0.0.0
在wcg-RT4上查看IP路由表
配置BGP路由协议
wcg-RT1:
bgp 65001
router-id 10.1.1.1
undo synchronization
peer 192.168.12.2 as-number 65002 peer 192.168.14.2 as-number 65002
wcg-RT2:
bgp 65002
router-id 10.2.2.2
undo synchronization
peer 192.168.12.1 as-number 65001 peer 10.3.3.3 as-number 65002
peer 10.3.3.3 connect-interface LoopBack0
wcg-RT3:
bgp 65002
router-id 10.3.3.3
undo synchronization
peer 10.4.4.4 as-number 65002
peer 10.2.2.2 as-number 65002
peer 10.4.4.4 connect-interface LoopBack0 peer 10.2.2.2 connect-interface LoopBack0
wcg-RT4:
bgp 65002
undo synchronization
peer 192.168.14.1 as-number 65001
peer 10.3.3.3 as-number 65002
peer 10.3.3.3 connect-interface LoopBack0 在wcg-RT1和wcg-RT4上查看BGP邻居表
宣告BGP路由网络
wcg-RT1:
bgp 65001
network 100.1.1.1 255.255.255.255
wcg-RT3:
bgp 65002
network 200.1.1.1 255.255.255.255
network 200.2.2.2 255.255.255.255
network 200.3.3.3 255.255.255.255
在wcg-RT1和wcg-RT4上查看BGP路由表
在上面的截图我们看见了100.1.1.1的路由是无效的路由,原因是吓一跳不可达,所有需要在wcg-RT2和wcg-RT4上指定吓一跳为自己
wcg-RT2:
bgp 65002
peer 10.3.3.3 next-hop-local
wcg-RT4:
bgp 65002
peer 10.3.3.3 next-hop-local
在wcg-RT3上查看BGP路由表
修改BGP属性使得100网络和200网络相互访问均通过下一跳R4 方案一:
wcg-RT1:
bgp 65001
peer 192.168.14.2 preferred-value 10
wcg-RT3:
bgp 65002
peer 10.4.4.4 preferred-value 10
在wcg-RT1和wcg-RT3上查看BGP路由表
还原方案一实验之前的实验效果
方案二:
wcg-RT2:
bgp 65002
default med 10
default local-preference 90
在wcg-RT1和wcg-RT3上查看BGP路由表
还原方案二实验之前的实验效果
方案三:
wcg-RT1:
route-policy 123 permit node 10
apply origin incomplete
quit
bgp 65001
peer 192.168.12.2 route-policy 123 export
wcg-RT3:
route-policy 123 permit node 10
apply origin incomplete
quit
bgp 65002
peer 10.2.2.2 route-policy 123 export
在wcg-RT1和wcg-RT13上查看BGP路由表。