bgp综合实验答案Word文档下载推荐.docx
- 文档编号:19846028
- 上传时间:2023-01-10
- 格式:DOCX
- 页数:8
- 大小:68.25KB
bgp综合实验答案Word文档下载推荐.docx
《bgp综合实验答案Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《bgp综合实验答案Word文档下载推荐.docx(8页珍藏版)》请在冰豆网上搜索。
四:
BGP建立邻居关系时可以跟上路由图,用来作一些策略。
BGP选路策略顺序如下:
BGP的选路原则
1)BGP的路径属性
A路径属性的分类
1、well-knownvsoptional
well-known:
表示该路径属性能够被所有的BGP实现者支持
optional:
表示该路径属性不一定能够被所有的BGP实现者支持
说明:
FRC(request
for
comment),shouldbe、mustbe、maybe
2、mandatoryvsdiscretionary
mandatory:
要求在每个BGP更新中,必须包含该路径属性
discretionary:
在BGP更新中,可以包含也可以不包含该路径属性
常见的BGP路径属性:
well-knownmandatory:
公认强制属性
well-knowndiscretionary:
公认自由选择属性
optional
transitive:
可选传递属性
optionalnontransitive:
3、transitivevsnontransitive
atransitive:
若一个BGP的实现者收到无法识别的optional属性,若该属性为transitive保留并传给其他的BGP实现者
bnontransitive:
若一个BGP的实现者收到无法识别的optional属性,若该属性为nontransitive,则丢弃。
4partial:
若一个BGP的实现者收到无法识别的optional属性,若该属性为transitive保留并传给其他的BGP实现者同时将该属性标为partial
BBGP路径属性:
1、AS-path(公认强制属性)
防止AS间的路由环路。
as-path
当一个BGP路由器向EBGP邻居通告路由时,会将本路由器所属的AS添加在AS-PATH的最左边
当一个BGP路由器向IBGP邻居通告路由时,AS-PATH保持不变
2、next-hop(公认强制)
nexthop
当一个BGP路由器向EBGP邻居通告路由时,next-hop修改为本路由器的某个接口IP地址
当一个BGP路由器向IBGP邻居通告路由时,next-hop保持不变
3、origin(公认强制)
i/e/?
i:
表示该BGP路由是通过network命令引入的
e:
表示该BGP路由是通过redistribute命令从EGP引入的
?
:
表示该BGP路由是通过redistribute命令从IGP引入的
4、localpreference(公认自由选择)
目的:
控制离开本AS的流量
locpref属性只能在ibgp中的邻居传播
在BGP中,LOCpref越高,路由越优先。
缺省情况下。
localpref的值为100(先讲这个)
5、med(cisco设备--metric,可选非传递)
控制进入本AS的流量
MED属性传播给EBGP邻居,并在EBGP所属的AS中传播(注:
对方AS不能将MED再发送其他AS)
在BGP中,MED越小,路由越优先。
localpref的值为100
注:
缺省情况下,BGP路由器只会比较来自同一个AS,不比较来自不同的AS
6、weight(cisco私有属性)
weight属性不传播给任何BGP邻居,只能在同一个路由器上使用。
weight越大,路由越优先。
其他。
。
数据流量的方向《---------》路由的学习方向是相反的
注意:
BGP设计不是为了负载均衡,它的选路是根据策略来进行的。
它的选路最终与带宽无关,BGP将为每个目标网络选择出一条最优的路由(若希望进行负载均衡,需要额外的命令配置)
首先BGP只考虑同步(如果同步原则开启的话)b、无AS环路、c、有效的下一跳(基本条件)
1、优先选择weight最大的
cisco路由器上,本地路由器起源的路由weight为32768,而从其他路由器学习的均为0
(因为weight属性不传播给任何BGP邻居)(假设未作任何策略)
2、优先选择localpreference最高
3、优先选择本路由器起源(nexthop为0.0.0.0)
4、优先选择AS-PATH最短
5、优先选择origincode最小:
i(igp)<
e(egp)<
?
(incomplete)
6、优先选择MED最小
7、优先选择从EBGP邻居学习的路由。
8、优先选择从最近的IGP邻居学习的路由
9、优先选择最老的路由(即最稳定的路由)
10、优先选择从具有最小BGProuterID的邻居学习的路由
11、优先选择从具有最小的接口IP地址bgp邻居学习的路由
就题目来说,我们可以在65002中也可以在65003中配置,只是方向不同而已,这里我们只配置下R2指R1邻居时的命令:
route-mapsf
setas-pathprepend65004定义好路由图和相关策略,然后把这策略应用到路由进程下:
neighbor1.1.1.1route-mapsfout(注意此时65004是出现在65003的右边,而如果应用的是in方向,也就是说在R1上指R2为邻居时,则65004是出现在65003左边的)
五:
ipas-pathaccess-list
Definesanaccesslistbasedonautonomoussystempathinformation.
Syntax:
[no]ipas-pathaccess-listlist-name
{permit|deny}
as-regular-expression
.
list-name
Uniquealpha-numericnamethatidentifiestheregularexpressionaccesslist.Listnamescanbeupto255charactersinlengthandcontainthefollowingcharacters:
A-Z,a-z,0-9,_,and-.Usetheshowipas-path-access-listtodisplaythenamesofalldefinedas-pathaccesslists.
permit
Permitsaccessformatchingconditions.
deny
Deniesaccessformatchingconditions.
Autonomoussystemintheaccesslistthatusesaregularexpression.
Description:
Accesslistsarefiltersthatenableyoutorestricttheroutinginformationarouterlearnsoradvertisestoandfromaneighbor.
MultipleBGPpeersorroutemapscanreferenceasingleaccesslist.Youcanapplyaccessliststobothinboundrouteupdatesandoutboundrouteupdates.Eachrouteupdateispassedthroughtheaccess-list.BGPapplieseachruleintheaccesslistintheorderitappearsinthelist.Whenaroutematchesanyrule,thedecisiontopermittheroutethroughthefilterordenyismade,andnofurtherrulesareprocessed
AccesslistsbasedonautonomoussystempathenableyoutocontrolroutingupdatesbasedonBGPautonomouspathsinformation.Ifyouwanttocontrolupdatesforalltheroutestoorfromanautonomoussystem,filteringbasedonautonomoussystempathismoreefficientthanlistingeachrouteindividually.
Aregularexpressionisapatternusedtomatchagainstaninputstring.InBGP,youcanbuildaregularexpressiontomatchinformationaboutanautonomoussystempath.Regularexpressionscaninclude:
Table5-3.CharactersandComponentsofRegularExpressions
ComponentCharacter
Description
Ranges
Asequenceofcharacterswithinsquarebrackets:
[1234]
Atoms
Asinglecharacterwithspecialmeaning.Atomsinclude:
.
Matchesanysinglecharacter.
^
Matchesthebeginningofaninputstring.
$
Matchestheendofaninputstring.
_(underscore)
Matchesacomma,leftbrace,rightbrace,thebeginningofaninputstring,theendofaninputstring,oraspace.
Pieces
Atomsfollowedbyaspecialcharacterlistedbelow:
Branches
0ormoreconcatenatedpieces.
Thefollowingtableprovidessampleregularexpressions:
Table5-4.SampleRegularExpressions
RegularExpression
^nnn$
Indicatestherouteoriginatedinautonomoussystemnnn.The^meanstheexpressionmuststartwiththenextcharacter.The$meanstheexpressionmustendwiththeprecedingcharacter.
^100$matches:
100
^aaa_bbb$
Theautonomoussystemlistmustcontainbothaaaandbbbwithaaaappearingbeforethebbb.Forexample:
^123_456$matches:
123456
868123999456
^nnn.*nnn$
Theexpressionmustbeginwithaspecificautonomoussystemandendwithaspecificautonomoussystem,butcanhaveanythinginbetween.Forexample:
∙123456
∙123123456
∙^123.*456$(matches:
123123123456)
∙123868999456
∙12341456
_nnn_
Indicatestheroutewasviaautonomoussystemnnn.
^$
Indicatestherouteoriginatedinthisautonomoussystem.
NOTERegularexpressionsarematchedagainsttheautonomoussystempathasifitisastring-notasequenceofnumbers.Encloseautonomoussystemnumberswithinunderscorestomatchaspecificautonomoussystemnumber.
Permitanddenyapplyonlywhenthereisanexactmatchbetweentheregularexpressionandtheautonomoussystempath.
Usetheipas-pathaccesslistcommandtocreateanaccesslisttofilterroutesbasedontheirautonomoussystempath.Addentriestotheaccesslistbyrepeatingthecommandfordifferentautonomoussystempaths.
Usetheneighborormatchas-pathcommandstoapplyanautonomoussystempathbasedaccesslist.
Usethenoipas-pathaccess-listcommandtodeleteanentireautonomoussystempathbasedaccesslist.
Usethenoipas-pathaccess-listlist-name{permit|deny}as-regular-expressiontodeleteaspecificfilterfromanautonomoussystempathaccesslist.
FactoryDefault:
Noaccesslists.
CommandMode:
Configuration.
Example1:
Inthefollowingexample,theipas-pathaccess-listcommandscreateanas-pathaccesslistnamed'
1'
topermitonlythoseroutesthatincludepathsfromorthroughautonomoussystems234and345:
router(config)#ipas-pathaccess-list1permit_234_
router(config)#ipas-pathaccess-list1permit_345_
router(config)#ipas-pathaccess-list1denyany
Notethelastlineoftheaccesslistisadenyanystatementtoremindyourreaderthatallotheraccessisdenied.
Example2:
Inthefollowingexample,theneighborfilter-listcommandspecifiesthatonlypathsfromorthroughautonomoussystems234and345(asspecifiedbyaccesslist1)areadvertisedtoBGPneighbor125.181.1.5andtheweightforthoseroutesissetto30.
router(config)#routerbgp100
router(config-router)#network170.100.0.0.
router(config-router)#neighbor170.100.205.5remote-as234
router(config-router)#neighbor121.180.1.4remote-as345
router(config-router)#neighbor125.181.1.5remote-as171
router(config-router)#neighbor125.181.1.5filter-list1weight30
依题意我们建两个正规表达式来分别匹配AS65003的流量和AS65002的流量,命令如下:
R6上
ipas-pathaccess-list1permit^65002$
ipas-pathaccess-list2permit^65002_65003$然后把这两个正规表达式通过路由应用到进程中
neighbor1.1.1.1route-mapsfin
route-mapsfpermit10
matchas-path1
setweight200
matchas-path2
setweight100
六:
BGP的COMMUNITY
我们同样做一个正规列表来匹配AS65003
neighbor3.3.3.3route-mapsfin
route-mapgopermit10
ipas-pathaccess-list2permit^65002_65003$然后setcommunityno-advertise
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- bgp 综合 实验 答案