注意:默认路由ip route 0.0.0.0 0.0.0.0 12.1.1.1是不可以作为BGP邻居TCP始发连接的(但回包可以)
要配静态路由:ip route 13.1.1.3 255.255.255.0 12.1.1.1
第三方下一条:多路以太口访问网络会出现。
BGP属性控制(以下面图为例):
route-map commu permit 10
r2(config-route-map)#set community ?
local-AS:小AS范围内
no-advertise 本路由器,不传到别的路由器
no-export 本联邦内
route-map commu permit 20
r2:
router bgp 64512
neighbor 24.1.1.4 route-map commu in
r2:router bgp 64512
neighbor 1.1.1.1 send-community 把属性传递下去(默认不传递)
r1:router bgp 64512
neighbor 3.3.3.3 send-community(不管属性本身是否具有传递性质,如果要传,首先都要send-community)
route-map commu permit 10
no set community
set community ? (从400到100的路由)
<1-4294...> community number (32bit)(作用相当于tag)
aa:nn (16bit:16bit)
set community 400:100(这个默认会传递出去,不用额外命令)
sh route-map
community 26214500(前16位:后16位叠加--不是相加)
(config)#ip bgp-community new-format
community 400:100
r5(config-router)#aggregate-address 172.16.4.0 255.255.252.0 summary-only(只发汇总路由出去,明细路由被抑制) as-set(把所有明细属性记录下来,防止路又返回路由始发点--虽然还是会发回去,但是因为有as path防环机制,所以始发路由器不接收--EBGP的防环机制的一种)
suppress-map--调用route-map,可以抑制想要的路由条目
unsuppress-map--针对某邻居不抑制
r1(config-router)#neighbor 14.1.1.4 unsuppress-map route-map名称
advertise-map 只产生匹配路由的聚合,如果该匹配路由消失,那么对整个网段的aggregate都会消失
aggregate-address 172.16.4.0 255.255.252.0 as-set advertise-map AAA
这时4/5/6/7网段都会被聚合成4.0/22,如果这时5.0消失了,那么聚合不起作用,则4/6/7网段/24位路由发出去
选路:
1:weight
2:l-p
3:next hop
4:as-path
5:起源代码
增加AS-PATH:
r1:route-map as
set as-path prepend 600 700
router bgp 100
nei 13.1.1.3 route-map as in
as-path:r1上看
策略r1 in 600 700
600 700 300 500 i
策略r3 out 600 700
300 600 700 500 i
如果设了入接口的策略,那么在原来该有的as-path顺序不变的基础上网前加上属性。
如果设了出方向的策略,那么as-path属性先加上策略在把自己的AS号加上发出去。
修改起源代码:做了相同as-path数目后。
r1(config)#route-map ori
set origin incomplete(未知)
router bgp 100
nei 12.1.1.2 route-map ori in
peer group:
router bgp 200
neighbor aaa(peer-group name) peer-group
neighbor aaa update-source lo 0
neighbor aaa remote-as 200
neighbor aaa route-reflector-client
neighbor 2.2.2.2 peer-group aaa(调用)
neighbor 3.3.3.3 peer-group aaa
本地优先级:(只能本AS或者联邦内传递)
route-map local-p
set local-preference 200(默认100)
router bgp 200
nei 12.1.1.1 route-map local-p in(要影响所有本AS的路由器,所以在边界的IN方向做)
clear ip bgp * s
weight值,只对本路由器有效而且cisco only
MED主要影响别人选路(如果从ibgp学来默认不传出本AS;EBGP就一定会传):
down邻居:neighbor 12.1.1.2 shutdown
起用:no neighbor 12.1.1.2 shutdown
r2:ip prefex-list med permit 4.4.4.0/24
route-map med
match ip add prefix-list med
set metric 200
router bgp 200
nei 12.1.1.1 route-map med out
r3:ip prefex-list med permit 4.4.4.0/24
route-map med
match ip add prefix-list med
set metric 300
router bgp 200
nei 13.1.1.1 route-map med out
metric为空时cisco理由器默认值为0,为最佳选路,但对华为等不一定。
router bgp 100
bgp bestpath med missing-as-worst
这时认为空的MED为最坏选路
ping: icmp echo请求->icmp echo-reply回复,有去有回
traceroute tt1=1 ttl=2,然后记录美一跳回包的ip
LAB8:
Confederation(联邦)/(community)(减少IBGP连接的数量)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AS65012内部运行的IGP是RIP.
Step1:子AS内的IGP是RIP
整个AS123都运行IGP
Step2:启动子系统的BGP
router bgp 65012
bgp router-id 120.0.0.X
router bgp 65003
Step3:
R1/R2/R3#指定自己是属于AS123这个联邦/Confederation
R1/2/3#bgp confederation identifier 123
Step4:在两个联邦子AS相邻的边缘路由器R1/R3上,互相指定对方的子AS号:
R1(config-router)#bgp confederation peers 65003
R3(config-router)#bgp confederation peers 65012
Step5:在联邦中,互指定BGP邻居
R3-R5
R5#neighbor 35.0.0.3 remot-as 123
R3#neighbor 35.0.0.3 remot-as 150
构建R2-R4之间的EBGP:
R2(config-router)#neighbor 24.0.0.4 remote-as 140
R4(config-router)#neighbor 24.0.0.2 remote-as 123
提醒:
在联邦以外的EBGP邻居,他们能查看到的是联邦的大AS号,而不是子AS号。
r1-r3的联邦EBGP:(联邦子AS间有IGP)
R3#
R3#neighbor 1.1.1.1 remote-as 65012
R3#neighbor 1.1.1.1 update-source loopback 3
R3#neighbor 1.1.1.1 ebgp-multihop
R1#neighbor 3.3.3.3 remote-as 65003
R1#neighbor 3.3.3.3 update-source loopback 1
R1#neighbor 3.3.3.3 ebgp-multihop
R1-R2的联邦IBGP
R1#neighbor 2.2.2.2 remote-as 65012
R1#neighbor 2.2.2.2 update-source loopback 1
R1#neighbor 1.1.1.1 remote-as 65012
R1#neighbor 1.1.1.1 update-source loopback 2
Step6:宣告BGP路由:
R5# 105.0.0.5/16
R4# 104.0.0.4/24
Step7:联邦EBGP和普通EBGP的异同点(105.0.0.0/16)
下一跳:(不同点)
在联邦的子AS中,所有路由器看到的BGP的下一跳
都是相邻大AS的边缘节点,而不是本联邦内子AS的下一跳
这是区别于普通EBGP的。
联邦EBGP,不会改变BGP下一跳特性。
同步:(相同点)
联邦EBGP和普通EBGP一样,无需考察同步问题
Step8:联邦内的IBGP:(R1-R2)(104.0.0.0/24)
下一跳:同STEP7
同步:(相同点)
原因是R1从联邦IBGP R2 学到的路由,默认要检查同步
但现在R1不可能通过RIP学到此BGP的路由
解决办法:
R1#no synchronization
LAB9:community/团体
(相当于一种BGP路由的标识位,常用于标识这条BGP路由应该传播的范围)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
R4#
增加104.0.0.0/24 传到R2就不在往前传
104.0.1.0/24 传到R1就不在往前传
104.0.2.0/24 传到R3就不在往前传
104.0.3.0/24
并NETWORK到BGP进程中去。
Step1:通过ACL/prefix-list,定义出/抓出特定的BGP路由:
ip prefix-list B-0 seq 5 permit 104.0.0.0/24(permit:表示匹配)
ip prefix-list B-1 seq 5 permit 104.1.0.0/24
ip prefix-list B-2 seq 5 permit 104.2.0.0/24
Step2:通过Route-map,设定每类路由的COMMUNITY种类:
route-map T-R2 permit 10
match ip address prefix-list B-0
set community no advertise(do not advertise to any BGP peer)
route-map T-R2 permit 20
match ip address prefix-list B-1
set community local-as (do not send outside local-AS 联邦的子AS/小AS)
route-map T-R2 permit 30
match ip address prefix-list B-2
set community no-export (do not export to next 大AS)
route-map T-R2 permit 40
(空的route-map:Match any,Set Nothing!)(Internet)
Step3:在R4上,对R2的BGP路由策略发生,“出方向”的改变:
R4(config-router)#neighor 24.0.0.2 route-map T-R2 out
step4:每个BGP路由器,将community发送给下一个BGP路由器
R4#neighbor 24.0.0.2 send-community
R2#neighbor 1.1.1.1 send-community
R1#neighbor 3.3.3.3 send-community
R2#show ip bgp community
R5#show ip bgp community
show ip bgp community no-advertise
show ip bgp community local-AS
show ip bgp community no-export
Step5:如果没有:“router-map T-R2 permit 40”
R4向R2通告的bgp路由只有3条:
R4#show ip bgp neighbor 24.0.0.2 advertisedp-routes
*> 104.0.0.0/16
*> 104.1.0.0/16
*> 104.2.0.0/16
BGP路由过滤的方法之一.
BGP Summarization
LAB1:非专业汇总(network命令,是不需要宣告明细路由的.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Step1:手工生成一条需要汇总的,静态的,空接口路由:
R4(config)#ip route 104.0.0.0 255.255.252.0 null 0
Step2:将上述汇总的/22的路由,宣告到BGP进程中:
R4(config)#router bgp 140
R4(config-router)#network 104.0.0.0 mask 255.255.252.0
在R5上,可以查看到明细路由/汇总路由,
实际上,明细路由是不需要的:
Step3:删除原宣告到BGP的明细路由:
(使用network命令做BGP汇总,是不需要宣告明细路由的)
R4(config-router)#router bgp 140
R4(config-router)#no network 104.0.0.0 mask 255.255.0.0
R4(config-router)#no network 104.1.0.0 mask 255.255.0.0
R4(config-router)#no network 104.2.0.0 mask 255.255.0.0
R4(config-router)#no network 104.3.0.0 mask 255.255.0.0
Step4:实现BGP路由汇总:
R5#show ip bgp
*>104.0.0.0/22
Step5:如果
no ip route 104.0.0.0 255.255.252.0 null 0
∵BGP进程,在路由宣告前,
会检查路由表,如果能够查到汇总路由,
才会将此汇总路由宣告到BGP进程中.
∴
R4(config)#ip route 104.0.0.0 255.255.252.0 null 0(空接口)
也可以由IGP,自动/手工的汇总生成,
LAB2:专业汇总(推荐方法)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Step0:删除原表态的,/22汇总路由
Step1:宣告准确的明细路由:
R4(config)#router bgp 140
R4(config-router)#network 104.0.0.0 mask 255.255.0.0
R4(config-router)#network 104.1.0.0 mask 255.255.0.0
R4(config-router)#network 104.2.0.0 mask 255.255.0.0
R4(config-router)#network 104.3.0.0 mask 255.255.0.0
不要使用network命令,宣告汇总路由:
R4(config-router)#no network 104.0.0.0 mask 255.255.252.0
Step2:使用aggregate-address命令,实现BGP路由的汇总:
是不需要事先配置汇总路由的.自动生成
R4(config-router)#aggregate-address 104.0.0.0 255.255.252.0
此时的所在的BGP路由器上,都接收到了明细和汇总的路由:
Step3:为了不让明细路由传播出去,调用"summary-only":
R4(config-router)#
aggregate-address 104.0.0.0 255.252.0.0 summary-only
此时的R4,抑制了所有的明细路由,只发送了汇总路由给R2,实现了BGP路由的汇总。
R4#show ip bgp
*> 104.0.0.0/22 (*:valid)
S> 104.0.0.0/24 (s:suppressed)
S> 104.0.1.0/24
S> 104.0.2.0/24
S> 104.0.3.0/24
Step4:R4的BGP进程,自动生成了一条用于汇总的空接口路由
- 1.7-BGP⑥
BGP中的路由控制/过滤: LAB1:Distribute-list调用ACL(较落后) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Step1:通过ACL定义 ...
- 1.7-BGP⑤
BGP Attributes/BGP属性 (通过BGP的属性,实现对BGP路由的选择/操纵) BGP Route Selection/BGP的选路原则: 1: The BGP forwarding t ...
- 1.7-BGP③
IBGP的水平分隔原则(Split Horizon Rule): IBGP的水平分割原则:by default,routes learned via IBGP are never propagated ...
- 1.7-BGP②
BGP的更新源(BGP Neighbor Update Source Address): 原则1: 在默认情况下, BGP路由器以自己路由表中,到达对方BGP邻居的地址的那条路由所指示的出接口(物理接 ...
- 1.7-BGP①
IGP: 包括RIP/EIGRP/OSPF/ISIS/ODR等动态路由协议 运行在同一个AS中, 通过Cost/Metirc来判断路由的优劣(越小越好): AS:自治系统(小) A ...
- BGP路由协议详解(完整篇)
原文链接:http://xuanbo.blog.51cto.com/499334/465596/ 2010-12-27 12:02:45 上个月我写一篇关于BGP协议的博文,曾许诺过要完善这个文档,但 ...
- 边界网关协议BGP
Border Gateway Protocol (BGP) is a standardized exterior gateway protocol designed to exchange routi ...
- 1.4-动态路由协议OSPF④
多区域的OSPF: 划分多区域的主要目的: 1.减少每个区域中的路由条目,进而减少每个路由器的内存中的路由,及其内存消耗,提高转发效率. 2.因为每一个OSPF区域对应在一个OSPF LSDB,配合在 ...
- BGP MPLS IP V匹N基本概念
BGP/MPLS IP VPN基本概念 Site 在介绍VPN时经常会提到"Site",Site(站点)的含义可以从下述几个方面理解: · Site是指相互之间具备IP连通性的一组 ...
随机推荐
- 基于Web的Kafka管理器工具之Kafka-manager的编译部署详细安装 (支持kafka0.8、0.9和0.10以后版本)(图文详解)(默认端口或任意自定义端口)
不多说,直接上干货! 至于为什么,要写这篇博客以及安装Kafka-manager? 问题详情 无奈于,在kafka里没有一个较好自带的web ui.启动后无法观看,并且不友好.所以,需安装一个第三方的 ...
- C#基础 函数部分
函数:能够独立完成某项功能的模块. 函数四要素:输入.输出.函数体.函数名 函数定义: (static/public) 返回类型 函数名(参数类型 参数名,参数类型 参数名){ 函数体} 函数的调用: ...
- php函数的声明与使用
function 函数名(){ 函数体 } 一个函数是由3部分组成:声明(function 关键字).函数名(用来找到函数体的).函数体(封装的代码) 2.函数的优越性 代码重用性强.维护方便.提高开 ...
- 实现div左右上下都居中
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- hihocoder1365 图片排版
思路: 模拟,枚举,dp. 参考了https://github.com/buptlxb/hihoCoder/blob/master/solutions/1365/picture_arrange.cpp ...
- 引入css的四种方式
1.内联式引用:直接用在标签上,但维护成本高 style='font-size:16px;color:#000000' 2.外部连接式引用:css代码与html代码分离,便于代码重复使用 <li ...
- 如何利用sql注入进行爆库
SQL注入能做什么 在<SQL注入基础>一文介绍了SQL注入的基本原理和实验方法,那接下来就要问一下,SQL注入到底能什么? 估计很多朋友会这样认为:利用SQL注入最多只能获取当前表中的所 ...
- ThinkPHP---thinkphp框架介绍
目录: (1)简述: (2)下载: (3)文件结构: (4)部署: (5)细节问题: 主体: (1)简述 ThinkPHP诞生于2006年初,最初叫FSC.于2007年元旦更名为PHP,同时官网上线. ...
- 微服务网关从零搭建——(六)ocelot配置追踪功能
butterfly 准备工作 首先下载buterfly release版本 解压并通过命令启动:dotnet Butterfly.Web.dll --EnableHttpCollector=true ...
- error: Bean property 'userDAO' is not writable or has an invalid setter method.
使用Spring属性注入的方式,没有在ServiceImpl中setDao,导致程序报错 public class AddressServiceImpl implements IAddressServ ...