CCNP路由实验之九 路由策略

CCNP课程实验-04-BGP_CFG OSPF重分布进eigrp的时候,默认的metric值无穷大,导致路由无效,因此需要特别指定引入的路由的metric计算值。而24,25,26三条路由被镇压。变动的位数是最后的2位,固定不变的高6位的值为:24,因此聚合的路由就为:192.168.24.0/22。所有路由器都有一个Loopback 0接口,地址格式为:X.X.X.X/32,其中X为路由器编号。R1/R4/R6之间的网段为:172.8.146.X/24,其中X为路由器编号。例如:R3-R5之间的AB为35,X为路由器编号,例如R3的X=3。 阅读详情


                                                                             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方向,都能正常的过滤路由。但对于链路状态协议(ospf、isis),,路由器之间传递的消息不再是路由信息了,而是LSA,而分发列表是无法对LSA进行过滤的。需要结合ACL使用

  5. prefix-list,前缀列表过滤抓取路由必须要连续。有点类似ACL,但是Prefix-list不能用于数据包的过滤。它能同时匹配前缀号和前缀长度,解决ACL不能区分相同前缀、不同掩码的路由的问题。可结合Route-map使用

  6. Route-map,叫做路由图或者路由映射表,是对路由进行加工处理的工具

     

路由策略的作用:

  1. 防止路由器选择非最佳路由

  2. 防止路由回馈—被重分发的路由又重新分配回来

  3. 可以控制那些路由重分配,那些路由不被重新分配

  4. 用路由过滤器见啦路由防火墙

 

 

 

实验一、修改管理距离AD

R1配置:

R1#conf t

R1(config-if)#ip add 1.1.1.1 255.255.255.0

R1(config-if)#exit

R1(config)#int e0/0

R1(config-if)#ip add 192.168.12.1255.255.255.0

R1(config-if)#no sh

R1(config-if)#exit

R1(config)#int e0/1

R1(config-if)#ip add 192.168.13.1255.255.255.0

R1(config-if)#no sh

R1(config-if)#exit

R1(config)#router rip

R1(config-router)#no au

R1(config-router)#ver 2

R1(config-router)#net 1.1.1.0

R1(config-router)#net 192.168.12.0

R1(config-router)#net 192.168.13.0

R1(config-router)#exit

 

R2配置:

R2#conf t

R2(config)#int e0/0

R2(config-if)#ip add 192.168.12.2255.255.255.0

R2(config-if)#no sh

R2(config-if)#exit

R2(config)#int e0/1

R2(config-if)#ip add 192.168.24.2255.255.255.0

R2(config-if)#no sh

R2(config-if)#exit

R2(config)#router rip

R2(config-router)#no au

R2(config-router)#ver 2

R2(config-router)#net 192.168.12.0

R2(config-router)#net 192.168.24.0

R2(config-router)#default-metric 4

R2(config-router)#redistribute ospf 1

R2(config-router)#exit

R2(config)#router rip

R2(config-router)#no net 192.168.24.0

R2(config-router)#exit

R2(config)#router ospf 1

R2(config-router)#net 192.168.24.0255.255.255.0 area 0

R2(config-router)#redistribute rip subnets

R2(config-router)#exit

 

R3配置:

R3#conf t

R3(config)#int e0/0

R3(config-if)#ip add 192.168.13.2255.255.255.0

R3(config-if)#no sh

R3(config-if)#exit

R3(config)#int e0/1

R3(config-if)#ip add 192.168.34.2255.255.255.0

R3(config-if)#no sh

R3(config-if)#exit

R3(config)#router rip

R3(config-router)#no au

R3(config-router)#ver 2

R3(config-router)#net 192.168.13.0

R3(config-router)#default-metric 4

R3(config-router)#redistribute ospf 1

R3(config-router)#exit

R3(config)#router ospf 1

R3(config-router)#router ospf 1

R3(config-router)#net 192.168.34.0255.255.255.0 area 0

R3(config-router)#redistribute rip subnets

R3(config-router)#exit

 

R4配置:

R4#conf t

R4(config)#int lo0

R4(config-if)#ip add 4.4.4.4 255.255.255.0

R4(config-if)#exit

R4(config)#int e0/0

R4(config-if)#ip add 192.168.24.4255.255.255.0

R4(config-if)#no sh

R4(config-if)#exit

R4(config)#int e0/1

R4(config-if)#ip add 192.168.34.4255.255.255.0

R4(config-if)#no sh

R4(config-if)#exit

R4(config)#router ospf 1

R4(config-router)#net 192.168.24.0255.255.255.0 area 0

R4(config-router)#net 192.168.34.0255.255.255.0 area 0

R4(config-router)#net 4.4.4.0 255.255.255.0area 0

R4(config-router)#exit

 

 

完成以上路由重分布后配置,我们会发现R2和R3的路由表出现次优路由,出现这个情况是因为在多点双向重分发时,从这个方向发出去的路由,会再次传送回来。此时会判断传送回来的路由与自己路由表中相同的路由条目管理距离进行对比,越低就越可靠,并写进路由表。

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/24 is 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:02, Ethernet0/0

O E2 192.168.13.0/24[110/20] via 192.168.24.4, 00:01:25, Ethernet0/1

    4.0.0.0/32 is subnetted, 1 subnets

O      4.4.4.4 [110/11] via 192.168.24.4, 00:01:25, Ethernet0/1

C   192.168.24.0/24 is directly connected, Ethernet0/1

192.168.34.0/24 [110/20] via192.168.24.4, 00:01:25, 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 staticroute

Gateway of last resort is not set

O E2 192.168.12.0/24[110/20] via 192.168.34.4, 00:03:17, Ethernet0/1

     1.0.0.0/24 is subnetted, 1 subnets

O E2    1.1.1.0 [110/20] via 192.168.34.4,00:03:17, Ethernet0/1

C   192.168.13.0/24 is directly connected, Ethernet0/0

    4.0.0.0/32 is subnetted, 1 subnets

O      4.4.4.4 [110/11] via 192.168.34.4, 00:03:17, Ethernet0/1

O   192.168.24.0/24 [110/20] via 192.168.34.4, 00:03:17, Ethernet0/1

C   192.168.34.0/24 is directly connected, Ethernet0/1

 

此时我们使用调整管理距离的方法将OSPF的管理距离调整为大于RIP,来调整路由表选择最优路由:

 

R2#conf t

R2(config)#router ospf 1

R2(config-router)#distance 170

 

R3#conf t

R3(config)#router ospf 1

R3(config-router)#distance 170

 

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/24 is 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:14, Ethernet0/0

R   192.168.13.0/24 [120/1] via 192.168.12.1, 00:00:14, Ethernet0/0

    4.0.0.0/32 is subnetted, 1 subnets

O      4.4.4.4 [170/11] via 192.168.24.4, 00:00:25, Ethernet0/1

C   192.168.24.0/24 is directly connected, Ethernet0/1

O   192.168.34.0/24 [170/20] via 192.168.24.4, 00:00:25, 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

R   192.168.12.0/24 [120/1] via 192.168.13.1, 00:00:02, Ethernet0/0

    1.0.0.0/24 is subnetted, 1 subnets

R      1.1.1.0 [120/1] via 192.168.13.1, 00:00:02, Ethernet0/0

C   192.168.13.0/24 is directly connected, Ethernet0/0

    4.0.0.0/32 is subnetted, 1 subnets

O      4.4.4.4 [170/11] via 192.168.34.4, 00:00:23, Ethernet0/1

O   192.168.24.0/24 [170/20] via 192.168.34.4, 00:00:23, Ethernet0/1

C   192.168.34.0/24 is directly connected, Ethernet0/1

 


实验二、Offset-list控制路由选路

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)#inte1/0

R1(config-if)#ipadd 192.168.11.1 255.255.255.0

R1(config-if)#nosh

R1(config-if)#exit

R1(config)#ints0/0

R1(config-if)#clockrate 64000

R1(config-if)#ipadd 192.168.10.1 255.255.255.0

R1(config-if)#nosh

R1(config-if)#exit

R1(config)#routereigrp 1

R1(config-router)#noauto-summary

R1(config-router)#net192.168.10.0

R1(config-router)#net192.168.11.0

R1(config-router)#net1.1.1.0

R1(config-router)#exit

R1(config)#iproute 0.0.0.0 0.0.0.0 21.21.21.21 130

R1(config)#iproute 0.0.0.0 0.0.0.0 22.22.22.22 140

 

R2配置:

R2#conf t

R2(config)#ints0/0

R2(config-if)#clockrate 64000

R2(config-if)#ipadd 192.168.10.2 255.255.255.0

R2(config-if)#nosh

R2(config-if)#exit

R2(config)#inte1/0

R2(config-if)#ipadd 192.168.11.2 255.255.255.0

R2(config-if)#nosh

R2(config-if)#exit

R2(config)#inte1/1

R2(config-if)#ipadd 192.168.23.2 255.255.255.0

R2(config-if)#nosh

R2(config-if)#exit

R2(config)#intlo0

R2(config-if)#ipadd 2.2.2.2 255.255.255.0

R2(config-if)#exit

R2(config)#intlo1

R2(config-if)#ipadd 21.21.21.21 255.255.255.0

R2(config-if)#exit

R2(config)#intlo2

R2(config-if)#ipadd 22.22.22.22 255.255.255.0

R2(config-if)#exit

R2(config)#intlo3

R2(config-if)#ipadd 23.23.23.23 255.255.255.0

R2(config-if)#exit

R2(config)#routereigrp 1

R2(config-router)#noauto-summary

R2(config-router)#net192.168.10.0

R2(config-router)#net2.2.2.0

R2(config-router)#net21.21.21.0

R2(config-router)#net22.22.22.0

R2(config-router)#exit

R2(config)#routerrip

R2(config-router)#noauto-summary

R2(config-router)#ver2

R2(config-router)#net23.23.23.0

R2(config-router)#net192.168.23.0

R2(config-router)#redistributeeigrp 1 metric 4

R2(config-router)#exit

 

R3配置:

R3#conf t

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)#intlo0

R3(config-if)#ipadd 3.3.3.3 255.255.255.0

R3(config-if)#exit

R3(config)#routerrip

R3(config-router)#noauto-summary

R3(config-router)#ver2

R3(config-router)#net192.168.23.0

R3(config-router)#net3.3.3.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

     2.0.0.0/24 is subnetted, 1 subnets

D       2.2.2.0 [90/409600] via 192.168.11.2,00:20:09, Ethernet1/0

     21.0.0.0/24 is subnetted, 1 subnets

D       21.21.21.0 [90/409600] via 192.168.11.2,00:19:50, Ethernet1/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/409600] via 192.168.11.2,00:19:43, Ethernet1/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

     1.0.0.0/24 is subnetted, 1 subnets

R       1.1.1.0 [120/4] 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/4] 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/4] via 192.168.23.2,00:00:08, Ethernet0/0

R    192.168.10.0/24 [120/4] 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/1] via 192.168.23.2,00:00:09, Ethernet0/0

R    192.168.11.0/24 [120/4] 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/4] via 192.168.23.2,00:00:11, Ethernet0/0

C    192.168.23.0/24 is directly connected,Ethernet0/0

 

进行如下修改:

R1#conf t

R1(config)#access-list1 permit 21.21.21.0 0.0.0.255 //用访问控制列表标记流量

R1(config)#access-list1 permit 22.22.22.0 0.0.0.255

R1(config)#access-list1 deny any

R1(config)#access-list2 permit 1.1.1.0 0.0.0.255

R1(config)#access-list2 deny any

R1(config)#routereigrp 1

R1(config-router)#offset-list1 in 1888256 e1/0 //设置更新的路由metric添加1888256

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 //R1不变

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/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:02, 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/24 is directly connected, Ethernet0/0

     2.0.0.0/24 is subnetted, 1 subnets

C      2.2.2.0 is directly connected, Loopback0

    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 //所有ospf动态路由学习不到

*Mar  100:21:39.267: %SYS-5-CONFIG_I: Configured from console by console

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/24 is subnetted, 1 subnets

C      3.3.3.0 is directly connected, Loopback0

C   192.168.23.0/24 is directly connected, Ethernet0/0

 

由以上分析可知:

  1. 在RIP和IGRP这一种路由协议的特点是不会与对方router建立关系.由于passive-interface指令的关系,路由器是每隔一段时间就会发生只听不送的状况,即update会送不出去。

  2. 在OSPF和EIGRP、ISIS之类的路由协议的特点是会与对方router建立关系,也就是说router之间会建邻居关系,所以一旦用了passive -interface之后,你就断开了router之间的关系.因此所有的update送不出去,也收不进来.  

 

 

实验四、Distribute-list分发列表

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)#noauto-summary

R1(config-router)#ver

R1(config-router)#version2

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)#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)#net192.168.12.0

R2(config-router)#net192.168.23.0

R2(config-router)#net2.2.2.0

 

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)#intlo1

R3(config-if)#ipadd 33.33.33.33 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)#inte0/1

R3(config-if)#ipadd 192.168.34.3 255.255.255.0

R3(config-if)#nosh

R3(config-if)#exit

R3(config)#routerrip

R3(config-router)#noau

R3(config-router)#ver2

R3(config-router)#net3.3.3.0

R3(config-router)#net192.168.23.0

R3(config-router)#exit

R3(config)#routerospf 1

R3(config-router)#net33.33.33.0 255.255.255.0 area 0

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

 

R4配置:

R4#conf t

R4(config)#intlo0

R4(config-if)#ipadd 4.4.4.4 255.255.255.0

R4(config-if)#exit

R4(config)#inte0/1

R4(config-if)#ipadd 192.168.34.4 255.255.255.0

R4(config-if)#nosh

R4(config-if)#exit

R4(config)#inte0/0

R4(config-if)#ipadd 192.168.45.4 255.255.255.0

R4(config-if)#nosh

R4(config-if)#exit

R4(config)#routerospf 1

R4(config-router)#net192.168.34.0 255.255.255.0 area 0

R4(config-router)#net192.168.45.0 255.255.255.0 area 0

R4(config-router)#net4.4.4.0 255.255.255.0 area 0

 

R5配置:

R5#conf t

R5(config)#intlo0

R5(config-if)#ipadd 5.5.5.5 255.255.255.0

R5(config-if)#exit

R5(config)#inte0/0

R5(config-if)#ipadd 192.168.45.5 255.255.255.0

R5(config-if)#nosh

R5(config-if)#exit

R5(config)#routerospf 1

R5(config-router)#net5.5.5.0 255.255.255.0 area 0

R5(config-router)#net192.16.45.0 255.255.255.0 area 0

第一要求R3不能学习到R2的2.2.2.0,网段配置如下

R2#conf t

R2(config)#access-list1 deny 2.2.2.0 0.0.0.255 //设置ACL不允许2.2.2.0网段

R2(config)#access-list1 permit any//在ACL上允许其他网段

R2(config)#routerrip

R2(config-router)#distribute-list1 out e0/1//将ACL应用到RIP接口e0/1的out方向

或者在R3上进行如下配置,达到相同的效果

R3#conf t

R3(config)#access-list1 deny 2.2.2.0 0.0.0.255 //设置ACL不允许2.2.2.0网段

R3(config)#access-list1 permit any//在ACL上允许其他网段

R3(config)#routerrip

R3(config-router)#distribute-list1 in e0/0//将ACL应用到RIP接口e/0的in方向

R3(config-router)#doclear ip rou *//清除路由列表,闭关重新生成

 

 

第二要求R4不能学习R3的33.33.33.0网段,但是R5可以学习。R3不能学习到R4的4.4.4.0网段。配置如下:

R4#conf t

R4(config)#access-list1 deny 33.33.33.0 0.0.0.255

R4(config)#access-list1 permit any

R4(config)#routerospf 1

R4(config-router)#distribute-list1 in e0/1

R4(config-router)#doclear ip rou *

 

R3#conf t

R3(config)#access-list1 deny 4.4.4.0 0.0.0.255

R3(config)#access-list1 permit any

R3(config)#routerospf 1

R3(config-router)#distribute-list1 in e0/1

R3(config-router)#doclear ip rou *

 

第三要求双向重发布时,不能将1.1.1.0和5.5.5.0注入

R3#conf t

R3(config)#access-list2 deny 1.1.1.0 0.0.0.255

R3(config)#access-list2 permit any

R3(config)#access-list3 deny 5.5.5.0 0.0.0.255

R3(config)#access-list3 permit any

R3(config)#routerospf 1

R3(config-router)#redistributerip subnets

R3(config-router)#distribute-list2 out rip

R3(config-router)#exit

R3(config)#routerrip

R3(config-router)#redistributeospf 1 metric 2

R3(config-router)#distribute-list3 out ospf 1

对于距离矢量路由协议路由器之间,传递的是路由信息,分发列表对路由信息是有绝对的控制权的。因此如果是in方向,那么通过部署分发列表,可以过滤特定的路由,使得执行分发列表的本地路由路由表发生变化,同时,本地路由器在更新路由信息给下游路由器的时候,实际上更新的内容是受分发列表影响之后的条目。同时在out方向也是没有问题的。 

在链路状态协议中部署分发列表,只能用in方向,分发列表只能在本地收到LSA后,生成路由的那一刹那进行路由的过滤,执行分发列表的路由器的路由表会被分发列表影响,但是该路由器仍会将LSADB中的LSA发送给邻居,因此只对本地路由过滤,邻居不受影响。

 

 

实验五、Prefix-list前缀列表

R1配置:

R1#conf  t

R1(config)#intl0

R1(config-if)#ipadd 172.168.1.1 255.255.255.0

R1(config-if)#exit

R1(config)#intl1

R1(config-if)#ipadd 172.168.2.1 255.255.255.0

R1(config-if)#exit

R1(config)#intlo3

R1(config-if)#ipadd 172.168.3.1 255.255.255.0

R1(config-if)#exit

R1(config)#intlo4

R1(config-if)#ipadd 1

R1(config-if)#ipadd 172.168.14.1 255.255.255.0

R1(config-if)#exit

R1(config)#intlo5

R1(config-if)#ipadd 172.168.15.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)#net172.168.1.0

R1(config-router)#net172.168.2.0

R1(config-router)#net172.168.3.0

R1(config-router)#net172.168.14.0

R1(config-router)#net172.168.15.0

R1(config-router)#net192.168.12.0

 

R2配置:

R2#conf t

R2(config)#intlo0

R2(config-if)#ipadd 2.2.2.2 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)#ip add 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)#net192.168.12.0

R2(config-router)#net2.2.2.0

R2(config-router)#exit

R2(config)#routerospf 1

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

 

R3配置:

R3#conf t

R3(config)#intlo0

R3(config-if)#ipadd 202.100.100.3 255.255.255.0

R3(config-if)#exit

R3(config)#intlo1.

R3(config-if)#ipadd 202.100.101.3 255.255.255.0

R3(config-if)#exit

R3(config)#intlo2

R3(config-if)#ipadd 202.100.102.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)#net192.168.23.0 255.255.255.0 area 0

R3(config-router)#net202.100.100.0 255.255.255.0 area 0

R3(config-router)#net202.100.101.0 255.255.255.0 area 0

R3(config-router)#net202.100.102.0 255.255.255.0 area 0

 

第一R1不用学习R2的2.2.2.0网段,R2不能学习R1的172.168.1.0、172.168.2.0、172.168.13.0网段

R2#conf t

R2(config)#ipprefix-list filter-1 seq 1 deny 2.2.2.0/24//创建一条前缀列表拒绝2.2.2.0网络

R2(config)#ipprefix-list fliter-1 seq 2 permit 0.0.0.0/0 le 32

R2(config)#ipprefix-list filter-2 seq 3 deny 172.168.1.0/22 le 24

R2(config)#ipprefix-list filter-2 seq 4 permit 0.0.0.0/0 le 32

R2(config)#routerrip

R2(config-router)#distribute-listprefix filter-1 out e0/0//利用distribute-list调用prefix-list

R2(config-router)#distribute-listprefix filter-2 in e0/0

 

第二要求双向重发布时,172.168.14.0、172.168.15.0、202.100.101.0、202.100.102.0不注入

R2(config)#conft

R2(config)#ipprefix-list filter-3 seq 5 deny 172.168.14.0/23 le 24

R2(config)#ipprefix-list filter-3 seq 6 permit 0.0.0.0/0 le 32

R2(config)#ipprefix-list filter-4 seq 7 deny 202.100.100.0/22 le 24

R2(config)#ipprefix-list filter-4 seq 8 permit 0.0.0.0/0 le 32

R2(config)#routerrip

R2(config-router)#redistributeospf 1 metric 2

R2(config-router)#distribute-listprefix filter-3 out ospf 1

R2(config-router)#exit

R2(config)#routerospf 1

R2(config-router)#redistributerip subnets

R2(config-router)#distribute-listprefix filter-4 out rip

 

不同于用于匹配流量的IP访问列表,IP前缀列表主要是用来指定具体的网络可达的。前缀列表用来匹配前缀(网段)和前缀长度(子网掩码)。IP前缀列表(prefix-list)三种形式的含义:

ip prefix-list [name][permit | deny] [prefix]/[len] ge [ge-value] le [le-value]

ge代表大于等于,le代表基于等于

1、ip prefix-list 110 permit 172.16.1.0/23

a:网络号前23位一定相同

b:子网掩码一定是23位的

2、ip prefix-list 110 permit 172.16.1.0/23 le 24

a:网络号前23位一定相同

b:子网掩码可以是23位-24位

3、ip prefix-list 110 permit 172.16.1.0/23 ge24

a:网络号前23位一定相同

b:子网掩码可以是23位-32位

4、ip prefix-list 110 permit 172.16.1.0/23 ge 24 le 24

a:网络号前23位一定相同

b:子网掩码一定是24位

5、ip prefix-list 110 permit 0.0.0.0/0

      匹配默认路由

6、ip prefix-list 110 permit 0.0.0.0/0 le 32

匹配任何网段

 

 

实验六、Route-map(结合ACL、prefix-list、Tag)

R1#conft

R1(config)#intlo 1

R1(config-if)#ipadd 1.1.1.1 255.255.255.0

R1(config-if)#exit

R1(config)#intlo 2

R1(config-if)#ipadd 1.1.2.1 255.255.255.128

R1(config-if)#exit

R1(config)#intlo3

R1(config-if)#ipadd 1.1.3.1 255.255.255.192

R1(config-if)#exit

R1(config)#intlo 4

R1(config-if)#ipadd 1.1.4.1 255.255.255.224

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)#net1.1.1.0

R1(config-router)#net1.1.2.0

R1(config-router)#net1.1.3.0

R1(config-router)#net1.1.4.0

R1(config-router)#net192.168.12.0

R1(config-router)#noau

R1(config-router)#ver2

 

R2配置:

R2#conft

R2(config)#intlo 1

R2(config-if)#ipadd 2.2.2.2 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)#net192.168.12.0

R2(config-router)#net2.2.2.0

R2(config-router)#exit

R2(config)#routereigrp 1

R2(config-router)#noauto-summary

R2(config-router)#net192.168.23.0 255.255.255.0

 

R3配置:

R3#conft

R3(config)#intlo 1

R3(config-if)#ipadd 3.3.3.3 255.255.255.0

R3(config-if)#exit

R3(config)#inte0/1

R3(config-if)#ipadd 192.168.34.3 255.255.255.0

R3(config-if)#nosh

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)#routereigrp 1

R3(config-router)#noauto-summary

R3(config-router)#net3.3.3.0 255.255.255.0

R3(config-router)#net192.168.23.0 255.255.255.0

R3(config-router)#exit

R3(config)#routerospf 1

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

R3(config-router)#exit

 

R4配置:

R4#conft

R4(config)#intlo 1

R4(config-if)#ipadd 4

R4(config-if)#ipadd 4.4.4.4 255.255.255.0

R4(config-if)#exit

R4(config)#inte0/0

R4(config-if)#ipadd 192.168.34.4 255.255.255.0

R4(config-if)#nosh

R4(config-if)#exit

R4(config)#inte0/0

R4(config-if)#nosh

R4(config-if)#exit

R4(config)#routerospf 1

R4(config-router)#net4.4.4.0 255.255.255.0 area 0

R4(config-router)#net192.168.34.0 255.255.255.0 area 0

 

(A)结合ACL,如果要求rip与eigrp进行双向重分布时,1.1.1.0 网段不能分发到eigrp中,3.3.3.0网段不能分布到rip中

R2#conft

R2(config)#access-list1 permit 1.1.1.0 0 0.0.0.255 //抓取1.1.1.0路由

R2(config)#route-mapfilter-1 deny 10 //创建过滤的路由图

R2(config-route-map)#matchip address 1/对匹配1.1.1.0的路由进行过滤

R2(config-route-map)#exit

R2(config)#route-mapfilter-1 permit 20//对1.1.1..0以外的路由全部放行

R2(config-route-map)#exit

R2(config)#access-list3 permit 3.3.3.0 0.0.0.255//抓取3.3.3.0路由

R2(config)#route-mapfilter-3 deny 30 //创建过滤的路由图

R2(config-route-map)#matchip add 3//对匹配3.3.3.0的路由进行过滤

R2(config-route-map)#exit

R2(config)#route-mapfilter-3 permit 40//对3.3.3.0以外的路由全部放行

R2(config-route-map)#exit

R2(config)#routereigrp 1

R2(config-router)# redistributerip metric 2500 1500 1 255 5000 route-map filter-1//将RIP分发到eigrp中,并应用路由图

R2(config-router)#exit

R2(config)#routerrip

R2(config-router)# redistributeeigrp 1 route-map filter-3 metric 2//将eigrp分发到rip中,并应用路由图

R2(config-router)#exit

 

 

(B)结合prefix-list,如果要求rip与eigrp进行双向重分布时,只有1.1.4.0 网段分发到eigrp中,3.3.3.0网段不能分布到rip中

R2#conft

R2(config)#ipprefix-list filter-1 permit 1.1.1.0/22 ge 24 le 27//抓取不分发的路由段

R2(config)#route-mapfilter-1 deny 10//创建过滤的路由图

R2(config-route-map)#matchip add prefix-list filter-1//将抓取的路由过滤掉

R2(config-route-map)#exit

R2(config)#route-mapfilter-1 permit 20//创建一个允许其他不符合条件的路由,

R2(config-route-map)#exit

R2(config)#ipprefix-list filter-3 permit 3.3.3.0/24

R2(config)#route-mapfilter-3 deny 30

R2(config-route-map)#matchip add prefix-list filter-3

R2(config-route-map)#exit

R2(config)#route-mapfilter-3 permit 40

R2(config-route-map)#exit

R2(config)#routereigrp 1

R2(config-router)#redistribute rip route-map filter-1 metric 2500 1500 1 255 5000

R2(config-router)#exit

R2(config)#routerrip

R2(config-router)#redistributeeigrp 1 route-map filter-3 metric 2

R2(config-router)#exit

 

 

(C)结合tag,在路由重分发时R1的路由不能被R4学习到 

R2#conft

R2(config)#access-list1 permit 1.1.0.0 0.0.7.255 //抓取R1上的所有路由

R2(config)#route-maptag permit 10 //创建路由图

R2(config-route-map)#matchip add 1//在路由图上设置匹配的条件路由

R2(config-route-map)#settag 100//对满足条件的路由打tag 100

R2(config-route-map)#exit

R2(config)#route-maptag permit 20//对其他不匹配的路由都不做任何动作

R2(config-route-map)#exit

R2(config)#routerrip

R2(config-router)#redistributeeigrp 1 metric 2

R2(config-router)#exit

R2(config)#norouter ospf 1

R2(config)#routereigrp 1

R2(config-router)#redistributerip  metric 2500 1500 1 255 5000route-map tag //将路由图应用到rip注入到eigrp的路由中

R2(config-router)#exit

 

R3#conft

R3(config)#route-mapfilter-tag deny 10 //设置过滤路由图

R3(config-route-map)#matchtag 100 //匹配过滤的条件为tag 100

R3(config-route-map)#exit

R3(config)#route-mapfilter-tag permit 20//对其他不匹配条件的不做任何动作

R3(config-route-map)#exit

R3(config)#routereigrp 1

R3(config-router)#redistributeospf 1 metric 2500 1500 1 255 5000

R3(config-router)#exit

R3(config)#routerospf 1

R3(config-router)#redistributeeigrp 1 route-map filter-tag subnets //将路由图应用到eigrp注入到ospf的路由中

R3(config-router)#exit

 

R3#ship rou 1.1.1.0 //R3收到R1上的所有路由都打上tag 100

Routingentry for 1.1.1.0/24

  Known via "eigrp 1", distance 170,metric 1433600

  Tag 100, type external

  Redistributing via eigrp 1, ospf 1

  Last update from 192.168.23.2 on Ethernet0/0,00:15:02 ago

  Routing Descriptor Blocks:

  * 192.168.23.2, from 192.168.23.2, 00:15:02ago, via Ethernet0/0

      Route metric is 1433600, traffic sharecount is 1

      Total delay is 16000 microseconds,minimum bandwidth is 2500 Kbit

      Reliability 1/255, minimum MTU 1500 bytes

      Loading 255/255, Hops 1

      Route tag 100

 

R4#ship rou //无任何R1的路由

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

O E2192.168.12.0/24 [110/20] via 192.168.34.3, 00:08:52, Ethernet0/0

     2.0.0.0/24 is subnetted, 1 subnets

OE2    2.2.2.0 [110/20] via 192.168.34.3,00:08:52, Ethernet0/0

     3.0.0.0/24 is subnetted, 1 subnets

OE2    3.3.3.0 [110/20] via 192.168.34.3,00:08:52, Ethernet0/0

     4.0.0.0/24 is subnetted, 1 subnets

C       4.4.4.0 is directly connected, Loopback1

O E2192.168.23.0/24 [110/20] via 192.168.34.3, 00:08:52, Ethernet0/0

C    192.168.34.0/24 is directly connected,Ethernet0/0

 

Route-map总结:

  1. 使用ACL访问控制列表可以用一条语句控制多条路由,用反掩码来匹配,反掩码为0的位表示必须与路由条目匹配,反掩码为1的位表示无需匹配。但使用访问控制列表来过滤路由的话,不能匹配路由的掩码长度

  2. 使用Prefix-list前缀列表控制路由更新时可以使用一条语句匹配多条路由。使用前缀列表过滤路由,可以匹配子网掩码

  3. 在使用route-map进行控制路由更新时,所用的访问控制列表以及前缀列表都使用permit语句,表示匹配一条或者多条路由;如果是要拒绝这个一条或者多条路由,那么在route-map中使用deny语句,下面挂列表。如果是要允许,则使用permit语句。Route-map的最后隐含了一条deny语句,如果没有写一条permit的空语句,则会匹配默认的deny语句

  4. 使用route-map控制路由更新时,如果match 语句是横着有多个访问控制列表或者前缀列表,代表只需匹配其中的一个地址就执行route-map,如果在同一个序列号下竖着写多个match ip address,则表示需要同时满足这两个要求才执行route-map

  5. 每一个route-map可以有多条语句,每条语句都有一个序号;每条语句都有两种动作match 和set。如不写match/set,默认为match any/set nothing ;每条语句对抓出来的路由都有两种处理方式:permit 或deny

  6. Tag路由标记过滤的方法分两个步骤:

    1、在服务器端路由器设定标记(即R2当作服务器端)

    2、在客户端路由器根据标记进行过滤(即R3当作客户端)

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

     

CCNP课程实验-03-Route_Path_Control_CFG 修改成171,因为eigrp外部路由的AD值为170,这样的话,ospf的那条路由记录就会竞争RIB失效。现在要将这个汇总的路由限制在III区内,那就是要在R6上重分布到I区时,拦截该条汇总路由,不让他分布进I区的eigrp协议中。从路由表上得到的信息是,等价负载均衡的,现在只需增大去往R4的metric值,使的R6的metric优先,就可以达到目的。我的想法是通过在eigrp里修改distance,达到目的,具体是这样的。例如:R3-R6之间的AB为36,X为路由器编号,例如R3的X=3。 阅读详情

相关推荐

全新中文版CCNP路由核心课程PPT详解

CCNP(Cisco Certified Network Professional)是思科认证体系中承上启下的专业级认证,标志着网络工程师从基础配置向复杂网络设计与故障排查能力的跃迁。随着2020年思科认证架构重构,传统“路由与交换”方向已演进为以企业网络(ENCOR 350-401)为核心、叠加实施企业高级路由(ENARSI 300-410)的模块化路径,聚焦现代企业网络中的自动化、安全集成与高级路由控制。

weixin_42610671的博客 732

RIP偏移列表

思路: acl允许1.1.1.1匹配路由,在R2上做匹配路由的目的是和下面给它加跳数相匹配1.1.1.1 R1、R2、R3、R4上配置IP地址然后network宣告各自的网段,保证全网通 如果1.1.1.1想要从R3通过,那么就要去R2上面配置允许1.1.1.1通过,然后进入rip里面配置偏移加一 跳,R2就变成了三跳,R3默认是两跳,所以最小的跳数就是距离最近的先走 如果4.4.4.4想要从R2通过,那么就要去R3上面配置允许4.4.4.4通过,然后进入rip里面配置偏移加一 跳,R3就变成了三跳...

vx XIxi_AL 642

全面掌握CCNP路由技术的2011年版学习指南

CCNP(Cisco Certified Network Professional)是网络领域内的重要认证之一,是Cisco官方推出的认证体系中的中级认证。通过CCNP认证,表示专业人员具备了设计、实施和维护复杂网络的能力,能够处理网络安全、语音、无线和视频等多种高级技术。动态路由协议用于在网络设备之间自动交换路由信息。它们能够适应网络拓扑的变化,自动更新路由表。动态路由协议适用于大型或复杂的网络环境。

weixin_42610010的博客 741

RIP Offset选路

offset Serial1/0 out AclRIP 3 //将offset值加至备份链路。ip access-list standard AclRIP //创建ACL。

kaml200626的博客 404

RIP offset list

动态路由协议:RIP中关于偏移列表的有关讨论; 本文详细讨论offset list的详细情况,并有实验可以验证。

国产麒麟系统PXE安装-UEFI引导

注意: 适用uefi引导 适用x86_64架构 一键部署脚本扣我 1.上传ISO到PXE服务器,拷贝ISO文件 # mkdir /kylin_iso # mount -o loop Kylin-Server-10-SP1-Release-Build04-20200711-x86_64.iso /kylin_iso/ 2.配置http,获取安装源 # yum -y install httpd # mkdir /var/www/html/{ks,kylin} # 注意一定是"/kylin_iso/

河静 5056

RIP offset-list

RIP offset-list RIPRIP RIP的offset-list实验拓扑图如下: 图1:offset-list实验拓扑图首先,按照上图配置一下,把RIP配通。这里就不做详细的说明了。配置offset-list:r1(config)#router ripr1(config-router)#offse...

weixin_34249678的博客 434

LTE/NR中的相应cause场景【原创】

目录1.背景2.LTE EMM cause2.0 写在最前2.1 特殊处理的cause第一梯队第二梯队2.2 非特殊处理的cause3.NR cause 实网分析终端被拒等问题,经常遇到各类cause,其会对应不同的终端限制行为。查找已有资料后理解没有很深,自行总结本文用于梳理现象,如有错误敬请指正,转载请注明出处。 本文用于记录协议Ts 24.301及Ts 24.501中的cause及其对应行为。 已总结的cause值: 24.301中的cause分

2301_79567300的博客 3500

关于offset-list和rip的四个计时器

偏移量列表可以用来改变路由的度量值,已达到某些目的(如做备份链路或者负载均衡)。 如下图的例子就是使用offset-list改变RIP的度量值,以达到让R1和R3间的链路变成备份的目的: 本来通告之后R3到达1.1.1.0/24这个网段应该2跳,这样就会直接使用serial,现在做一个offset-list用于改变度量值,可以达到让流量经过R2...

weixin_33831673的博客 386

Android 集成Chrome 浏览器内核 Crosswalk

Crosswalk 内核的兴起与消亡 Android 4.4 版本之前,使用的是基于 androidWebKit 的 WebView 但实际上,由于 Android 的碎片化问题(大量存在不同的 Android 系统版本,并且各个厂商对内置应用进行定制化,有可能用的不是最新的浏览器内核)。这就导致 WebView 在真实环境中对 API 的支持根本无迹可寻,越发混乱。 随着混合开发的兴起,前端对 ...

司马懿的西山居 2万+

SAP_SD模块路径及运输功能后台配置简介

后台路径:SPRO—后勤执行—装运—基本发运功能—定义路线—定义传输模式根据实际运输过程运输地理的类型:海运、公路运输、空运后台路径:SPRO—后勤执行—装运—基本发运功能—定义路线—定义发运类型根据实际运输过程运输方式:汽车、卡车、火车、轮船、飞机后台路径:SPRO—后勤执行—装运—基本发运功能—路径—定义路线—定义运输连接点指在运输过程中需要中转的地区可以维护中转地区的停留的时间后台路径:SPRO—后勤执行—装运—基本发运功能—路径—定义路线—定义路径和阶段。

我小时候很黑的博客 1400

1.CCNP闫辉视频笔记RIP

RIP的13个高级特性 自动汇总手工汇总 自动汇总 当要发送的路由前缀与发送接口的IP不在同一个主类网段,将丢弃明细路由,汇总之后再进行发送。 下述两类路由将进行自动汇总: 该路由器的本地路由通过邻居获悉的RIP路由 存在不连续子网时,自动汇总可能产生路由黑洞,因此建议关闭自动汇总。然而,不进行汇总又使得明细路由较多,影响网络效率。因此, 有了手工汇总。

bingosummer的专栏 3532

Windows 下 Hermes Agent(爱马仕)安装全记录:从零到一的保姆级图文教程

本文主要介绍了Windows 下 Hermes Agent(爱马仕) 安装全记录:从零到一的保姆级图文教程,希望能对学习使用 Hermes Agent 的同学们有所帮助。 文章目录 1. 背景 2. 实战教程 2.1 步骤一 安装WSL环境 2.2 步骤二 安装Python环境 2.3 步骤三 安装Hermes Agent 2.4 步骤四 修正 API Key 错误 2.5 步骤五 配置多个模型 2.6 步骤六 启动Hermes Agent 3. 常见问题及解决方案 4. 总结

weixin_43178406的博客 14万+

【CCNP路由】OSPF综合实验(一)

@[CCNP-Route]OSPF综合实验(一) 实验目的 熟悉 OSPF 的基本配置 熟悉 OSPF 网络类型的应用 理解不连续区域的网络环境及不连续区域对 OSPF 路由选择的影响 掌握 OSPF 不连续区域的几种解决方案 掌握 OSPF 区域间和外部路由的汇总 掌握 OSPF 默认路由的配置及控制 实验拓扑 实验需求及配置过程 1) 参考拓扑,完成各路由器的基本配置,除图示地址标识外,...

徽徽的笔记私藏窝点 7096

基于simulink的电气弹簧ES稳压控制模型仿真

若要补偿母线电压的谐波,需控制ES上的谐波,即在单闭环母线电压有效值控制的基础上,增加谐波抑制环节来进行谐波控制,现有的各种检测和抑制谐波的方法有采用模拟滤波器、傅里叶分析进行谐波分析、基于瞬时无功功率理论的方法等。当关键负载ZC为电流源型非线性负载时,电路原理图如图7所示,由于电流源型非线性负载可以等效为谐波电流源,关键负载电流ic便会含有谐波分量,导致输电线电流is和母线电压VS同样会含有谐波分量,导致供电质量的严重下降,对用电设备的正常工作造成影响。分别为流过线路阻抗、非关键负载、关键负载的电流,

FPGA/MATLAB学习教程/源码/项目合作开发 1633

从 Open SQL JOIN 走向 ABAP CDS Association:把查询写成可复用的数据模型

摘要: 本文通过飞行模型示例,对比了ABAP中三种表关联实现方式:Open SQL JOIN、CDS显式JOIN和CDS Association。重点解析了Association的本质是将表关系声明为数据模型语言,使用时通过路径表达式按需展开为JOIN。文章指出路径表达式在不同位置会默认展开为不同JOIN类型(如SELECT列表默认为LEFT OUTER),并演示了如何用[inner]强制指定INNER JOIN。最后结合S/4HANA实际案例,说明Association通过中心化关系定义和路径复用,能有效

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 386

CCNP实验:简单的BGP实验

CCNP实验:简单的BGP实验: 对于该实验有不懂得可以查看我这篇博客: CCNP7:BGP的 [特点、数据包、工作过程、路由黑洞、放环机制、配置、MA网络中下一跳问题 ] 这个实验如下所示:所有的IP地址已经标明,然后所有的设备均运行BGP,且AS2中的3台路由器运行的IGP协议是OSPF,R4-R5之间存在两条链路。现在要求:R1-R5之间它们的环回可以互相访问。 由于拓扑、IP均已经规划好...

LIHAO的博客 4473

基于STM32L4XX、HAL库的ESP32-S3-WROOM-1-N4 WIFI模块驱动程序设计

/ 检查是否收到完整的一行(以\r\n结尾)// 例如: 解析AT命令响应或MQTT消息等。// UART2初始化已在CubeMX中配置。// USART2初始化函数(由CubeMX生成)// 缓冲区溢出,重置。// 如果需要等待响应。// 处理接收到的数据。// 处理接收到的数据。// 等待ESP32模块启动。// 主循环其他任务。// 启用UART全局中断。// 发送HTTP GET请求。// 发送AT测试命令。// 连接Wi-Fi。// UART中断回调函数。

zhusl6688的博客 288

CCNP路由实验之十六 策略路由(PBR)

CNP路由实验之十六 策略路由(PBR) 策略路由(PBR)是一种比基于目标网络进行路由更加灵活的数据包路由转发机制。路由器将通过路由图决定如何对需要路由的数据包进行处理,路由图决定了一个数据包的下一跳转发路由器。在路由器转发一个数据报文时,首先根据配置的规则对报文进行过滤,匹配成功则按照一定的转发策略进行报文转发。这种规则可以是基于标准和扩展访问控制列表,也可以基于报文的长度;而转发策略...

夫君子之行,静以修身,俭以养德,非淡泊无以明志,非宁静无以致远. 2276

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

视频教程-CCNP路由实验专题讲解视频课程--策略路由(PBR)篇-思科认证

CCNP路由实验专题讲解视频课程--策略路由(PBR)篇 原苏州万博IT教育...

weixin_28957583的博客 303

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

CCNP3实验:EIGRP——增强型内部网关路由协议

文章目录CCNP3实验:EIGRP——增强型内部网关路由协议一、规划IP:二、配置:1、底层:2、路由:(1)宣告路由:(2)拨号:(3)缺省:(4)NAT:(5)Telnet:3、策略:(1)修改带宽、非等开销负载均衡:(2)在R2、R3、R5之间安全认证:(3)优化:汇总路由(4)干涉选路: CCNP3实验:EIGRP——增强型内部网关路由协议 如果实验有不理解的可以查看我这篇博客:CCNP3...

LIHAO的博客 555

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

CCNP路由学习技巧

什么是CCNP路由 CCNP路由学习技巧:CCNP考试一共有3个科目:1、高级路由(ROUTE)2、多层交换(SWITCH)3、排错和维护(TSHOOT)。今天我们主要来讲一下高级路由的学习技巧。CCNP高级路由课程(640-902),建立在路由交换类CCNA(200-120)的课程之上,主要的核心内容是:关于多进程域EIGRP的配置的注意事项、配置EIGRP的stub区域、关于EIGRP占用带宽百分比的真正意义、关于EIGRP负载均衡注间事项及故障处理、EIGRP的默认路由与人工汇总、IPV6高级...

上海腾科教育的博客 663

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

CCNP路由实验之七动态路由之BGP 动态路由协议可以自动的发现远程网络,只要网络拓扑结构发生了变化,路由器就会相互交换路由信息,不仅能够自动获知新增加的网络,还可以在当前网络连接失败时找出备用路径。根据是否在一个自治域内部使用,动态路由协议分为内部网关协议(IGP)和外部网关协议(EGP)。这里的自治域指一个具有统一管理机构、统一路由策略的网络。自治域内部采用的路由选择协议称为内部网关协议,常

kkfloat博客 1万+

CCNP实验:交换2:BCMSN:组建Cisco多层交换网络

CCNP实验:交换2:BCMSN:组建Cisco多层交换网络 说明:我使用的是Packet Tracer Instructor 6.1的模拟器,这个模拟器做该实验稳定性较好,安利一下。 这是实验的拓扑,以及要求。正常情况下,企业内网会用两台路由器进行核心层冗余,会使用两条宽带,但这里强调的是交换,我就只用了一台路由器。 一、拓扑设计、IP地址规划: 根据实验要求: 我们发现:接入层有VLAN2、...

LIHAO的博客 2066

Cisco路由交换CCNP中级课程-实验22:路由选路分析案例

实验环境介绍: 52LAB自主设计制作的实验操作环境以及实验要求,方便CCNP学习者系统性的学习和实验操作,提高学习效率,降低学习成本。 实验要求: 1、按照拓扑图上显示信息给每台...

273
上一篇: CCNP路由实验之八 路由重发布
下一篇: CCNP路由实验之十 组播(多播)
kkfloat
博客等级 码龄17年 923粉丝 201原创
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值