CCIE路由实验(4) -- BGP路由控制
1.过滤BGP路由的方法
2.用AS-path filter控制路由
3.用Community Filter控制路由
enable
conf t
no ip do lo
enable pass cisco
line con 0
logg sync
exec-t 0 0
exit
line vty 0 4
pass cisco
logg sync
exit
host
1.过滤BGP路由的方法
--------------------------------------------------------------------------
多种过滤BGP路由的方法:
直接调用前缀列表过滤路由,neighbor x.x.x.x prefix-list xx
用Distribute-list 加前缀或访问控制列表过滤
针对某个邻居:nenighbor x.x.x.x distribute-list + 前缀/访问列表
针对所有邻居:distribute-list + 前缀/访问列表
用route-map过滤,neighbor x.x.x.x route-map
每种过滤的方法都可以用于in和out两个方向。
R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 14.1.1.1 255.255.255.0
no shut
exit
int f2/0
ip add 13.1.1.1 255.255.255.0
no shut
exit
router bgp 100
bgp router-id 11.1.1.1
neighbor 12.1.1.2 remote-as 200
neighbor 13.1.1.3 remote-as 300
neighbor 14.1.1.4 remote-as 400
exit
R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
router bgp 200
bgp router-id 22.1.1.1
neighbor 12.1.1.1 remote-as 100
exit
R3:
int f0/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
router bgp 300
bgp router-id 33.1.1.1
neighbor 13.1.1.1 remote-as 100
exit
R4:
int f0/0
ip add 14.1.1.4 255.255.255.0
no shut
exit
router bgp 400
bgp router-id 44.1.1.1
neighbor 14.1.1.1 remote-as 100
exit
R2:
int l0
ip add 100.1.0.1 255.255.255.0
exit
int l1
ip add 100.1.1.1 255.255.255.0
exit
int l2
ip add 100.1.2.1 255.255.255.0
exit
int l3
ip add 100.1.3.1 255.255.255.0
exit
router bgp 200
network 100.1.0.0 mask 255.255.255.0
network 100.1.1.0 mask 255.255.255.0
network 100.1.2.0 mask 255.255.255.0
network 100.1.3.0 mask 255.255.255.0
exit
R3:
int l0
ip add 100.1.0.1 255.255.255.128
exit
int l1
ip add 100.1.1.1 255.255.255.128
exit
int l2
ip add 100.1.2.1 255.255.255.128
exit
int l3
ip add 100.1.3.1 255.255.255.128
exit
router bgp 300
network 100.1.0.0 mask 255.255.255.128
network 100.1.1.0 mask 255.255.255.128
network 100.1.2.0 mask 255.255.255.128
network 100.1.3.0 mask 255.255.255.128
exit
R4:
int l0
ip add 100.1.0.1 255.255.255.192
exit
int l1
ip add 100.1.1.1 255.255.255.192
exit
int l2
ip add 100.1.2.1 255.255.255.192
exit
int l3
ip add 100.1.3.1 255.255.255.192
exit
router bgp 300
network 100.1.0.0 mask 255.255.255.192
network 100.1.1.0 mask 255.255.255.192
network 100.1.2.0 mask 255.255.255.192
network 100.1.3.0 mask 255.255.255.192
exit
R1:
show ip bgp
-------------------------------------------------------------------
R1:
ip prefix-list yeslab deny 100.1.0.0/22 ge 24 le 24
/22表示要匹配前缀100.1.0.0的前22位,而第23位和24位可以任意值。
当没有配置ge和le,表示掩码长度等于/length
当配置了ge,没有配置le,表示掩码长度大于等于ge-length,小于等于32
当没有配置ge,但配置了le,表示掩码长度大于等于network-length,小于等于le-length
当同时配置了ge和le,表示前缀长度大于等于ge-length,小于等于le-length
router bgp 100
neighbor 12.1.1.2 prefix-list yeslab in
exit
clear ip bgp * soft in
show ip bgp
------------------------------------------------------------------
R1:
router bgp 100
no neighbor 12.1.1.2 prefix-list yeslab in
distribute-list prefix yeslab in
exit
clear ip bgp * soft in
show ip bgp
------------------------------------------------------------------
R1:
access-list 100 deny ip 100.1.0.0 0.0.3.0 host 255.255.255.0
access-list permit ip any any
以上host前面部分匹配前缀,后面部分匹配掩码长度
router bgp 100
no distribute-list prefix yeslab in
distribute-list 100 in
exit
clear ip bgp * soft in
show ip bgp
---------------------------------------------------------------------
R1:
router bgp 100
no distribute-list 100 in
neighbor 12.1.1.2 distribute-list 100 in
exit
clear ip bgp * soft in
show ip bgp
CCIE路由实验(4) -- BGP路由控制的更多相关文章
- CCNP路由实验之七 动态路由之BGP
CCNP路由实验之七 动态路由之BGP 动态路由协议能够自己主动的发现远程网络,仅仅要网络拓扑结构发生了变化,路由器就会相互交换路由信息,不仅能够自己主动获知新添加的网络,还能够在当前网络连接失 ...
- CCNP路由实验之九 路由策略
CCNP路由实验之九 路由策略 路由器在公布与接收路由信息时,可能须要实施一些策略.以便对路由信息进行过滤,比如仅仅接收或公布满足一定条件的路由信息. 一种路由协议可能须要引入其它的路由协议发现 ...
- CCIE路由实验(3) -- BGP高级部分
当一个AS包含多个IBGP对等体时,路由反射器非常有用.因为IBGP客户只需要和路由反射器建立邻居关系,从而降低了IBGP的连接数量.路由反射器和它的客户合称为一个簇.路由反射是克服IBGP水平分割的 ...
- CCIE路由实验(2) -- BGP选路原则
BGP路径属性分为4类: 公认必遵(Well-Known Mandatory):BGP更新报文中必须包含的,且必须被所有BGP厂商实现所能识别的,包括ORIGIN,AS-PATH和Next_Hop 1 ...
- CCNP路由实验(4) -- BGP
基本配置:enableconf tno ip do loenable pass ciscoline con 0logg syncexec-t 0 0line vty 0 4pass ciscologg ...
- CCIE路由实验(5) -- BGP负载均衡
enableconf tno ip do loenable pass ciscoline con 0logg syncexec-t 0 0exitline vty 0 4pass ciscologg ...
- 在ensp上利用单臂路由实验VLAN间路由
我们为什么要设置单臂路由? 因为我们要解决不同vlan,不同网络的PC机间的通信问题~ 那它为啥叫单臂路由嘞? 单臂路由的原理时通过一台路由器,使vlan间互通数据通过路由器进行三层转发,如果在路由器 ...
- CCIE路由实验(7) -- MPLS VPN
1.LDP协议的各种情况2.LDP和BGP交互3.LDP高级部分4.MPLS VPN (RIP和静态)5.MPLS VPN (EIGRP)6.MPLS VPN (OSPF)7.MPLS VPN (EB ...
- HCNP Routing&Switching之BGP路由控制
前文我们了解了BGP的路由属性和优选规则相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15489497.html:今天我们来聊一聊BGP路由控制相关话 ...
随机推荐
- QT太多的内容和模块,怎么办?
我有个问题,QT可以做许多不同的开源项目,而且每个QT新版本都那么内容,感觉学不过来.用不过来那么我们还应该学习和使用其它语言吗? 如果回答,在需要的时候学习,那么这句话意味着,这几年你基本上就局限于 ...
- perl5 第七章 控制结构
第七章 控制结构 by flamephoenix 一.条件判断二.循环: 1.while循环 2.until循环 3.for循环 4.针对列表(数组)每个元素的foreach循环 5. ...
- ajenti试用感受
ajenti试用感受_展现技术动态_百度空间 ajenti试用感受 今天看开源中国介绍一款名为"服务器管理系统"的开源软件发布了,名为ajenti,页面感觉不错,对机器的采集信 ...
- Adobe Flash Player已经终止一项可能不安全的操作,解决方案
http://www.macromedia.com/support/documentation/cn/flashplayer/help/settings_manager04.html
- HDU4099(斐波那契数列与字典树)
题目:Revenge of Fibonacci 题意:给出斐波那契数列的前k位,k不超过40,找出最小的正整数n,满足F(n)的前k位与给定数的前k位相同,斐波那契数列的项数不超过100000. 解析 ...
- js设置奇偶行数样式
$(document).ready(function () { odd = { "background": "none" }; //奇数样式 even = { ...
- 调用AnimateWindow API来实现弹出效果
下面是实例的cs代码 public partial class frm_Main : Form { //使用Windows Api AnimateWindow [DllImport("use ...
- E - Catch That Cow
Description Farmer John has been informed of the location of a fugitive cow and wants to catch her i ...
- 「Foundation」结构体
一.基本知识 Foundation—基础框架.框架中包含了很多开发中常用的数据类型,如结构体,枚举,类等,是其他ios框架的基础. 如果要想使用foundation框架中的数据类型,那么包含它的主头文 ...
- [Swust OJ 771]--奶牛农场(几何题,画图就好)
题目链接:http://acm.swust.edu.cn/problem/771/ Description 将军有一个用栅栏围成的矩形农场和一只奶牛,在农场的一个角落放有一只矩形的箱子,有一天将 ...