锐捷RSR系列路由器_IP路由协议_路由控制

目录

01  路由控制介绍

02  distribute-list 分发列表

03  route-map 路由图


 

01  路由控制介绍

ACL 与 prefix-list

相同点:

都可以用来匹配路由前缀

不同点:

ACL可以用来过滤数据包,匹配ip报文的五大元素,prefix-list 只能用来匹配路由前缀

如何选择:

匹配路由前缀时,使用ACL或使用prefix-list 均可以,两者只要选择其一。当需要匹配一个大网段下的不同掩码长度的路由前缀时,使用prefix-list 更加方便。

distribute-list 与 route-map

相同点:

都可以用来做路由过滤

不同点:

1)distribute-list 只能过滤路由条目,无法修改路由属性;route-map除了可以过滤路由条目,还能够修改路由属性。

2)route-map可以强制修改数据包的下一跳,做策略路由。

3)distribute-list 应用的地方为:路由协议重分发时距离矢量路由协议邻居之间的路由传递(距离矢量协议邻居之间传递的是路由,因此可以做路由过滤)及链路状态路由协议将路由提交路由表时(链路状态协议邻居之间传递的是lsa并非路由,不能过滤邻居之间传递的lsa)。

4)route-map应用的地方为:路由协议重分发时,bgp邻居传递路由时。

如何选择:

看具体的应用场景,若distribute-list 与route-map均能够使用,那么若需要修改路由属性,必须使用route-map;若不需要修改路由属性,2者选其一就可以。


02  distribute-list 分发列表

功能介绍:

distribute-list 分发列表,通过distribute-list 工具对路由更新进行控制,只能进行路由条目过滤,不能修改路由的属性

一、组网要求

在R2上把rip路由重分发进ospf,并且在重分发时进行路由过滤,只允许路由 172.16.1.32/28、172.16.1.48/29、172.16.1.56/30重分发进ospf

二、组网拓扑

 

 

三、配置要点

1、基本ip地址配置

2、R1、R2启用rip协议,并将对应接口通告到rip进程

3、R2、R3启用ospf协议,并将对应接口通告到ospf进程

4、在R2上把rip学习到的路由重分发进ospf

5、通过acl或前缀列表,把需要学习的路由匹配出来

6、R2 rip路由重分发进ospf,使用distribute-list 过滤路由

四、配置步骤

1、基本ip地址配置

Ruijie(config)#hostname R1

R1(config)#interface fastEthernet 0/0

R1(config-if-FastEthernet 0/0)#ip address 192.168.1.1 255.255.255.0

R1(config-if-FastEthernet 0/0)#exit

R1(config)#interface loopback 1

R1(config-if-Loopback 1)#ip address 172.16.1.1 255.255.255.224

R1(config-if-Loopback 1)#exit

R1(config)#interface loopback 2

R1(config-if-Loopback 2)#ip address 172.16.1.33 255.255.255.240

R1(config-if-Loopback 2)#exit

R1(config)#interface loopback 3

R1(config-if-Loopback 3)#ip address 172.16.1.49 255.255.255.248

R1(config-if-Loopback 3)#exit

R1(config)#interface loopback 4

R1(config-if-Loopback 4)#ip address 172.16.1.57 255.255.255.252

R1(config-if-Loopback 4)#exit

Ruijie(config)#hostname R2

R2(config)#interface fastEthernet 0/2

R2(config-if-FastEthernet 0/2)#ip address 192.168.1.2 255.255.255.0

R2(config-if-FastEthernet 0/2)#exit

R2(config)#interface fastEthernet 0/0

R2(config-if-FastEthernet 0/0)#ip address 192.168.2.1 255.255.255.0

R2(config-if-FastEthernet 0/0)#exit

Ruijie(config)#hostname R3

R3(config)#interface fastEthernet 0/1

R3(config-if-FastEthernet 0/1)#ip address 192.168.2.2 255.255.255.0

R3(config-if-FastEthernet 0/1)#exit

2、R1、R2启用rip协议,并将对应接口通告到rip进程

R1(config)#router rip

R1(config-router)#version 2     //启用rip版本2

R1(config-router)#no auto-summary     //关闭自动汇总

R1(config-router)#network 172.16.0.0     //将172.16.0.0的主类网络通告到rip进程

R1(config-router)#network 192.168.1.0  

R1(config-router)#exit

R2(config)#router rip

R2(config-router)#version 2

R2(config-router)#no auto-summary

R2(config-router)#network 192.168.1.0

R2(config-router)#exit

3、R2、R3启用ospf协议,并将对应接口通告到ospf进程

R2(config)#router ospf 1    //启用ospf进程 1

R2(config-router)#network 192.168.2.1 0.0.0.0 area 0    //将192.168.2.1对应的接口通告到ospf 进程1的区域 0

R2(config-router)#exit

R3(config)#router ospf 1

R3(config-router)#network 192.168.2.2 0.0.0.0 area 0

R3(config-router)#exit

4、在R2上把rip学习到的路由重分发进ospf

R2(config)#router ospf 1

R2(config-router)#redistribute rip subnets    //将rip路由重分发进ospf,必须加subnet

R2(config-router)#exit

5、通过acl或前缀列表,把需要学习的路由匹配出来

注意:

1)匹配路由条目的工具有acl和前缀列表两种,只要选择其中一种就可以

2)若需要匹配一个大网段下的不同掩码长度的路由前缀时,前缀列表会更方便一些,当然用acl也是可以的,只是要写多个条目

如下示例,匹配路由条目172.16.1.32/27、172.16.1.48/28和172.16.1.56/29,acl需要写3个ace条目,前缀列表只要1个条目

1)使用acl匹配路由条目

注意:

此处acl匹配的是路由条目,掩码用0.0.0.0精确匹配对应的路由条目

R2(config)#ip access-list standard 1

R2(config-std-nacl)#10 permit 172.16.1.32 0.0.0.0

R2(config-std-nacl)#20 permit 172.16.1.48 0.0.0.0

R2(config-std-nacl)#30 permit 172.16.1.56 0.0.0.0

R2(config-std-nacl)#exit                 

2)使用前缀列表匹配路由条目

注意:

1)前缀列表只能用来匹配路由条目,不能用来做数据包过滤

2)前缀列表匹配的是一个网段下的子网,ge代表大于等于多少位掩码,le代表小于多少位掩码

3)前缀列表也是从上往下匹配,最后隐含一条deny any

R2(config)#ip prefix-list ruijie seq 10 permit 172.16.1.0/24 ge 28 le 30   //定义前缀列表ruijie,匹配前缀为172.16.1.0/24,子网掩码大于等于28小于等于30的路由条目

6、R2 rip路由重分发进ospf,使用distribute-list 过滤路由

注意

1)distribute-list过滤的路由条目是由acl和前缀列表匹配出来的,具体过滤什么路由条目是由acl和前缀列表决定的

2)distribute-list可以运用的地方为,路由协议重分发时距离矢量路由协议邻居之间的路由传递(距离矢量协议邻居之间传递的是路由,因此可以做路由过滤)及链路状态路由协议将路由提交路由表时(链路状态协议邻居之间传递的是lsa并非路由,不能过滤邻居之间传递的lsa)。

如下以distribute-list 调用acl及前缀列表做路由过滤,分别举例:

1)distribute-list 调用acl做路由过滤

R2(config)#router ospf 1   

R2(config-router)#distribute-list 1 out rip     //把rip路由重分发进ospf时做路由过滤(注意方向必须是out

R2(config-router)#exit

2)distribute-list 调用前缀列表做路由过滤

R2(config)#router ospf 1

R2(config-router)#distribute-list prefix ruijie out rip    //把rip路由重分发进ospf时做路由过滤(注意方向必须是out

R2(config-router)#exit

补充:

1)距离矢量协议使用distribute-list 过滤邻居之间传递的路由条目,命令如下:

R2(config)#router rip

R2(config-router)#distribute-list 1 in fastEthernet 0/2   //1代表acl 列表 1,也可用前缀列表; in代表从邻居学习的路由,若为out则是传递给邻居的路由;还可以加上具体的接口

2)链路状态协议使用distribute-list 过滤提交给路由表的路由条目

R2(config)#router ospf 1

R2(config-router)#distribute-list 1 in    //代表acl 列表 1,也可用前缀列表; 方向必须为in

五、配置验证

查看R3的路由条目,若R3学习到的路由条目为 172.16.1.32/28、172.16.1.48/29、172.16.1.56/30 则distribute-list做路由过滤配置正确

R3#show ip route

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

        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

Gateway of last resort is no set

O E2 172.16.1.32/28 [110/20] via 192.168.2.1, 00:02:45, FastEthernet 0/1

O E2 172.16.1.48/29 [110/20] via 192.168.2.1, 00:02:29, FastEthernet 0/1

O E2 172.16.1.56/30 [110/20] via 192.168.2.1, 00:02:21, FastEthernet 0/1

C    192.168.2.0/24 is directly connected, FastEthernet 0/1

C    192.168.2.2/32 is local host.


03  route-map 路由图

功能介绍:

route-map 路由图,通过route-map工具可以对路由更新进行控制,并且能够修改路由的属性

一、组网要求

在R2上把rip路由重分发进ospf,并且在重分发时进行路由过滤,只允许路由 172.16.1.32/28、172.16.1.48/29、172.16.1.56/30重分发进ospf ,引入的外部路由类型为OE1,metric为50。

二、组网拓扑

 

三、配置要点

1、基本ip地址配置

2、R1、R2启用rip协议,并将对应接口通告到rip进程

3、R2、R3启用ospf协议,并将对应接口通告到ospf进程

4、在R2上把rip学习到的路由重分发进ospf

5、通过acl或前缀列表,把需要学习的路由匹配出来

6、配置route-map

7、R2将rip路由重分发进ospf,调用route-map做路由控制

四、配置步骤

1、基本ip地址配置

Ruijie(config)#hostname R1

R1(config)#interface fastEthernet 0/0

R1(config-if-FastEthernet 0/0)#ip address 192.168.1.1 255.255.255.0

R1(config-if-FastEthernet 0/0)#exit

R1(config)#interface loopback 1

R1(config-if-Loopback 1)#ip address 172.16.1.1 255.255.255.224

R1(config-if-Loopback 1)#exit

R1(config)#interface loopback 2

R1(config-if-Loopback 2)#ip address 172.16.1.33 255.255.255.240

R1(config-if-Loopback 2)#exit

R1(config)#interface loopback 3

R1(config-if-Loopback 3)#ip address 172.16.1.49 255.255.255.248

R1(config-if-Loopback 3)#exit

R1(config)#interface loopback 4

R1(config-if-Loopback 4)#ip address 172.16.1.57 255.255.255.252

R1(config-if-Loopback 4)#exit

Ruijie(config)#hostname R2

R2(config)#interface fastEthernet 0/2

R2(config-if-FastEthernet 0/2)#ip address 192.168.1.2 255.255.255.0

R2(config-if-FastEthernet 0/2)#exit

R2(config)#interface fastEthernet 0/0

R2(config-if-FastEthernet 0/0)#ip address 192.168.2.1 255.255.255.0

R2(config-if-FastEthernet 0/0)#exit

Ruijie(config)#hostname R3

R3(config)#interface fastEthernet 0/1

R3(config-if-FastEthernet 0/1)#ip address 192.168.2.2 255.255.255.0

R3(config-if-FastEthernet 0/1)#exit

2、R1、R2启用rip协议,并将对应接口通告到rip进程

R1(config)#router rip

R1(config-router)#version 2     //启用rip版本2

R1(config-router)#no auto-summary     //关闭自动汇总

R1(config-router)#network 172.16.0.0     //将172.16.0.0的主类网络通告到rip进程

R1(config-router)#network 192.168.1.0  

R1(config-router)#exit

R2(config)#router rip

R2(config-router)#version 2

R2(config-router)#no auto-summary

R2(config-router)#network 192.168.1.0

R2(config-router)#exit

3、R2、R3启用ospf协议,并将对应接口通告到ospf进程

R2(config)#router ospf 1    //启用ospf进程 1

R2(config-router)#network 192.168.2.1 0.0.0.0 area 0    //将192.168.2.1对应的接口通告到ospf 进程1的区域 0

R2(config-router)#exit

R3(config)#router ospf 1

R3(config-router)#network 192.168.2.2 0.0.0.0 area 0

R3(config-router)#exit

4、在R2上把rip学习到的路由重分发进ospf

R2(config)#router ospf 1

R2(config-router)#redistribute rip subnets    //将rip路由重分发进ospf,必须加subnet

R2(config-router)#exit

5、通过acl或前缀列表,把需要学习的路由匹配出来

注意:

1)匹配路由条目的工具有acl和前缀列表两种,只要选择其中一种就可以

2)若需要匹配一个网段下的几个子网路由,那么用前缀列表会更方便一线,当然用acl也是可以的,只是要写多个条目

如下示例,匹配路由条目172.16.1.32/27、172.16.1.48/28和172.16.1.56/29,acl需要写3个ace条目,前缀列表只要1个条目

1)使用acl匹配路由条目

注意:

此处acl匹配的是路由条目,掩码用0.0.0.0精确匹配对应的路由条目

R2(config)#ip access-list standard 1

R2(config-std-nacl)#10 permit 172.16.1.32 0.0.0.0

R2(config-std-nacl)#20 permit 172.16.1.48 0.0.0.0

R2(config-std-nacl)#30 permit 172.16.1.56 0.0.0.0

R2(config-std-nacl)#exit                 

2)使用前缀列表匹配路由条目

注意:

1)前缀列表只能用来匹配路由条目,不能用来做数据包过滤

2)前缀列表匹配的是一个网段下的子网,ge代表大于等于多少位掩码,le代表小于多少位掩码

3)前缀列表也是从上往下匹配,与acl的匹配顺序及规则是一样的

R2(config)#ip prefix-list ruijie seq 10 permit 172.16.1.0/24 ge 28 le 30   //定义前缀列表ruijie,匹配前缀为172.16.1.0/24,子网掩码大于等于28小于等于30的路由条目

6、配置route-map

注意:

1)route-map除了可以用来做路由过滤,还能够修改路由的属性

2)route-map可以match的条件比较多(包括 路由条目、metric、metric-type等条件),distribute-list只能匹配路由条目

3)route-map的执行顺序从上到下,最后隐含一条deny any

4)route-map的执行逻辑如下:

route-map aaa permit 10
match x y z   
//多个match条件横着写,是or的关系,只要满足其中一个条件,该match语句就算匹配
match a 
      set b   //
多个set语句竖着写,会同时执行多个set动作
      set c

route-map aaa permit 20
   match p

    match q       //多个match条件竖着写,是and的关系,要多个条件同时满足,该match语句才算匹配
      set r

route-map aaa deny any (系统隐含)

执行逻辑如下:

 If (x or y or z)
then set(b and c)
else if (p and q)
      then set r
      else deny

route-map的match ip address 可以匹配acl列表,也可以匹配前缀列表,只要选择其中一种就可以,如下分别示例:

1)match ip address 使用acl列表匹配

R2(config)#route-map aaa permit 10

R2(config-route-map)#match ip address 1     //匹配acl列表1的路由条目

R2(config-route-map)#set metric-type type-1     //配置引入的外部路由类型为类型1

R2(config-route-map)#set metric 50  //配置引入的外部路由 metric为50

R2(config-route-map)#exit

2)match ip address 使用前缀列表匹配

R2(config)#route-map aaa permit 10

R2(config-route-map)#match ip address prefix-list ruijie   //匹配前缀列表ruijie的路由条目

R2(config-route-map)#set metric-type type-1  

R2(config-route-map)#set metric 50

R2(config-route-map)#exit

7、R2将rip路由重分发进ospf,调用route-map做路由控制

注意:

route-map的调用位置可以为路由重分发以及BGP协议neighbor指邻居

R2(config)#router ospf 1

R2(config-router)#redistribute rip subnets route-map aaa    //将rip路由重分发进ospf时,调用route-map aaa

R2(config-router)#exit

补充:

BGP协议指neighbor调用route-map的配置命令如下

R2(config)#router bgp 1

R2(config-router)#neighbor 10.1.1.1 route-map aaa in   // 方向in代表对从该邻居学习的路由做控制,方向out代表发给该邻居的路由做控制(对bgp邻居使用route-map做路由控制,配置route-map后,需要通过软清除bgp邻居的路由,才能使配置生效,该操作请勿在业务高峰期进行)

五、配置验证

查看R3的路由条目,若R3学习到的路由条目为 172.16.1.32/28、172.16.1.48/29、172.16.1.56/30,且为OE1的路由,并叠加内部cost, 则route-map做路由控制配置正确

R3#show ip route

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

        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

Gateway of last resort is no set

O E1 172.16.1.32/28 [110/51] via 192.168.2.1, 00:03:14, FastEthernet 0/1

O E1 172.16.1.48/29 [110/51] via 192.168.2.1, 00:03:14, FastEthernet 0/1

O E1 172.16.1.56/30 [110/51] via 192.168.2.1, 00:03:14, FastEthernet 0/1

C    192.168.2.0/24 is directly connected, FastEthernet 0/1

C    192.168.2.2/32 is local host.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
锐捷4台路由器的浮动路由可以通过配置多条静态路由来实现。在配置静态路由时,可以通过调整路由的AD值(路由可信度)来实现主备链的备份。AD值越小,路由越优先被选取为主用路由。当主用路由的下一跳不可达时,备用路由会自动生效切换为主用。 在以太网链上,建议配置静态路由时使用出接口+下一跳地址的方式。例如,可以使用以下命令配置静态路由: Ruijie(config)#ip route 0.0.0.0 0.0.0.0 GigabitEthernet 2/1/0 9.9.12.1 而在PPP、HDLC广域网链上,静态路由可以配置为本地出接口和下一跳IP地址均可以,因为PPP、HDLC为点到点链,不涉及二层地址解析。 使用静态路由的另一个好处是网络安全性高。相比动态路由需要频繁地交换路由表,静态路由不会产生更新流量,从而提高了网络的安全保密性。 因此,通过配置多条静态路由并调整AD值,可以实现锐捷4台路由器的浮动路由,以备份主用链并提高网络的安全性。 #### 引用[.reference_title] - *1* [锐捷路由技术系列](https://blog.csdn.net/qq_40907977/article/details/106312490)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [锐捷——浮动静态路由配置](https://blog.csdn.net/Yang__Qi/article/details/125467650)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [华为与思科路由器静态路由配置](https://blog.csdn.net/qq_35029061/article/details/128187968)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

你可知这世上再难遇我

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值