养生 装修 购物 美食 感冒 便秘 营销 加盟 小吃 火锅 管理 创业 搭配 减肥 培训 旅游

利用BGP路由的Community属性实现流量分担

时间:2024-11-09 02:04:25

在BGP组网中,使用bgp协议的Community属性实现流量分担!让访问不同网段的流量走不同的路径!

工具/原料

dellT1700

win7旗舰版

ensp1.00.100

方法/步骤

1、首先来介绍下网络拓扑图:路由器rrr3属于AS100并且内部运行ospf协议。r4属于AS200。r7属于AS300并且内部运行ospf协议。本例中a路径:1.1.1.1访问172.16.10.1走r1-r2-r4-r5-r7。b路径:1.1.1.1访问172.16.20.1走路径r1-r3-r4-r6-r7。介绍完拓扑图后接下来将为大家依次介绍每个路由器的配置!

利用BGP路由的Community属性实现流量分担

2、路由器r1的核心配置:#interfaceGigabitEthernet0/0/0ipaddress10.0.12.1255.255.255.0#interfaceGigabitEthernet0/0/1ipaddress10.0.13.1255.255.255.0#interfaceGigabitEthernet0/0/2#interfaceNULL0#interfaceLoopBack0ipaddress1.1.1.1255.255.255.255#interfaceLoopBack10ipaddress192.168.10.1255.255.255.0#interfaceLoopBack20ipaddress192.168.20.1255.255.255.0#bgp100router-id1.1.1.1peer10.0.12.2as-number100peer10.0.13.3as-number100#ipv4-familyunicastundosynchronizationnetwork1.1.1.1255.255.255.255network192.168.10.0network192.168.20.0peer10.0.12.2enablepeer10.0.13.3enable#ospf1router-id1.1.1.1area0.0.0.0network1.1.1.10.0.0.0network10.0.12.00.0.0.255network10.0.13.00.0.0.255#

利用BGP路由的Community属性实现流量分担

3、路由器r2的核心配置:#interfaceGigabitEthernet0/0/0ipadd筠续师诈ress10.0.12.2255.婷钠痢灵255.255.0#interfaceGigabitEthernet0/0/1ipaddress10.0.24.2255.255.255.0#interfaceGigabitEthernet0/0/2#interfaceNULL0#interfaceLoopBack0ipaddress2.2.2.2255.255.255.255#bgp100router-id2.2.2.2peer10.0.12.1as-number100peer10.0.24.4as-number200#ipv4-familyunicastundosynchronizationnetwork2.2.2.2255.255.255.255peer10.0.12.1enablepeer10.0.24.4enable#ospf1router-id2.2.2.2area0.0.0.0network2.2.2.20.0.0.0network10.0.12.00.0.0.255network10.0.24.00.0.0.255#路由器r3的核心配置:#interfaceGigabitEthernet0/0/0ipaddress10.0.34.3255.255.255.0#interfaceGigabitEthernet0/0/1ipaddress10.0.13.3255.255.255.0#interfaceGigabitEthernet0/0/2#interfaceNULL0#interfaceLoopBack0ipaddress3.3.3.3255.255.255.255#bgp100router-id3.3.3.3peer10.0.13.1as-number100peer10.0.34.4as-number200#ipv4-familyunicastundosynchronizationnetwork3.3.3.3255.255.255.255peer10.0.13.1enablepeer10.0.34.4enable#ospf1router-id3.3.3.3area0.0.0.0network3.3.3.30.0.0.0network10.0.13.00.0.0.255network10.0.34.00.0.0.255#

利用BGP路由的Community属性实现流量分担

利用BGP路由的Community属性实现流量分担

4、路由器r4的核心配置:#interfaceGigabitEthernet0/0/0ipadd筠续师诈ress10.0.34.4255.婷钠痢灵255.255.0#interfaceGigabitEthernet0/0/1ipaddress10.0.24.4255.255.255.0#interfaceGigabitEthernet4/0/0ipaddress10.0.46.4255.255.255.0#interfaceGigabitEthernet4/0/1ipaddress10.0.45.4255.255.255.0#interfaceLoopBack0ipaddress4.4.4.4255.255.255.255#bgp200router-id4.4.4.4peer10.0.24.2as-number100peer10.0.34.3as-number100peer10.0.45.5as-number300peer10.0.46.6as-number300#ipv4-familyunicastundosynchronizationnetwork4.4.4.4255.255.255.255peer10.0.24.2enablepeer10.0.24.2route-policymed10exportpeer10.0.24.2advertise-communitypeer10.0.34.3enablepeer10.0.34.3route-policymed20exportpeer10.0.34.3advertise-communitypeer10.0.45.5enablepeer10.0.45.5route-policy10importpeer10.0.46.6enablepeer10.0.46.6route-policy10import#route-policy10permitnode10if-matchcommunity-filter10applyip-addressnext-hop10.0.45.5#route-policy10permitnode20if-matchcommunity-filter20applyip-addressnext-hop10.0.46.6#route-policymed10permitnode10if-matchcommunity-filter10applycost100#route-policymed10permitnode20if-matchcommunity-filter20applycost200#route-policymed20permitnode10if-matchcommunity-filter20applycost100#route-policymed20permitnode20if-matchcommunity-filter10applycost200#ipcommunity-filter10permit300:100ipcommunity-filter20permit300:200#

利用BGP路由的Community属性实现流量分担

5、路由器r5核心配置:#interfaceGigabitEthernet0/0/1ipaddr娣定撰钠ess10缕计瓤账.0.45.5255.255.255.0#interfaceGigabitEthernet0/0/2ipaddress10.0.57.5255.255.255.0#interfaceNULL0#interfaceLoopBack0ipaddress5.5.5.5255.255.255.255#bgp300router-id5.5.5.5peer10.0.45.4as-number200peer10.0.57.7as-number300#ipv4-familyunicastundosynchronizationnetwork5.5.5.5255.255.255.255peer10.0.45.4enablepeer10.0.45.4advertise-communitypeer10.0.57.7enable#ospf1router-id5.5.5.5area0.0.0.0network5.5.5.50.0.0.0network10.0.45.00.0.0.255network10.0.57.00.0.0.255#路由器r6核心配置:#interfaceGigabitEthernet0/0/0ipaddress10.0.46.6255.255.255.0#interfaceGigabitEthernet0/0/1ipaddress10.0.67.6255.255.255.0#interfaceLoopBack0ipaddress6.6.6.6255.255.255.255#bgp300router-id6.6.6.6peer10.0.46.4as-number200peer10.0.67.7as-number300#ipv4-familyunicastundosynchronizationnetwork6.6.6.6255.255.255.255peer10.0.46.4enablepeer10.0.46.4advertise-communitypeer10.0.67.7enable#ospf1router-id6.6.6.6area0.0.0.0network6.6.6.60.0.0.0network10.0.46.00.0.0.255network10.0.67.00.0.0.255#

利用BGP路由的Community属性实现流量分担

利用BGP路由的Community属性实现流量分担

6、路由器r7核心配置:#interfaceGigabitEthernet0/0/1ipaddress10.0.67.7255.255.255.0#interfaceGigabitEthernet0/0/2ipaddress10.0.57.7255.255.255.0#interfaceNULL0#interfaceLoopBack0ipaddress7.7.7.7255.255.255.255#interfaceLoopBack10ipaddress172.16.10.1255.255.255.0#interfaceLoopBack20ipaddress172.16.20.1255.255.255.0#bgp300router-id7.7.7.7peer10.0.57.5as-number300peer10.0.67.6as-number300#ipv4-familyunicastundosynchronizationnetwork7.7.7.7255.255.255.255network172.16.10.0255.255.255.0route-policycom10network172.16.20.0255.255.255.0route-policycom20peer10.0.57.5enablepeer10.0.57.5advertise-communitypeer10.0.67.6enablepeer10.0.67.6advertise-community#ospf1router-id7.7.7.7area0.0.0.0network7.7.7.70.0.0.0network10.0.57.00.0.0.255network10.0.67.00.0.0.255#route-policycom10permitnode10applycommunity300:100#route-policycom20permitnode10applycommunity300:200#

利用BGP路由的Community属性实现流量分担

7、配置好所有设备后我们在r4上查看172.16.10.0和172.16.20.0网段的community值:<ar4>disbgprouting-table172.16.10.1BGPlocalrouterID:4.4.4.4LocalASnumber:200Paths:2available,1best,1selectBGProutingtableentryinformationof172.16.10.0/24:From:10.0.45.5(5.5.5.5)RouteDuration:01h13m49sDirectOut-interface:GigabitEthernet4/0/1Originalnexthop:10.0.45.5Qosinformation:0x0Community:<300:100>AS-path300,originigp,pref-val0,valid,external,best,select,active,pre255Advertisedtosuch4peers:10.0.45.510.0.46.610.0.24.210.0.34.3BGProutingtableentryinformationof172.16.10.0/24:From:10.0.46.6(6.6.6.6)RouteDuration:01h13m39sRelayIPNexthop:0.0.0.0RelayIPOut-Interface:GigabitEthernet4/0/1Originalnexthop:10.0.45.5Qosinformation:0x0Community:<300:100>通过上面输出的信息可以看到172.16.10.1的Community属性值是<300:100>!

利用BGP路由的Community属性实现流量分担

8、最后我们在r1上使用tracert命令查看路径是否如我们所设置的那样:<ar1>tracert-a1.1.1.1172.16.10.1tracerouteto172.16.10.1(172.16.10.1),maxhops:30,packetlength:40,pressCTRL_Ctobreak110.0.12.220ms20ms20ms210.0.24.420ms30ms30ms310.0.45.530ms30ms30ms410.0.57.730ms40ms40ms<ar1>tr <ar1>tracert-a1.1.1.1172.16.20.1tracerouteto172.16.20.1(172.16.20.1),maxhops:30,packetlength:40,pressCTRL_Ctobreak110.0.13.320ms20ms20ms210.0.34.420ms30ms20ms310.0.46.630ms30ms40ms410.0.67.730ms20ms30ms输出结果与路由器的输出结果路线均正确,配置成功!

利用BGP路由的Community属性实现流量分担

© 一点知识