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路由控制相关话 ...
随机推荐
- php 实现简单的登录
//登录页面: V层前端模板: Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp/Home/Tpl/Login $ ls inde ...
- http://qt-project.org/wiki/Category:Developing_with_Qt::QtWebKit#ff7c0fcd6a31e735a61c001f75426961
404: Not Found | Qt Project QtWebKit documentation http://dwz.cn/hr2013
- CSS3媒体查询(Media Queries)
媒体类型: all 所有设备 screen 电脑显示器 handheld 便携设备 tv 电视类型设备 print 打印用纸打印预览视图 关键字 and not(排除某种设备) only(限定某种设备 ...
- H面试程序(27):字串转换
//1 字串转换 //问题描述: //将输入的字符串(字符串仅包含小写字母‘a’到‘z’),按照如下规则,循环转换后输出:a->b,b->c,…,y->z,z->a: //若输 ...
- 浅谈PHP技术应用
序号:1210-41 黑龙江省高等教育自学考试 本科毕业论文 题 目 浅谈PHP技术 学员姓名 夏滟 专 业 计算机及应用 准考证号 010311192585 指导 ...
- java多线程之yield()方法详解
yiled()方法的作用是放弃当前CPU的资源,将资源让给其它线程,但放弃的时间不确定,有可能刚刚放弃,又马上获得了CPU时间片.下面看一个小例子,看一下具体效果. public stati ...
- 二十三种设计模式及其python实现
本文源码寄方于github:https://github.com/w392807287/Design_pattern_of_python 参考文献: <大话设计模式>——吴强 <Py ...
- mysql 添加用户并授权(记录)
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost IDENTIFIED BY 'something' WITH GRANT OPTION ...
- python中os.walk浏览目录和文件
#!/usr/bin/env python # 2.py # use UTF-8 # Python 3.3.0 # os.walk()的使用 import os # 枚举dirPath目录下的所有文件 ...
- [LeetCode]题解(python):009-Palindrome Number
题目来源: https://leetcode.com/problems/palindrome-number/ 题意分析: 这题是要判断一个int是否一个回文数,要求不能申请额外的空间. 题目思路: 这 ...