Redistribute/Route-map

Using Multiple IP Routing Protocols
Using Seed Metrics
Use the default-metric command to establish the seed metric
for the route or specify the metric when redistributing.
Once a compatible metric is established,the metric will
increase in increments just like any other route.
              Seed Metrics


Default Seed Metrics
Protocol                           Default Seed Metric
RIP                                               infinity
IGRP/EIGRP                                 infinity
  OSPF                                         20 for all except 
                                                    BGP,which is 1
IS-IS                                             0
BGP                                             BGP metirc is set
                                                    to IGP metric value.
 
Redistribute/Route-map
R1(config-router)#redistribute ospf 110
R2没有R3的路由,说明重分布到rip中metric
无穷大

R1(config-router)#redistribute ospf 110 metric 1
R2有到R3的路由
Gateway of last resort is not set

      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C         2.2.2.0/24 is directly connected, Loopback0
L         2.2.2.2/32 is directly connected, Loopback0
R     3.0.0.0/8 [120/1] via 12.1.1.1, 00:00:21, Serial2/0
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C         12.1.1.0/24 is directly connected, Serial2/0
L         12.1.1.2/32 is directly connected, Serial2/0
R     13.0.0.0/8 [120/1] via 12.1.1.1, 00:00:21, Serial2/0


A->B
Static->B 
Connect->B
重分布静态
在R1上增加一条默认静态路由指向200.1.1.2
R1(config-router)#redistribute static
重分布静态不需要加metric值 
 
R2上路由
R*    0.0.0.0/0 [120/1] via 12.1.1.1, 00:00:01, Serial2/0
          2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            2.2.2.0/24 is directly connected, Loopback0
            2.2.2.2/32 is directly connected, Loopback0
      3.0.0.0/8 [120/1] via 12.1.1.1, 00:00:01, Serial2/0
          12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            12.1.1.0/24 is directly connected, Serial2/0
            12.1.1.2/32 is directly connected, Serial2/0
      13.0.0.0/8 [120/1] via 12.1.1.1, 00:00:01, Serial2/0
 
 
重分布直连
R1(config-router)#redistribute connected
 
R2上的路由
R*      0.0.0.0/0 [120/1] via 12.1.1.1, 00:00:11, Serial2/0
          2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            2.2.2.0/24 is directly connected, Loopback0
            2.2.2.2/32 is directly connected, Loopback0
      3.0.0.0/8 [120/1] via 12.1.1.1, 00:00:11, Serial2/0
          12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            12.1.1.0/24 is directly connected, Serial2/0
            12.1.1.2/32 is directly connected, Serial2/0
      13.0.0.0/8 [120/1] via 12.1.1.1, 00:00:11, Serial2/0
    200.1.1.0/24 [120/1] via 12.1.1.1, 00:00:11, Serial2/0
 

RIP路由重分布到OSPF中
  R1(config-router)#redistribute rip
% Only classful networks will be redistributed
R3 路由表
O E2  2.0.0.0/8 [110/20] via 13.1.1.1, 00:00:13, Serial2/1
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/1
            13.1.1.3/32 is directly connected, Serial2/1
 
R1(config-router)#redistribute rip subnets
 
R3路由表
O E2  2.0.0.0/8 [110/20] via 13.1.1.1, 00:11:45, Serial2/1
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          12.0.0.0/24 is subnetted, 1 subnets
O E2     12.1.1.0 [110/20] via 13.1.1.1, 00:00:17, Serial2/1
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/1
            13.1.1.3/32 is directly connected, Serial2/1
 
 
  静态路由重分布到OSPF中
不能将默认静态路由重分布到OSPF中,这是距离矢量和链接状态路由协议的根本区别
其它静态路由可以。
 
R1上的配置router ospf 110
  router-id 1.1.1.1
 redistribute static subnets
  redistribute rip subnets
  network 13.1.1.0 0.0.0.255 area 0
!
router rip
  redistribute connected
  redistribute static
  redistribute ospf 110 metric 1
  redistribute ospf 1
  network 12.0.0.0
  no auto-summary
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
ip route 0.0.0.0 0.0.0.0 Ethernet0/0
ip route 9.9.9.0 255.255.255.0 Ethernet0/0
 
 
R3上路由没有默认路由
O E2  2.0.0.0/8 [110/20] via 13.1.1.1, 00:25:40, Serial2/1
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          9.0.0.0/24 is subnetted, 1 subnets
O E2        9.9.9.0 [110/20] via 13.1.1.1, 00:00:04, Serial2/1
          12.0.0.0/24 is subnetted, 1 subnets
O E2        12.1.1.0 [110/20] via 13.1.1.1, 00:14:12, Serial2/1
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/1
            13.1.1.3/32 is directly connected, Serial2/1
 
 
 
重分布直连接口
R1(config)router ospf 110
R1(config-router)#redistribute connected subnets
 
R3上的路由
O E2  2.0.0.0/8 [110/20] via 13.1.1.1, 00:31:12, Serial2/1
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          9.0.0.0/24 is subnetted, 1 subnets
O E2        9.9.9.0 [110/20] via 13.1.1.1, 00:05:36, Serial2/1
          12.0.0.0/24 is subnetted, 1 subnets
O E2        12.1.1.0 [110/20] via 13.1.1.1, 00:19:44, Serial2/1
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/1
            13.1.1.3/32 is directly connected, Serial2/1
O E2  200.1.1.0/24 [110/20] via 13.1.1.1, 00:00:05, Serial2/1
 
————————————————————————————————————————
  Redistribute/Route-map

R1上的配置
interface Serial2/0
  ip address 13.1.1.1 255.255.255.0
  ip router isis
  serial restart-delay 0
 
router eigrp 90
  network 12.1.1.0 0.0.0.255
!
router isis
  net 49.0001.1111.1111.1111.00
  log-adjacency-changes all
 
R2上的配置
interface Loopback0
  ip address 2.2.2.2 255.255.255.0
interface Serial2/0
  ip address 12.1.1.2 255.255.255.0
  serial restart-delay 0
 
router eigrp 90
  network 2.2.2.0 0.0.0.255
  network 12.1.1.0 0.0.0.255
 
R3上的配置
interface Loopback0
  ip address 3.3.3.3 255.255.255.0
  ip router isis
interface Serial2/1
  ip address 13.1.1.3 255.255.255.0
  ip router isis
  serial restart-delay 0
router isis
  net 49.0001.3333.3333.3333.00
 
 
R1上的路由
         2.0.0.0/24 is subnetted, 1 subnets
       2.2.2.0 [90/2297856] via 12.1.1.2, 00:08:00, Serial2/1
      3.0.0.0/24 is subnetted, 1 subnets
i L1     3.3.3.0 [115/20] via 13.1.1.3, 00:00:03, Serial2/0
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
       12.1.1.0/24 is directly connected, Serial2/1
       12.1.1.1/32 is directly connected, Serial2/1
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
       13.1.1.0/24 is directly connected, Serial2/0
       13.1.1.1/32 is directly connected, Serial2/0
 
ISIS重分布到EIGEP中
R1(config)#router eigrp 90
R1(config-router)#redistribute isis  level-1-2 metric 1500 100 255 1 1500
 
 
R2上的路由
          2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            2.2.2.0/24 is directly connected, Loopback0
            2.2.2.2/32 is directly connected, Loopback0
          3.0.0.0/24 is subnetted, 1 subnets
D EX     3.3.3.0 [170/2244096] via 12.1.1.1, 00:00:08, Serial2/0
          12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            12.1.1.0/24 is directly connected, Serial2/0
            12.1.1.2/32 is directly connected, Serial2/0
 
ISIS的一个BUG
将IS-IS 重分布到任何协议中,运行 IS-IS直连路由不会重分布中去。
 
重分布直连
R1(config-router)#redistribute connected
 
R2上的路由
          2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            2.2.2.0/24 is directly connected, Loopback0
            2.2.2.2/32 is directly connected, Loopback0
          3.0.0.0/24 is subnetted, 1 subnets
D EX        3.3.3.0 [170/2244096] via 12.1.1.1, 00:07:18, Serial2/0
          12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            12.1.1.0/24 is directly connected, Serial2/0
            12.1.1.2/32 is directly connected, Serial2/0
          13.0.0.0/24 is subnetted, 1 subnets
D EX     13.1.1.0 [170/2681856] via 12.1.1.1, 00:01:14, Serial2/0

 

R2#show ip eigrp topology 13.1.1.0 255.255.255.0
EIGRP-IPv4 Topology Entry for AS(90)/ID(2.2.2.2) for 13.1.1.0/24
  State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2681856
  Descriptor Blocks:
  12.1.1.1 (Serial2/0), from 12.1.1.1, Send flag is 0x0
      Composite metric is (2681856/2169856), route is External
      Vector metric:
        Minimum bandwidth is 1544 Kbit
        Total delay is 40000 microseconds
        Reliability is 255/255
        Load is 1/255
        Minimum MTU is 1500
        Hop count is 1
        Originating router is 13.1.1.1
      External data:
        AS number of route is 0
        External protocol is Connected, external metric is 0
        Administrator tag is 0 (0x00000000)


重分布静态
R1(config)#int e0/0
R1(config-if)#ip add 200.1.1.1 255.255.255.0
R1(config)#ip route 0.0.0.0 255.255.255.0 ethernet 0/0
R1(config)#ip route 9.9.9.0 255.255.255.0 e0/0
 

R1(config-router)#redistribute static

D EX  0.0.0.0/24 [170/2195456] via 12.1.1.1, 00:00:05, Serial2/0
          2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            2.2.2.0/24 is directly connected, Loopback0
            2.2.2.2/32 is directly connected, Loopback0
          3.0.0.0/24 is subnetted, 1 subnets
D EX        3.3.3.0 [170/2244096] via 12.1.1.1, 00:15:10, Serial2/0
          9.0.0.0/24 is subnetted, 1 subnets
D EX     9.9.9.0 [170/2195456] via 12.1.1.1, 00:00:05, Serial2/0
          12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            12.1.1.0/24 is directly connected, Serial2/0
            12.1.1.2/32 is directly connected, Serial2/0
          13.0.0.0/24 is subnetted, 1 subnets
D EX        13.1.1.0 [170/2681856] via 12.1.1.1, 00:09:06, Serial2/0
D EX  200.1.1.0/24 [170/2195456] via 12.1.1.1, 00:03:11, Serial2/0
 
EIGRP重分布到ISIS中
R1(config)#router isis
R1(config-router)#redistribute eigrp 90
 
R3上的路由
          2.0.0.0/24 is subnetted, 1 subnets
i L2     2.2.2.0 [115/10] via 13.1.1.1, 00:00:02, Serial2/1
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          12.0.0.0/24 is subnetted, 1 subnets
i L2     12.1.1.0 [115/10] via 13.1.1.1, 00:00:02, Serial2/1
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/1
            13.1.1.3/32 is directly connected, Serial2/1
 
重分布静态
R1(config-router)#redistribute static ip

          2.0.0.0/24 is subnetted, 1 subnets
i L2        2.2.2.0 [115/10] via 13.1.1.1, 00:03:42, Serial2/1
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          9.0.0.0/24 is subnetted, 1 subnets
i L2     9.9.9.0 [115/10] via 13.1.1.1, 00:00:00, Serial2/1
          12.0.0.0/24 is subnetted, 1 subnets
i L2        12.1.1.0 [115/10] via 13.1.1.1, 00:03:42, Serial2/1
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/1
            13.1.1.3/32 is directly connected, Serial2/1
 
重分布直连
R1(config-router)#redistribute connected

          2.0.0.0/24 is subnetted, 1 subnets
i L2        2.2.2.0 [115/10] via 13.1.1.1, 00:05:34, Serial2/1
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          9.0.0.0/24 is subnetted, 1 subnets
i L2        9.9.9.0 [115/10] via 13.1.1.1, 00:01:52, Serial2/1
          12.0.0.0/24 is subnetted, 1 subnets
i L2        12.1.1.0 [115/10] via 13.1.1.1, 00:05:34, Serial2/1
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/1
            13.1.1.3/32 is directly connected, Serial2/1
i L2  200.1.1.0/24 [115/10] via 13.1.1.1, 00:00:03, Serial2/1

——————————————————————————————————————————————
Redistribute/Route-map

R1上的配置
interface Serial2/0
  ip address 12.1.1.1 255.255.255.0
  serial restart-delay 0
!
interface Serial2/1
  ip address 13.1.1.1 255.255.255.0
  serial restart-delay 0
!
interface Serial2/2
  ip address 14.1.1.1 255.255.255.0
  serial restart-delay 0
 
router eigrp 90
  network 13.1.1.0 0.0.0.255
  redistribute ospf 110 metric 1500 100 255 1 1500
!
router ospf 110
  router-id 1.1.1.1
  redistribute rip subnets
  network 14.1.1.0 0.0.0.255 area 0
!
router rip
  version 2
  network 12.0.0.0
  no auto-summary
 
R3上的路由
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          4.0.0.0/32 is subnetted, 1 subnets
D EX     4.4.4.4 [170/2244096] via 13.1.1.1, 00:01:58, Serial2/0
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/0
            13.1.1.3/32 is directly connected, Serial2/0
          14.0.0.0/24 is subnetted, 1 subnets
D EX     14.1.1.0 [170/2244096] via 13.1.1.1, 00:01:58, Serial2/0
 
重分布结论
在一台路由器上,将A协议重分布到B协议中
将所有运行A协议的接口(除了ISIS/CDR)
以及所有学习到了的A协议路由
重分布到B协议中
 
 
 
分发列表(distribute-list)
控制层
R4上只允许4.4.4.0的路由,14.1.1.0过滤掉。
 
R1(config)#access-list 4 permit 4.4.4.4
R1(config)#router eigrp 90
R1(config-router)#distribute-list 4 out s2/1
 
R3上的路由,一条D EX路由
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          4.0.0.0/32 is subnetted, 1 subnets
D EX     4.4.4.4 [170/2244096] via 13.1.1.1, 00:21:54, Serial2/0
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/0
            13.1.1.3/32 is directly connected, Serial2/0
 
在路由重分布的时候,过滤路由,对R1性能会更好。
R1#show run | begin r e
router eigrp 90
  distribute-list 4 out ospf 110
  network 13.1.1.0 0.0.0.255
  redistribute ospf 110 metric 1500 100 255 1 1500
 
R3上路由
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          4.0.0.0/32 is subnetted, 1 subnets
D EX     4.4.4.4 [170/2244096] via 13.1.1.1, 00:27:55, Serial2/0
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/0
            13.1.1.3/32 is directly connected, Serial2/0
 
Prefix-List:
ACL,Prefix-List
ACL:哪些地方调用,通过接口,或distributelist,数据包,路由
Prefix-List:只能抓路由
2.2.2.0/24
2.2.2.0/25                ---------->                    RIP
2.2.2.0/26
 
access-list 1 permit 2.2.20 0.0.0.255 只能控制2.2.2.0/24
 
R2(config)#ip prefix-list 1  permit 2.2.2.0/24
意义:1、网络号;必须是2.2.2.0
                      2、掩码必须是24位
R2(config)#ip prefix-list 1  permit 2.2.2.0/24 le 32
意义:1、网络号;必须是2.2.2.0
                      2、掩码必须是24到32位之间
 
R2(config)#ip prefix-list 1  permit 2.2.2.0/24  ge 26
意义:1、网络号;必须是2.2.2.0
                      2、掩码必须是26到32位之间
 
R2(config)#ip prefix-list 1  permit 2.2.2.0/24  ge 26 le 30
意义:1、网络号;必须是2.2.2.0
                      2、掩码必须是26到30位之间
 
ip prefix-list 1 permit 0.0.0.0/0 le 32
  意义:所有路由
 
只允许14.1.1.0/24路由通过
R1(config)#ip prefix-list 1 permit 14.1.1.0/24
R1(config)#router eigrp 90
R1(config-router)#distribute-list prefix 1 out s2/1
 
R3上的路由
          3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            3.3.3.0/24 is directly connected, Loopback0
            3.3.3.3/32 is directly connected, Loopback0
          13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            13.1.1.0/24 is directly connected, Serial2/0
            13.1.1.3/32 is directly connected, Serial2/0
          14.0.0.0/24 is subnetted, 1 subnets
D EX     14.1.1.0 [170/2244096] via 13.1.1.1, 00:00:18, Serial2/0
 
 
  Route Maps
Route maps are similar to a scripting language for these reasons:
 
They work like a more sophisticated access list
          They offer top-down processing.
          Once threr is a match ,leave the route map.
Lines are sequence -numbered for easier editing.
          Insertion of lines
          Deletion of lines
Router maps are named rather than numbered for easier
documentation.
Match criteria and set criteria can be used,similar to the "if,then" logic in a scriptin language.
 
Route Map Applications
The common uses of route maps are as follows:
    *Redistribution route filtering:a more sopisticated

             alternative to distribute lists

 *Policy-based routing:the abillty to determine routing policy

                      based on criteria other than the destinationnetwork
  * BGP policy implementation:the primary tool for defining
                      BGP routing policies.
 
 
 
R4上的路由
          2.0.0.0/24 is subnetted, 1 subnets
O E2     2.2.2.0 [110/20] via 14.1.1.1, 00:11:20, Serial2/1
          8.0.0.0/24 is subnetted, 1 subnets
O E2     8.8.8.0 [110/20] via 14.1.1.1, 00:00:13, Serial2/1
          12.0.0.0/24 is subnetted, 1 subnets
O E2     12.1.1.0 [110/20] via 14.1.1.1, 00:11:46, Serial2/1
          14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            14.1.1.0/24 is directly connected, Serial2/1
            14.1.1.4/32 is directly connected, Serial2/1
 
需求
1、3.3.3 .0/24 E2改成 E1
2、8.8.8.0 seed  cost  改成10
3、过滤12.1.1.0路由
 
R1上的配置
ip prefix-list 8 seq 5 permit 8.8.8.0/24
!
route-map R permit 10
  match ip address 2
  set metric-type type-1
!
route-map R permit 20
  match ip address prefix-list 8
  set metric 10
!
!
access-list 2 permit 2.2.2.0
 
R1(config)#router ospf 110
R1(config-router)#redistribute rip subnets route-map R
 
 
R4上的路由

          2.0.0.0/24 is subnetted, 1 subnets
O E1     2.2.2.0 [110/84] via 14.1.1.1, 00:01:25, Serial2/1
          8.0.0.0/24 is subnetted, 1 subnets
O E2     8.8.8.0 [110/10] via 14.1.1.1, 00:00:32, Serial2/1
          14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            14.1.1.0/24 is directly connected, Serial2/1
            14.1.1.4/32 is directly connected, Serial2/1
 
R1(config)#route-map R permit 30
空Route-map
match any
set nothing
 
R4上的路由

          2.0.0.0/24 is subnetted, 1 subnets
O E1        2.2.2.0 [110/84] via 14.1.1.1, 00:07:44, Serial2/1
          8.0.0.0/24 is subnetted, 1 subnets
O E2        8.8.8.0 [110/10] via 14.1.1.1, 00:06:51, Serial2/1
          12.0.0.0/24 is subnetted, 1 subnets
O E2     12.1.1.0 [110/20] via 14.1.1.1, 00:01:23, Serial2/1
          14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
            14.1.1.0/24 is directly connected, Serial2/1
            14.1.1.4/32 is directly connected, Serial2/1
 
  _________________________________________________________________
双点双向重分布
 
Redistribute/Route-map

 
R4(config-router)#distance 121 1.1.1.1 0.0.0.0
R1(config-router)#distance 121  4.4.4.4 0.0.0.0
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值