路由策略和策略路由实践

news2024/11/24 18:46:06

文章目录

  • 路由策略&策略路由实验
    • 一、实验概述
      • (1)、实验要求
    • 二、实验实施
      • (1)、路由器配置-AR1
        • 接口IP地址
        • OSPF配置
        • 策略路由
        • 路由策略
      • (2)、路由器配置-AR2
        • 接口IP地址
        • OSPF配置
      • (3)、路由器配置-AR3
        • 接口IP地址
        • OSPF配置
      • (4)、路由器配置-AR4
        • 接口IP地址
        • OSPF配置
      • (5)、路由器配置-AR5
        • 接口IP地址
        • OSPF配置
      • (6)、路由器配置-AR6
        • 接口IP地址
        • OSPF配置
        • 策略路由
        • 路由策略
      • (7)、LSW1
        • 基础配置
        • OSPF配置
        • traffic-filter
        • 路由策略
      • (8)、LSW2
        • 基础配置
        • OSPF配置
        • traffic-filter
        • 路由策略
    • 三、验证
      • (1)、路由检查
      • (2)、路由策略检查
      • (3)、traffic-filter
      • (4)、策略路由验证

路由策略&策略路由实验


一、实验概述

  • 实验拓扑图:

在这里插入图片描述

(1)、实验要求

要求:

  • ①.通过使用策略路由(MQC)的办法让PC1访问外部网络的流量走AR2,PC2的流量走AR3

    PC4AR4, PC5AR5

  • ②.LSW1上使用traffic-filter,要求PC2PC3不能互访

    LSW2上设置相同,要求PC4PC5不能互访

  • ③.在三层设备上配置路由策略保证PC1-PC2-PC3只能访问PC4

    PC4只能访问PC2

二、实验实施

(1)、路由器配置-AR1

  • AR1
接口IP地址
[AR1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.17.1.1/30        up         up        
GigabitEthernet0/0/1              10.0.12.1/24         up         up        
GigabitEthernet0/0/2              10.0.13.1/24         up         up        
LoopBack0                         1.1.1.1/32           up         up(s)     
NULL0                             unassigned           up         up(s)  
OSPF配置
[AR1]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 1.1.1.1 
 area 0.0.0.0 
  network 1.1.1.1 0.0.0.0 
  network 10.0.12.1 0.0.0.0 
  network 10.0.13.1 0.0.0.0 
  network 172.17.1.1 0.0.0.0 
#
return
策略路由

为了保证PC1和PC3之间互相访问的流量不被重定向下一跳,所以我们再加一条ACL3000.允许192.168.1.0/24网段访问192.168.3.0/24

并设置traffic classifier绑定ACL3000, traffic behavior 绑定动作设置为permit

[AR1]display current-configuration configuration acl-basic 
[V200R003C00]
#
acl number 2000  
 rule 5 permit source 192.168.10.0 0.0.0.255 
acl number 2001  
 rule 5 permit source 192.168.30.0 0.0.0.255

[AR1]display current-configuration configuration acl-adv 
[V200R003C00]
#
acl number 3000  
 rule 5 permit ip source 192.168.10.0 0.0.0.255 destination 192.168.30.0 0.0.0.2
55 
 rule 10 permit ip source 192.168.30.0 0.0.0.255 destination 192.168.10.0 0.0.0.
255 
#
return

[AR1]display current-configuration configuration classifier 
[V200R003C00]
#
traffic classifier permit operator or
 if-match acl 3000
traffic classifier vlan10 operator or
 if-match acl 2000
traffic classifier vlan20 operator or
 if-match acl 2001
#
return
       
[AR1]display current-configuration configuration behavior 
[V200R003C00]
#
traffic behavior permit
traffic behavior vlan10
 redirect ip-nexthop 10.0.12.2
traffic behavior vlan20
 redirect ip-nexthop 10.0.13.3
#
return  

[AR1]display current-configuration configuration trafficpolicy
[V200R003C00]
#
traffic policy PBR
 classifier vlan10 behavior vlan10
 classifier vlan20 behavior vlan20
 classifier permit behavior permit
#
return

[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]traffic-policy PBR inbound
路由策略
[AR1]display acl 2002
Basic ACL 2002, 2 rules
Acl's step is 5'
 rule 5 deny source 192.168.50.0 0.0.0.255 (6 matches)
 rule 10 permit (87 matches)
 
 [AR1]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 1.1.1.1 
 filter-policy 2002 import

(2)、路由器配置-AR2

接口IP地址
  • AR2
[AR2]display ip interfaces brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.0.12.2/24         up         up        
GigabitEthernet0/0/1              10.0.23.2/24         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         2.2.2.2/32           up         up(s)     
NULL0                             unassigned           up         up(s)
OSPF配置
[AR2]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 10.0.12.2 0.0.0.0 
  network 10.0.23.2 0.0.0.0 
#
return

(3)、路由器配置-AR3

接口IP地址
[AR3]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.0.13.3/24         up         up        
GigabitEthernet0/0/1              10.0.23.3/24         up         up        
GigabitEthernet0/0/2              10.0.34.3/24         up         up        
LoopBack0                         3.3.3.3/32           up         up(s)     
NULL0                             unassigned           up         up(s)  
OSPF配置
[AR3]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 10.0.13.3 0.0.0.0 
  network 10.0.23.3 0.0.0.0 
  network 10.0.34.3 0.0.0.0 
#
return

(4)、路由器配置-AR4

接口IP地址
[AR4]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.0.34.4/24         up         up        
GigabitEthernet0/0/1              10.0.45.4/24         up         up        
GigabitEthernet0/0/2              10.0.46.4/24         up         up        
LoopBack0                         4.4.4.4/32           up         up(s)     
NULL0                             unassigned           up         up(s)
OSPF配置
[AR4]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 4.4.4.4 0.0.0.0 
  network 10.0.34.4 0.0.0.0 
  network 10.0.45.4 0.0.0.0 
  network 10.0.46.4 0.0.0.0 
#
return

(5)、路由器配置-AR5

接口IP地址
[AR5]display ip interfaces brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.0.45.5/24         up         up        
GigabitEthernet0/0/1              10.0.56.5/24         up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         5.5.5.5/32           up         up(s)     
NULL0                             unassigned           up         up(s) 
OSPF配置
[AR5]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 5.5.5.5 0.0.0.0 
  network 10.0.45.5 0.0.0.0 
  network 10.0.56.5 0.0.0.0 
#
return

(6)、路由器配置-AR6

接口IP地址
[AR6]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              10.0.46.6/24         up         up        
GigabitEthernet0/0/1              10.0.56.6/24         up         up        
GigabitEthernet0/0/2              172.16.1.1/30        up         up        
LoopBack0                         6.6.6.6/32           up         up(s)     
NULL0                             unassigned           up         up(s) 
OSPF配置
[AR6]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 6.6.6.6 
 area 0.0.0.0 
  network 6.6.6.6 0.0.0.0 
  network 10.0.46.6 0.0.0.0 
  network 10.0.56.6 0.0.0.0 
  network 172.16.1.1 0.0.0.0 
#
return
策略路由
[AR6]display current-configuration configuration acl
[V200R003C00]
#
acl number 2000  
 rule 5 permit source 192.168.40.0 0.0.0.255 
#
acl number 2002  
 rule 5 permit source 192.168.50.0 0.0.0.255 
#
return

[AR6]display current-configuration configuration classifier 
[V200R003C00]
#
traffic classifier vlan40 operator or
 if-match acl 2000
traffic classifier vlan50 operator or
 if-match acl 2002
#
return
       
[AR6]display current-configuration configuration behavior 
[V200R003C00]
#
traffic behavior vlan40
 redirect ip-nexthop 10.0.46.4
traffic behavior vlan50
 redirect ip-nexthop 10.0.56.5
#
return

[AR6]display current-configuration configuration trafficpolicy 
[V200R003C00]
#
traffic policy PBR
 classifier vlan40 behavior vlan40
 classifier vlan50 behavior vlan50
#
return

[AR6]int g0/0/2
[AR6-GigabitEthernet0/0/2]traffic-policy PBR inbound
路由策略
[AR6]display acl 2001
Basic ACL 2001, 3 rules
Acl's step is 5'
 rule 15 deny source 192.168.10.0 0.0.0.255 (8 matches)
 rule 20 deny source 192.168.30.0 0.0.0.255 (21 matches)
 rule 25 permit (68 matches)
 
 [AR6]display current-configuration configuration ospf
[V200R003C00]
#
ospf 1 router-id 6.6.6.6 
 filter-policy 2001 import

(7)、LSW1

基础配置
[LSW1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           unassigned           down       down      
Vlanif10                          192.168.10.254/24    up         up        
Vlanif17                          172.17.1.2/30        up         up        
Vlanif20                          192.168.20.254/24    up         up        
Vlanif30                          192.168.30.254/24    up         up    
OSPF配置
[LSW1]display current-configuration configuration ospf
#
ospf 1
 area 0.0.0.0
  network 192.168.10.0 0.0.0.255
  network 192.168.20.0 0.0.0.255
  network 192.168.30.0 0.0.0.255
  network 172.17.1.2 0.0.0.0
#
return
traffic-filter
[LSW1]display acl 3000
Advanced ACL 3000, 2 rules
Acl's step is 5'
 rule 5 deny ip source 192.168.20.0 0.0.0.255 destination 192.168.30.0 0.0.0.255

 rule 10 permit ip 

[LSW1]traffic-filter inbound acl 3000
路由策略
[LSW1]display acl 2000
Basic ACL 2000, 2 rules
Acl's step is 5'
 rule 5 deny source 192.168.50.0 0.0.0.255
 rule 10 permit

 [LSW1]display current-configuration configuration ospf
#
ospf 1
 filter-policy 2000 import

(8)、LSW2

基础配置
[LSW2]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           unassigned           down       down      
Vlanif16                          172.16.1.2/30        up         up        
Vlanif40                          192.168.40.254/24    up         up        
Vlanif50                          192.168.50.254/24    up         up  
OSPF配置
[LSW2]display current-configuration configuration ospf
#
ospf 1
 area 0.0.0.0
  network 172.16.1.2 0.0.0.0
  network 192.168.40.0 0.0.0.255
  network 192.168.50.0 0.0.0.255
#
return
traffic-filter
[LSW2]display acl 3000
Advanced ACL 3000, 2 rules
Acl's step is 5'
 rule 5 deny ip source 192.168.40.0 0.0.0.255 destination 192.168.50.0 0.0.0.255
 
 rule 10 permit ip 

[LSW2]traffic-filter inbound acl 3000
路由策略
[LSW2]display acl 2000
Basic ACL 2000, 3 rules
Acl's step is 5'
 rule 5 deny source 192.168.10.0 0.0.0.255 
 rule 10 deny source 192.168.30.0 0.0.0.255 
 rule 15 permit 
 
 [LSW2]display current-configuration configuration ospf
#
ospf 1
 filter-policy 2000 import

三、验证

(1)、路由检查

  • AR1
[AR1]display ip routing-table 192.168.50.0
  • LSW1
[LSW1]display ip routing-table 192.168.50.0
  • AR6
[AR6]display ip routing-table 192.168.10.0
[AR6]display ip routing-table 192.168.30.0
  • LSW2
[LSW2]display ip routing-table 192.168.10.0
[LSW2]display ip routing-table 192.168.30.0

(2)、路由策略检查

PC1-PC2-PC3只能访问PC4

  • PC1

在这里插入图片描述

在这里插入图片描述

  • PC2

在这里插入图片描述

  • PC3

在这里插入图片描述

PC4只能访问PC2

  • PC4

在这里插入图片描述

在这里插入图片描述

(3)、traffic-filter

PC2不能访问PC3

在这里插入图片描述

PC4不能访问PC5

在这里插入图片描述

(4)、策略路由验证

PC1访问外网走AR2,PC3访问外网走AR3

在这里插入图片描述

在这里插入图片描述

PC4访问外网走AR4,PC5访问外网走AR5

在这里插入图片描述

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1834344.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

如何快速提高自己的论文写作水平?

以下是一些可以帮助快速提高论文写作水平的方法: 广泛阅读: - 阅读大量优秀的论文,包括本领域权威期刊的文章,学习其结构、思路、论证方法和语言表达。 - 同时阅读相关的专业书籍,拓宽知识储备。 确定清晰的结构&am…

国际期货投机交易的常见操作方法:

一、在开仓阶段,入市时机的选择: (1)通过基本分析法,判断市场处于牛市还是熊市 开仓阶段,入市时机的选择:当需求增加、供给减少,此时价格上升,买入期货合约&#xff1b…

【JS】上传文件显示文件的为空,显示的文件参数内容只有uid

上传的文件参数file里面只包含uid,没有其他信息 例子解决办法 例子 例如使用elment ui的el-upload组件上传文件,会导致上传的文件参数file里面只包含uid,没有其他信息,如图: 正确应为如下图: 解决办法 …

XX市政府数据交换共享平台—技术方案(812页WORD)

方案介绍: 该方案紧紧围绕建设数据强市的总目标,坚持“先行先试、鼓励创新、宽容失败,政府引导、市场主导,加强统筹、优化布局,注重安全,有序推进”的原则,通过三大体系、七大平台、十大工程的…

19.面包屑导航制作

面包屑导航制作 官网&#xff1a;组件 | Element 1. 在layout下新建BreadCrumb.vue BreadCrumb.vue <template><div class"bread-text"><el-breadcrumb class"bred"separator"/"><el-breadcrumb-item v-for"item in…

ARDUINO NRF24L01

连线 5v 3.3皆可 gnd Optimized high speed nRF24L01 driver class documentation: Optimized High Speed Driver for nRF24L01() 2.4GHz Wireless Transceiver 同时下载同一个程序 案例默认引脚ce ces &#xff0c;7&#xff0c;8 可以 修改为 9,10 安装库 第一个示例 两…

《征服数据结构》双端栈

摘要&#xff1a; 1&#xff0c;双端栈的介绍 2&#xff0c;双端栈的代码实现 1&#xff0c;双端栈的介绍 双端栈主要利用了“栈底位置不变&#xff0c;栈顶位置动态变化” 的特点&#xff0c;可以让两个栈共享一块存储空间。在前面我们讲到用数组实现栈的时候&#xff0c;如果…

中文大模型竞技场第一:MiniMax海螺AI初体验!

大家好,我是木易,一个持续关注AI领域的互联网技术产品经理,国内Top2本科,美国Top10 CS研究生,MBA。我坚信AI是普通人变强的“外挂”,所以创建了“AI信息Gap”这个公众号,专注于分享AI全维度知识,包括但不限于AI科普,AI工具测评,AI效率提升,AI行业洞察。关注我,AI之…

电脑开机后进不了系统?记好5个方法,问题轻松解决!

“我的电脑不知道出现了什么问题&#xff0c;开机后一直无法进入系统&#xff0c;有朋友知道遇到这种情况应该怎么解决吗&#xff1f;快帮帮我&#xff01;” 在这个数字化飞速发展的时代&#xff0c;电脑已经成为我们日常生活和工作中不可或缺的工具。然而&#xff0c;当电脑开…

[Python学习篇] Python元组

元组&#xff08;Tuple&#xff09;&#xff1a;元组是不可变的&#xff0c;一旦创建就不能修改其内容。这意味着你不能增加、删除或更改元组中的元素。元组使用小括号()表示。元组可以一次性存储多个数据&#xff0c;且可以存不同数据类型。 定义元组 语法&#xff1a; # 存…

海外短剧市场的机遇与挑战

引言 在全球娱乐产业蓬勃发展的背景下&#xff0c;海外短剧市场正逐渐成为新的增长点。本文将深入探讨海外短剧市场所面临的机遇与挑战&#xff0c;以期为相关从业者提供有益的参考。 一、海外短剧市场的机遇 1.观众需求增长&#xff1a;随着生活节奏的加快&#xff0c;观众对…

无代码爬虫软件八爪鱼采集器-如何设计判断是、否

多数情况下免费版本的功能&#xff0c;已经可以满足绝大多数采集需求&#xff0c;想了解八爪鱼采集器&#xff0c;我写了一套系列教程&#xff0c;请访问这篇帖子&#xff1a;【完结】无代码网页爬虫软件——八爪鱼采集器入门基础教程-CSDN博客 免费版八爪鱼采集器下载https:/…

前沿创新 | KAN模型及其组合模型回归预测应用,Python预测回归全家桶更新

声明&#xff1a;文章是从本人公众号中复制而来&#xff0c;因此&#xff0c;想最新最快了解各类算法的家人&#xff0c;可关注我的VX公众号&#xff1a;python算法小当家&#xff0c;不定期会有很多免费代码分享~ 前沿创新 | KAN模型及其组合模型回归预测应用&#xff0c;Pyt…

TOP10!YashanDB斩获广东省优秀信创产品与解决方案双料荣誉

近日&#xff0c;2024广东软件风云榜结果出炉&#xff0c;表彰为广东软件产业和数字经济、新型工业化发展作出突出贡献的企业、企业家、优秀产品等。深算院崖山数据库系统 YashanDB荣获广东省“2024年优秀信息技术应用创新产品TOP10”和“2024年优秀信息技术应用创新行业应用解…

CentOS 7.9上创建JBOD(一)

系列文章目录 CentOS 7.9上创建的JBOD阵列恢复&#xff08;二&#xff09; CentOS 7.9检测硬盘坏区、实物定位&#xff08;三&#xff09; 文章目录 系列文章目录前言一、安装 mdadm工具二、创建JBOD设备三、为JBOD扩容&#xff08;增加一个硬盘&#xff09;四、最后&#xff…

【深度学习】Loss为Nan的可能原因

文章目录 1. 问题情境2. 原因分析3. 导致Loss为Nan的其他可能原因 1. 问题情境 在某个网络架构下&#xff0c;我为某个数据项引入了一个损失函数。 这个数据项是nn.Embedding类型的&#xff0c;我加入的损失函数是对nn.Embedding空间做约束。 因为我在没加入优化loss前&#x…

根据多选的选择,动态匹配/生成接口里面的数据

最近遇到一个需求,一开始以为接口里面只会返回三个数据,就直接调取接口,页面写三个html结构接口数据放在那里了,后来接口又加了两条,因为前端这边没写结构,就没出来… 所以直接给他改为动态匹配的,不管后续后台这边添加多少条,都能保证数据出来 我的路径:之后看src\views\partn…

刷代码随想录有感(107):动态规划——01背包/最后一块石头的重量||

题干&#xff1a; 代码&#xff1a; class Solution { public:int lastStoneWeightII(vector<int>& stones) {vector<int>dp(15001, 0);int sum 0;for(int i : stones){sum i;}int target sum / 2;for(int i 0; i < stones.size(); i){for(int j targ…

如何正确操作工业高温烤箱

高温烤箱广泛应用于陶瓷、丝印、汽车配件、电子、机电、通讯、化工、器材、印刷、制药、工业、橡胶、油漆、食品之烘烤、水份干燥、预热等用途。那么要想工业高温烤箱在使用的过程中能够正常运行&#xff0c;那么正确的操作是必不可少的&#xff0c; 1、防止触电&#xff1a;高…

文章MSM_metagenomics(九):偏差图、UpSet图、棒棒糖图

欢迎大家关注全网生信学习者系列&#xff1a; WX公zhong号&#xff1a;生信学习者Xiao hong书&#xff1a;生信学习者知hu&#xff1a;生信学习者CDSN&#xff1a;生信学习者2 介绍 本教程旨在通过不同的图表来可视化微生物组的生物标志物。 数据 大家通过以下链接下载数据…