Cisco(config)#router bgp 100  //配置BGP进程号

Cisco(config-router)#bgp router-id 1.1.1.1  //配置BGP的router-id

Cisco(config-router)#neighbor 12.1.1.2 remote-as 200  //配置BGP邻居

Cisco(config-router)#neighbor 2.2.2.2 remote 100  //配置IBGP邻居

Cisco(config-router)#neighbor 2.2.2.2 update-source loopback 0  //指定IBGP的更新源

Cisco(config-router)#neighbor 2.2.2.2 next-hop-self  //在AS边界路由器上配置

Cisco(config-router)#neighbor 2.2.2.2 ebgp-multihop 2  //配置EBGP跳数为2

Cisco(config-router)#network 12.1.1.0 mask 255.255.255.0  //宣告有类网络

Cisco(config-router)#auto-summary  //打开自动汇总

Cisco(config-router)#network 12.0.0.0  //宣告无类网络

Cisco#show tcp brief   //查看TCP连接摘要

Cisco#show ip bgp neighbors  //查看BGP邻居

Cisco#show ip bgp summary  //查看BGP邻居摘要信息

Cisco#show ip bgp  //查看BGP表

Cisco(config)#router bgp 100

Cisco(config-router)#neighbor a1 peer-group  //定义peer-group

Cisco(config-router)#neighbor a1 remote-as 200

Cisco(config-router)#neighbor a1 update-source loopback 0

Cisco(config-router)#neighbor a1 next-hop-self  

Cisco(config-router)#neighbor a1 distribute-list 20 out

Cisco(config-router)#neighbor 12.1.1.2 peer-group a1  //引用peer-group

Cisco(config-router)#bgp listen range 1.1.1.0/24 peer-group a1  //使BGP被动侦听1.1.1.0/24网段的BGP连接请求并动态建立BGP对等体

Cisco(config-router)#neighbor 12.1.1.2 password abc123  //配置BGP认证,只支持MD5认证

Cisco#clear ip bgp 12.1.1.2  //硬重置单个邻居

Cisco#clear ip bgp *  //硬重置所有邻居

Cisco#clear ip bgp * soft  //软重置双向的所有邻居

Cisco#clear ip bgp * soft in  //软重置进方向的所有邻居

Cisco#clear ip bgp * soft out  //软重置出方向的所有邻居

Cisco#show ip bgp neighbors 12.1.1.2 received-routes  //从邻居接收到的BGP路由条目

Cisco#show ip bgp neighbors 12.1.1.2 routes  //查看从邻居学到的BGP路由

Cisco#show ip bgp neighbors 12.1.1.2 advertised-routes  //查看发送给邻居的BGP路由条目

Cisco#show ip bgp rib-failure  //查看为加入到RIB的BGP路由以及没有被加载的原因

Cisco#debug ip bgp updates  //查看BGP的update报文

Cisco(config-router)#bgp default local-preference 100  //修改EBP本地优先级,默认是100,越大越优

Cisco(config)#ip bgp-community new-format  //修改community属性的显示方式

Cisco(config)#route-map rm1 permit 10

Cisco(config-route-map)#set community 100:1  //设置community属性值

Cisco(config-router)#neighbor 12.1.1.2 send-community  //发送community属性的值

Cisco(config-route-map)#match community 1  //匹配community属性值

Cisco(config-route-map)#match community 1 exact-match  //匹配community属性值

Cisco(config)#ip community-list 1 permit 100:1  // 匹配community属性为100:1

Cisco(config)#ip community-list 1 permit internet  //匹配所有BGP路由

Cisco(config)#ip community-list standard d1 permit 1  //匹配要删除的community属性值

Cisco(config)#route-map rm1 permit 10

Cisco(config-route-map)#set comm-list d1 delete  //删除该属性

Cisco#show ip community-list

Cisco(config-router)#aggregate-address 172.16.0.0 255.255.0.0  //配置BGP的路由聚合,通告汇总和明细路由

Cisco(config-router)#aggregate-address 172.16.0.0 255.255.0.0 summary-only  //配置BGP的路由聚合,只通告汇总路由,抑制明细路由

Cisco(config-router)# aggregate-address 172.16.0.0 255.255.0.0 summary-only as-set  //配置BGP的路由聚合,只通告汇总路由,抑制明细路由,且继承原有明细路由的AS属性

Cisco(config)#ip prefix-list p1 permit 172.16.1.0/24

Cisco(config)#route-map rm1 permit 10

Cisco(config-route-map)#match ip address prefix-list p1

Cisco(config)#router bgp 100

Cisco(config-router)# aggregate-address 172.16.0.0 255.255.0.0 as-set suppress-map rm1  //配置BGP的路由聚合,只通告汇总路由,抑制特定路由,且继承原有明细路由的AS属性

Cisco(config-router)#neighbor 12.1.1.2 unsuppress-map rm1  //配置BGP的路由聚合时取消对特定路由的抑制

Cisco(config-router)# aggregate-address 172.16.0.0 255.255.0.0 summary-only as-set  

Cisco(config-router)# aggregate-address 172.16.0.0 255.255.0.0 summary-only as-set advertise-map rm1  //配置BGP的路由聚合时只继承特定路由的路径属性

Cisco(config)#route-map rm2 permit 10

Cisco(config-route-map)#set c ommunity 100:1

Cisco(config)#router bgp 100

Cisco(config-router)#aggregate-address 172.16.0.0 255.255.0.0 summary-only as-set attribute-map rm2  //在BGP路由汇总时直接设置路径属性

Cisco(config)#ip as-path access-list 1 permit _100$  //配置as-path访问控制列表,匹配起源于as 100的路由条目

Cisco(config-router)#neighbor 12.1.1.2 filter-list 1 in  //关联as-path访问控制列表到filter-list进行路由过滤

Cisco#show ip bgp regexp xx  //查看BGP表中被正则表达式匹配上的路由

Cisco#show ip as-path-access-list  //查看as-path访问控制列表的配置

Cisco#show ip bgp filter-list 1  //查看BGP中被该filter-list匹配的路由

Cisco(config-router)#neighbor 12.1.1.2 route-reflector-client  //配置路由反射器的客户端

Cisco(config-router)#bgp cluster-id 1.1.1.1  //修改放射器的簇ID

Cisco(config-router)#redistribute ospf 1 match internal external  //将OSPF的内部和外出路由都重发布到BGP

Cisco(config-router)#distribute-list prefix 1 out connected  //将直连路由重分布到BGP时在出方向过滤

Cisco(config)#ip prefix-list 11 permit 11.11.11.0/24

Cisco(config)#route-map rm1 permit 10

Cisco(config-route-map)#set community 100:11

Cisco(config)#router bgp 100

Cisco(config-router)#network 11.11.11.0 mask 255.255.255.0 route-map rm1  //给所有邻居在network时关联执行路由策略

Cisco(config-router)#neighbor 12.1.1.2 route-map rm1 out  //给特定邻居执行路由策略

Cisco(config-router)#$ redistribute ospf 110 route-map rm1 match external internal  //将OSPF的内部和外出路由重发布到BGP时关联路由策略

Cisco(config-router)#bgp confederation identifier 123  //标识BGP联邦号

Cisco(config-router)#bgp confederation peers 234  //配联邦EBGP号

Cisco(config-router)#neighbor 12.1.1.2 weight 1  //修改从特定邻居学到的所有路由的weight值

Cisco(config-router)#bgp default local-preference 100  //修改local-preference值,默认为100

Cisco(config-router)#maximum-paths 2  //修改等价负载均衡路由数量

Cisco(config-router)#maximum-paths ibgp 2