CCNP路由实验之九 路由策略

路由器在公布与接收路由信息时,可能须要实施一些策略。以便对路由信息进行过滤,比如仅仅接收或公布满足一定条件的路由信息。

一种路由协议可能须要引入其它的路由协议发现的路由信息,路由器在引入其它路由协议的路由信息时,可能仅仅须要引入一部分满足条件的路由信息,并控制所引入的路由信息的某些属性。以使其满足本协议的要求。

路由策略就是为了改变网络流量所经过的途径而改动路由信息的技术,主要通过改变路由属性(包含可达性)来实现,路由策略是控制层面的行为。操作的对象是路由条目。匹配的是路由。详细是指目标网段、掩码、下一跳、度量值、Tag、Community、AS-PATH等。实现路由策略的方法有几种:

  1. 改动管理距离AD。即是浮动路由。

  2. Offset-list结合訪问控制列表可改动偏移量,仅支持路由矢量协议(RIP、EIGRP),用于调整Metric值。须要结合ACL使用

  3. passive-interface 被动接口。对于RIP、IGRP协议仅仅是禁止转发路由信息。但没有禁止接收;EIGRP、OSPF、ISIS是既不接收也不发送路由信息

  4. Distribute-list,分发列表是用于控制路由更新的一个工具,仅仅能过滤路由信息,不能过滤LSA。因此分发列表在距离矢量(RIP、EIGRP)路由协议中使用。不管是in或者是out方向。都能正常的过滤路由。

    R1(config-router)#offset-list2 out 1888256 e1/0 //设置通告出去的路由metric加入1888256

    R2#conf t

    R2(config)#access-list1 permit any //标记不论什么网络

    R2(config-if)#routerrip

    R2(config-router)#offset-list1 out 4 //不论什么网络通告出处都添加4跳

    再次查看R1和R2变化,居然实现了负载均衡

    R1#sh iprou

    Codes: C- connected, S - static, R - RIP, M - mobile, B - BGP

    D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area

    N1 - OSPF NSSA external type 1, N2 -OSPF NSSA external type 2

    E1 - OSPF external type 1, E2 - OSPFexternal type 2

    i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2

    ia - IS-IS inter area, * - candidatedefault, U - per-user static route

    o - ODR, P - periodic downloaded staticroute

    Gatewayof last resort is 21.21.21.21 to network 0.0.0.0

    1.0.0.0/24 is subnetted, 1 subnets

    C       1.1.1.0 is directly connected, Loopback0

    2.0.0.0/24 is subnetted, 1 subnets

    D       2.2.2.0 [90/409600] via 192.168.11.2,00:19:11, Ethernet1/0

    21.0.0.0/24 is subnetted, 1 subnets

    D       21.21.21.0[90/2297856] via 192.168.11.2, 00:19:11, Ethernet1/0

    [90/2297856] via 192.168.10.2, 00:19:11, Serial0/0

    C    192.168.10.0/24 is directly connected,Serial0/0

    C    192.168.11.0/24 is directly connected,Ethernet1/0

    22.0.0.0/24 is subnetted, 1 subnets

    D       22.22.22.0[90/2297856] via 192.168.11.2, 00:19:13, Ethernet1/0

    [90/2297856] via 192.168.10.2, 00:19:13, Serial0/0

    S*   0.0.0.0/0 [130/0] via 21.21.21.21

    R3#sh iprou

    Codes: C- connected, S - static, R - RIP, M - mobile, B - BGP

    D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area

    N1 - OSPF NSSA external type 1, N2 -OSPF NSSA external type 2

    E1 - OSPF external type 1, E2 - OSPFexternal type 2

    i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2

    ia - IS-IS inter area, * - candidatedefault, U - per-user static route

    o - ODR, P - periodic downloaded staticroute

    Gatewayof last resort is not set

    3.0.0.0/24 is subnetted, 1 subnets

    C       3.3.3.0 is directly connected, Loopback0

    23.0.0.0/24 is subnetted, 1 subnets

    R       23.23.23.0 [120/1] via 192.168.23.2,00:00:49, Ethernet0/0

    C    192.168.23.0/24 is directly connected,Ethernet0/0

    R3#sh iprou

    Codes: C- connected, S - static, R - RIP, M - mobile, B - BGP

    D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area

    N1 - OSPF NSSA external type 1, N2 -OSPF NSSA external type 2

    E1 - OSPF external type 1, E2 - OSPFexternal type 2

    i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2

    ia - IS-IS inter area, * - candidatedefault, U - per-user static route

    o - ODR, P - periodic downloaded staticroute

    Gatewayof last resort is not set

    1.0.0.0/24 is subnetted, 1 subnets

    R       1.1.1.0 [120/8] via 192.168.23.2,00:00:08, Ethernet0/0

    2.0.0.0/24 is subnetted, 1 subnets

    R       2.2.2.0 [120/8] via 192.168.23.2,00:00:08, Ethernet0/0

    3.0.0.0/24 is subnetted, 1 subnets

    C       3.3.3.0 is directly connected, Loopback0

    21.0.0.0/24 is subnetted, 1 subnets

    R       21.21.21.0 [120/8] via 192.168.23.2,00:00:08, Ethernet0/0

    R    192.168.10.0/24 [120/8] via 192.168.23.2,00:00:08, Ethernet0/0

    23.0.0.0/24 is subnetted, 1 subnets

    R       23.23.23.0 [120/5] via 192.168.23.2,00:00:09, Ethernet0/0

    R    192.168.11.0/24 [120/8] via 192.168.23.2,00:00:09, Ethernet0/0

    22.0.0.0/24 is subnetted, 1 subnets

    R       22.22.22.0 [120/8] via 192.168.23.2,00:00:11, Ethernet0/0

    C    192.168.23.0/24 is directly connected,Ethernet0/0

    offset指的是偏移量。偏移量就是说相对的差。偏移量列表能够用来改变路由的度量值,已达到某些目的(如做备份链路或者负载均衡)。

    注意:

    1. 假设不指定接口,则对于该路由出站或入站时全部接口都会应用偏移量列表。

    2. 假设不指定訪问列表(用訪问列表0)。则全部路由条目都会被改动。

    3. 在RIP中offset为跳数,在别的路由选择协议就是相相应的metric值了。

    4. 当一个offset-list引起吓一跳路由器通告的度量值比它正在通告的路由更新的度量值更高时。直到holddown timer 超时才会接受。之前会被标记为不可达。

    5. 注意在应用訪问列表时的规则。不要出现路由漏洞。

    实验三、passive-interface

    R1配置:

    R1#conf t

    R1(config)#intlo0

    R1(config-if)#ipadd 1.1.1.1 255.255.255.0

    R1(config-if)#exit

    R1(config)#inte0/0

    R1(config-if)#ipadd 192.168.12.1 255.255.255.0

    R1(config-if)#nosh

    R1(config-if)#exit

    R1(config)#routerrip

    R1(config-router)#noau

    R1(config-router)#ver2

    R1(config-router)#net1.1.1.0

    R1(config-router)#net192.168.12.0

    R1(config-router)#exit

    R2配置:

    R2#conf t

    R2(config)#intlo0

    R2(config-if)#ipadd 2.2.2.2 255.255.255.0

    R2(config-if)#nosh

    R2(config-if)#exit

    R2(config)#intl1

    R2(config-if)#ipadd 22.22.22.22 255.255.255.0

    R2(config-if)#exit

    R2(config)#inte0/0

    R2(config-if)#ipadd 192.168.12.2 255.255.255.0

    R2(config-if)#nosh

    R2(config-if)#exit

    R2(config)#inte0/1

    R2(config-if)#ipadd 192.168.23.2 255.255.255.0

    R2(config-if)#nosh

    R2(config-if)#exit

    R2(config)#routerrip

    R2(config-router)#noau

    R2(config-router)#ver2

    R2(config-router)#net2.2.2.0

    R2(config-router)#net192.168.12.0

    R2(config-router)#exit

    R2(config)#routerospf 1

    R2(config-router)#net192.168.23.0 255.255.255.0 area 0

    R2(config-router)#net22.22.22.0 255.255.255.0 area 0

    R2(config-router)#exit

    R3配置:

    R3#conf t

    R3(config)#intlo0

    R3(config-if)#ipadd 3.3.3.3 255.255.255.0

    R3(config-if)#exit

    R3(config)#inte0/0

    R3(config-if)#ipadd 192.168.23.3 255.255.255.0

    R3(config-if)#nosh

    R3(config-if)#exit

    R3(config)#routerospf 1

    R3(config-router)#net3.3.3.0 255.255.255.0 area 0

    R3(config-router)#net192.168.23.0 255.255.255.0 area 0

    R3(config-router)#exit

    查看R1与R3的路由表:

    R1#sh iprou

    Codes: C- connected, S - static, R - RIP, M - mobile, B - BGP

    D - EIGRP, EX - EIGRP external, O -OSPF, IA - OSPF inter area

    N1 - OSPF NSSA external type 1, N2 -OSPF NSSA external type 2

    E1 - OSPF external type 1, E2 - OSPFexternal type 2

    i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2

    ia - IS-IS inter area, * - candidatedefault, U - per-user static route

    o - ODR, P - periodic downloaded staticroute

    Gatewayof last resort is not set

    C    192.168.12.0/24 is directly connected,Ethernet0/0

    1.0.0.0/24 is subnetted, 1 subnets

    C       1.1.1.0 is directly connected, Loopback0

    2.0.0.0/24 is subnetted, 1 subnets

    R      2.2.2.0 [120/1] via 192.168.12.2, 00:00:06, Ethernet0/0

    R2#sh ip rou

    Codes: C - connected, S - static, R - RIP, M- mobile, B - BGP

    D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

    N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

    E1 - OSPF external type 1, E2 - OSPF external type 2

    i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

    ia - IS-IS inter area, * - candidate default, U - per-user static route

    o - ODR, P - periodic downloaded static route

    Gateway of last resort is not set

    C    192.168.12.0/24is directly connected, Ethernet0/0

    1.0.0.0/24 is subnetted, 1 subnets

    R      1.1.1.0 [120/1] via 192.168.12.1, 00:00:03, Ethernet0/0

    2.0.0.0/24 is subnetted, 1 subnets

    C      2.2.2.0 is directly connected, Loopback0

    3.0.0.0/32 is subnetted, 1 subnets

    O      3.3.3.3 [110/11] via 192.168.23.3, 00:00:03, Ethernet0/1

    22.0.0.0/24 is subnetted, 1 subnets

    C      22.22.22.0 is directly connected, Loopback1

    C   192.168.23.0/24 is directly connected, Ethernet0/1

    R3#sh ip rou

    Codes: C - connected, S - static, R - RIP, M- mobile, B - BGP

    D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

    N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

    E1 - OSPF external type 1, E2 - OSPF external type 2

    i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

    ia - IS-IS inter area, * - candidate default, U - per-user static route

    o - ODR, P - periodic downloaded static route

    Gateway of last resort is not set

    3.0.0.0/24is subnetted, 1 subnets

    C      3.3.3.0 is directly connected, Loopback0

    22.0.0.0/32 is subnetted, 1 subnets

    O      22.22.22.22 [110/11] via 192.168.23.2, 00:05:04, Ethernet0/0

    C   192.168.23.0/24 is directly connected, Ethernet0/0

    以下进行例如以下改动:

    R1#conf t

    R1(config)#router rip

    R1(config-router)#passive-interface e0/0

    R3#conf t

    R3(config)#router ospf 1

    R3(config-router)#passive-interface e0/0

    再次查看路由表:

    R1#sh ip rou 的位表示必须与路由条目匹配,反掩码为1的位表示无需匹配。但使用訪问控制列表来过滤路由的话,不能匹配路由的掩码长度

  5. 、支持TAG的路由协议RIPv2,EIGRP,IS-IS,OSPF,BGP

     

CCNP路由实验之九 路由策略的更多相关文章

  1. CCNP路由实验之七 动态路由之BGP

     CCNP路由实验之七 动态路由之BGP 动态路由协议能够自己主动的发现远程网络,仅仅要网络拓扑结构发生了变化,路由器就会相互交换路由信息,不仅能够自己主动获知新添加的网络,还能够在当前网络连接失 ...

  2. 在ensp上利用单臂路由实验VLAN间路由

    我们为什么要设置单臂路由? 因为我们要解决不同vlan,不同网络的PC机间的通信问题~ 那它为啥叫单臂路由嘞? 单臂路由的原理时通过一台路由器,使vlan间互通数据通过路由器进行三层转发,如果在路由器 ...

  3. CCIE路由实验(4) -- BGP路由控制

    1.过滤BGP路由的方法2.用AS-path filter控制路由3.用Community Filter控制路由 enableconf tno ip do loenable pass ciscolin ...

  4. CCNP路由实验之八 路由重公布

     CCNP路由实验之八 路由重公布 在前面几个实验,已经学习了静态路由和动态路由.如今,我们要掌握怎样使它们在一个网络中融合,即路由重公布. 使用出站口作为静态路由 0 使用下一跳地址作为静态路由 ...

  5. CCNP路由实验之六 动态路由协议之IS-IS

     CCNP路由实验之六动态路由协议之IS-IS 动态路由协议能够自己主动的发现远程网络.仅仅要网络拓扑结构发生了变化.路由器就会相互交换路由信息,不仅能够自己主动获知新添加的网络.还能够在当前网络 ...

  6. CCNP路由实验之十 组播(多播)

                        CCNP路由实验之十 组播(多播) 种方法: 在交换机上配置静态的多播MAC地址到用户接口的映射 使用CGMP.执行CGMP的多播路由器能够将用户发送给自己 ...

  7. CCNP路由实验之十五 NAT(网络地址转换)

     CCNP路由实验之十五 NAT(网络地址转换) 众所周知,要让自己的电脑连上Internet,必须要到运营商(ISP)申请一个上网账号,依据此账号申请自己的宽频业务(拨号上网.商业固定IP等等) ...

  8. CCNP之静态路由实验报告

                   静态路由实验报告 一.实验要求: 1.内网IP基于172.16.0.0/16自行子网划分 2.除了R2--R4路由器各有两个环回接口 3.R1下的PC自动获取IP地址 4 ...

  9. CCIE路由实验(3) -- BGP高级部分

    当一个AS包含多个IBGP对等体时,路由反射器非常有用.因为IBGP客户只需要和路由反射器建立邻居关系,从而降低了IBGP的连接数量.路由反射器和它的客户合称为一个簇.路由反射是克服IBGP水平分割的 ...

随机推荐

  1. Python数据分析前提-----pandas

    1.read_csv(url):读取数据 2.help(read_csv):打印函数相关用法 3.数据名.dtypes:读取数据的类型(int.float……) 4.type(数据名):读取所有数据的 ...

  2. django-数据库的查询集

    1.curd(增删改查) 对于数据库,作为一名开发人员并不会感到陌生,那么数据库中的查询集是怎么一回事呢? 2.数据库的查询集 查询集这个概念存在django框架中,存在于ORM(object rel ...

  3. bzoj2333 [SCOI2011]棘手的操作(洛谷3273)

    题目描述 有N个节点,标号从1到N,这N个节点一开始相互不连通.第i个节点的初始权值为a[i],接下来有如下一些操作:U x y: 加一条边,连接第x个节点和第y个节点A1 x v: 将第x个节点的权 ...

  4. POJ 1821 Fence(单调队列优化DP)

    题解 以前做过很多单调队列优化DP的题. 这个题有一点不同是对于有的状态可以转移,有的状态不能转移. 然后一堆边界和注意点.导致写起来就很难受. 然后状态也比较难定义. dp[i][j]代表前i个人涂 ...

  5. Mac安装软件时,提示文件已损坏,需要移动到废纸篓的解决方法

    1.修改系统偏好设置,安全性与隐私-->将“允许从以下位置下载的应用” ☑️任何来源. 2. mac10.12以上的系统一般没有“任何来源”这个选项,需打开terminnal终端,输入 sudo ...

  6. CAD二次开发(02)-添加对象到模型空间

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  7. git checkout -b 报错

    有时候在git中checkout -b 出现如下报错 $ git checkout -b test --track origin/master fatal: Cannot update paths a ...

  8. 走进Java(一)J2SE

    一.Java是什么 Java是Java语言和Java平台的总称.Java语言和C#一样.核心都是oo.并且比較而言,Java做的更好. Java由四方面组成:         • Java编程语言,即 ...

  9. [ML] Daily Portfolio Statistics

    Let's you have $10000, and you inverst 4 stocks. ['SPY', 'IBM', 'XOM', 'GOOG']. The allocation is [0 ...

  10. bzoj1005: [HNOI2008]明明的烦恼(prufer+高精度)

    1005: [HNOI2008]明明的烦恼 题目:传送门 题解: 毒瘤题啊天~ 其实思考的过程还是比较简单的... 首先当然还是要了解好prufer序列的基本性质啦 那么和1211大体一致,主要还是利 ...