Postman下发流表至Opendaylight

目录

任务目的

任务内容

实验原理

实验环境

实验过程

1、打开ODL控制器

2、网页端打开ODL控制页面

3、创建拓扑

4、Postman中查看交换机的信息

5、L2层流表下发

6、L3层流表下发

7、L4层流表下发


任务目的

1、掌握OpenFlow流表相关知识,理解SDN网络中L2,L3,L4层流表的概念。

2、学习并熟练掌握Postman工具下发L2,L3,L4层流表。

任务内容

1、学习OpenFlow流表的组成,包头域的解析流程及流表的匹配流程。

2、熟悉OpenDaylight对接Mininet的使用。

3、使用Postman工具,下发相应的L2,L3,L4层流表,并验证。

实验原理

        SDN的设计目标之一就是将网络设备的控制功能与转发功能进行分离,进而将控制功能全部集中到远程的控制器上完成,而SDN交换机只负责在本地做简单高速的数据转发。在SDN交换机运行的过程中,其数据转发的依据就是流表。

实验环境

实验过程

1、打开ODL控制器

        这里已经把ODL控制器的添加到了环境变量中,所以直接使用karaf命令就可以启动ODL控制器,如果没有添加到环境变量中就需要进入到ODL安装目录使用命令:./bin/karaf启动ODL

2、网页端打开ODL控制页面

        我这里电脑的IP地址为192.168.112.132,因此在浏览器中输入:http://192.168.112.132:8181/index.html即可进入ODL控制器的页面

3、创建拓扑

        在另一台安装了mininet的虚拟机上创建拓扑并将控制器的地址改为192.168.112.132

mn --topo=single,2 --controller=remote,ip=192.168.112.132,port=6633 --switch ovsk,protocols=OpenFlow13
pingall

        此时ODL页面就已经可以看到topo了

4、Postman中查看交换机的信息

        Basic Auth页签,Username字段填写admin,Password字段填写admin完成认证。

        提交方式为GET,URL地址栏中输入http://192.168.112.132:8080/restconf/operational/network-topology:network-topology ,设置完成,单击Send按钮,获取交换机id信息输入

5、L2层流表下发

下发第一条L2流表

        选择提交方式“PUT”

        URL地址栏输入如下形式的地址:http://{controllerip}:8080/restconf/config/opendaylight-inventory:nodes/node/{node-id}/table/{table-id}/flow/{flow-id}

        其中,{controller-ip}为控制器的ip地址,node-id为上面获取到的交换机id信息,table-id这里为0,flow-id根据下发不同流表变化,可自定义。

        如:http://192.168.112.132:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/107

        “body”中选择“raw”,格式为XML(application/xml),并填写如下消息体,注意修改源目MAC地址(源地址为1端口连接的主机,目的地址为2端口连接的地址)

        下发流表:匹配源MAC为ce:45:a4:38:08:d0的流量,目的MAC为76:ae:0d:50:d7:ad,出端口为2,优先级为300

        这里可以看到交换机的2端口连接的是76:ae:0d:50:d7:ad,因此以下配置中目的地址为:76:ae:0d:50:d7:ad,源地址为:ce:45:a4:38:08:d0

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>200</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-source>
<address>ce:45:a4:38:08:d0</address>
</ethernet-source>
<ethernet-destination>
<address>76:ae:0d:50:d7:ad</address>
</ethernet-destination>
</ethernet-match>
</match>
<id>107</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>2</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

         mininet上查看流表是否增加了一条优先级为300的流表

sh ovs-ofctl dump-flows s1 -O openflow13

下发第二条L2流表

        下发流表:匹配源MAC为76:ae:0d:50:d7:ad的流量,目的MAC为ce:45:a4:38:08:d0,出端口为1,优先级为300

        这里的源目MAC地址与第一条流表中的应该相反,且流ID不能再是107,应该换一个,比如108

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>200</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-source>
<address>76:ae:0d:50:d7:ad</address>
</ethernet-source>
<ethernet-destination>
<address>ce:45:a4:38:08:d0</address>
</ethernet-destination>
</ethernet-match>
</match>
<id>108</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>1</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

        在mininet上查询流表是否已经下发

sh ovs-ofctl dump-flows s1 -O openflow13

         测试下发的流表是否有效

pingall

         此处可以看到,匹配流表的数据增加了

6、L3层流表下发

        L3层对应OSI模型的三层,三层流表主要匹配的是IP包的协议类型和IP地址

        URL地址栏输入:http://192.168.112.132:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/111

        流表:匹配源IP地址为10.0.0.1/32的报文,并将其转发到2端口

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>300</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
<ipv4-source>10.0.0.1/32</ipv4-source>
</match>
<id>111</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>2</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

        URL地址栏输入:http://192.168.112.132:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/112

        匹配源IP地址为10.0.0.2/32的报文,并将其转发到1端口。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>300</priority>
<flow-name>Foo2</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
<ipv4-source>10.0.0.2/32</ipv4-source>
</match>
<id>112</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>1</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

        URL地址栏输入:http://192.168.112.132:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/113

        流表:下发arp匹配流表

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>300</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-type>
<type>2054</type>
</ethernet-type>
</ethernet-match>
</match>
<id>113</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>NORMAL</output-node-connector>
<max-length>0</max-length>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

7、L4层流表下发

        L4对应的OSI模型中的四层,即流表对应的TCP/UDP源端口(TCP/UDP src port)、TCP/UDP目的端口号(TCP/UDP dst port)字段。本实验匹配TCP目的端口

        URL地址栏输入http://192.168.112.132:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/117

        匹配到目的IP地址为10.0.0.1/32且目的端口为5001的TCP报文,将其转发到2端口

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>300</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<tcp-destination-port>5001</tcp-destination-port>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
<ipv4-destination>10.0.0.1/32</ipv4-destination>
<ip-match>
<ip-protocol>6</ip-protocol>
</ip-match>
</match>
<id>117</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>2</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

        URL地址栏输入http://192.168.112.132:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/118

        匹配到目的IP地址为10.0.0.2/32且目的端口为5001的TCP报文,将其转发到1端口

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>300</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<tcp-destination-port>5001</tcp-destination-port>
<ethernet-match>
<ethernet-type>
<type>2048</type>
</ethernet-type>
</ethernet-match>
<ipv4-destination>10.0.0.2/32</ipv4-destination>
<ip-match>
<ip-protocol>6</ip-protocol>
</ip-match>
</match>
<id>118</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>1</output-node-connector>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

        URL地址栏输入http://192.168.112.132:8080/restconf/config/opendaylight-inventory:nodes/node/openflow:1/table/0/flow/119

        流表:下发arp匹配流表

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<priority>300</priority>
<flow-name>Foo1</flow-name>
<idle-timeout>0</idle-timeout>
<hard-timeout>0</hard-timeout>
<match>
<ethernet-match>
<ethernet-type>
<type>2054</type>
</ethernet-type>
</ethernet-match>
</match>
<id>119</id>
<table_id>0</table_id>
<instructions>
<instruction>
<order>0</order>
<apply-actions>
<action>
<order>0</order>
<output-action>
<output-node-connector>FLOOD</output-node-connector>
<max-length>0</max-length>
</output-action>
</action>
</apply-actions>
</instruction>
</instructions>
</flow>

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

飞书API 2-1:如何通过 API 创建文件夹?

本文探讨如何通过飞书的 API 来创建文件夹。通过 API 创建的文件夹&#xff0c;一般是放在共享空间&#xff0c;如果要放在个人空间&#xff0c;建议手动创建。 查看 API 文档 API 路径&#xff0c;可在飞书开放平台的服务端 API&#xff0c;依次查找云文档>云空间>文件…

javaWeb项目-springboot+vue人事管理系统功能介绍

本项目源码&#xff1a;java-springbootvue人事管理系统源码说明文档资料资源-CSDN文库 项目关键技术 开发工具&#xff1a;IDEA 、Eclipse 编程语言: Java 数据库: MySQL5.7 框架&#xff1a;ssm、Springboot 前端&#xff1a;Vue、ElementUI 关键技术&#xff1a;springboot…

高级人工智能复习 题目整理 中科大

题目整理 填空 1.准确性&#xff0c;复杂性&#xff0c;验证集 2. 3 2 n 3^{2^n} 32n 3 C 2 n m 3^{C^m_{2n}} 3C2nm​ 3 m 3^m 3m n 1 n1 n1 3. 状态 从状态s采取行动a后继续采用策略 π \pi π的收益 环境 4. 语法 语义 推理规则 5. 参与者&#xff0c;策略集&#xff…

算法排序之冒泡排序及优化

public class Bubbling {public static void main(String[] args) {// 定义需要排序的数组int[] arr {0,1,21,2,31,12,5,8};// 冒泡排序方法bubbleSort(arr);bubbleOptSort(arr);}/*** 冒泡排序* param arr 数组*/public static void bubbleSort(int[] arr){// i0&#xff0c;…

【C语言】解决C语言报错:Format String Vulnerability

文章目录 简介什么是Format String VulnerabilityFormat String Vulnerability的常见原因如何检测和调试Format String Vulnerability解决Format String Vulnerability的最佳实践详细实例解析示例1&#xff1a;直接使用不受信任的输入作为格式化字符串示例2&#xff1a;未验证格…

英伟达开源最强通用模型Nemotron-4 340B:开启AI合成数据新纪元

【震撼发布】 英伟达最新力作——Nemotron-4 340B,一个拥有3400亿参数的超级通用模型,震撼登场!这不仅是技术的一大飞跃,更是AI领域的一次革命性突破! 【性能卓越】 Nemotron-4 340B以其卓越的性能超越了Llama-3,专为合成数据而生。它将为医疗健康、金融、制造、零售等行…

基于WPF技术的换热站智能监控系统09--封装水泵对象

1、添加用户控件 2、编写水泵UI 控件中用到了Viewbox控件&#xff0c;Viewbox控件是WPF中一个简单的缩放工具&#xff0c;它可以帮助你放大或缩小单个元素&#xff0c;同时保持其宽高比。通过样式和属性设置&#xff0c;你可以创建出既美观又功能丰富的用户界面。在实际开发中…

RabbitMQ揭秘:轻量级消息队列的优缺点全解析

我是小米,一个喜欢分享技术的29岁程序员。如果你喜欢我的文章,欢迎关注我的微信公众号“软件求生”,获取更多技术干货! 亲爱的读者朋友们,大家好!我是小米,一个热爱技术、喜欢分享的大哥哥。今天我们来聊聊一个在消息队列领域非常重要的工具——RabbitMQ。作为一个在通信…

EasyExcel文件导出,出现有文件但没有数据的问题

一开始由于JDK版本过高&#xff0c;我用的17&#xff0c;一直excel没有数据&#xff0c;表头也没有&#xff0c;后来摸索了好久&#xff0c;找了资料也没有&#xff0c;后来改了代码后报了一个错误&#xff08;com.alibaba.excel.exception.ExcelGenerateException: java.lang.…

如何让视频有高级感 高级感视频制作方法 高级感视频怎么剪 会声会影视频剪辑制作教程 会声会影中文免费下载

高质量视频通常具有清晰的画面、优质的音频和令人印象深刻的视觉效果。这篇文章来了解如何让视频有高级感&#xff0c;高级感视频制作方法。 一、如何让视频有高级感 要让视频有高级感&#xff0c;要注意以下几个要点&#xff1a; 1、剧本和故事性&#xff1a;一个好的剧本和…

Vue主要使用-03

组件通讯 组件通讯也是我们需要了解的,在我们的实际开发中,我们使用的非常多,比如父组件内的数据传入到子组件,子组件的数据传入到父组件,什么是父组件什么是子组件&#xff1f;父组件内包含着我们的子组件,我们的父组件可以有多个子组件,父组件就是我们使用子组件拼接的。 …

001 Spring介绍

文章目录 特点1.方便解耦&#xff0c;简化开发2.AOP编程的支持3.声明式事务的支持4.方便程序的测试5.方便集成各种优秀框架6.降低Java EE API的使用难度7.Java源码是经典学习范例 好处什么是耦合和内聚耦合性&#xff0c;也叫耦合度&#xff0c;是对模块间关联程度的度量内聚标…

如何学习VBA_3.3.3:VBA对于工作簿、工作表的一般操作

我给VBA的定义&#xff1a;VBA是个人小型自动化处理的有效工具。利用好了&#xff0c;可以大大提高自己的劳动效率&#xff0c;而且可以提高数据处理的准确度。我推出的VBA系列教程共九套和一部VBA汉英手册&#xff0c;现在已经全部完成&#xff0c;希望大家利用、学习。 如果…

嵌入式微处理器重点学习(三)

堆栈操作 R1=0x005 R3=0x004 SP=0x80014 STMFD sp!, {r1, r3} 指令STMFD sp!, {r1, r3}是一条ARM架构中的存储多个寄存器到内存的指令,这里用于将r1和r3寄存器的内容存储到栈上。STMFD(Store Multiple Full Descending)是一种全递减模式的多寄存器存储指令,它会先将栈指针…

【MATLAB】语法

MATLAB 基本语法(%{和%}) 赋值 函数名值&#xff1b;for for i1:10循环语句 end//while x0; sum0; while x<100sumsumx;x; end//if if x > 1f x^2 1; elsef 2 * x endswitch onum input(请输入一个数); switch num case -1 //注意case后面没有冒号disp(I am…

大数据与人工智能在保险行业数字化转型中的应用

随着科技的快速发展&#xff0c;大数据和人工智能&#xff08;AI&#xff09;技术在保险行业中扮演着越来越重要的角色&#xff0c;推动了保险行业的数字化转型。通过收集和分析海量的用户数据&#xff0c;利用先进的人工智能算法&#xff0c;保险公司能够更准确地评估风险&…

7z压缩文件解压缩遇到文件末端错误

错误如上。我是之前使用7zip压缩软件压缩本地视频为7z格式&#xff0c;然后将压缩包上传到阿里云盘。今天通过阿里云盘下载这个文件&#xff0c;结果使用7zip解压压缩软件 解压缩这个文件遇到“文件末端错误”&#xff0c;然后在网上找了一圈也没有找到解决办法。 我用winrar解…

window11 系统更新失败处理办法

方法一&#xff1a;运行 Windows 更新疑难解答 按 Win I 打开设置。选择“系统”。选择“疑难解答”&#xff0c;然后点击“其他疑难解答”。找到“Windows 更新”&#xff0c;并运行疑难解答。 方法二&#xff1a;使用 DISM 工具修复系统文件 在开始菜单中搜索“命令提示符…

Perplexity AI — 探索网络,发掘知识,沟通思想

体验地址&#xff1a;Perplexity AI &#xff08;国外网站访问需要梯子&#xff09; Perplexity AI是一款功能强大的人工智能搜索引擎&#xff0c;其特点和优势主要体现在以下几个方面&#xff1a; 功能&#xff1a; 自然语言搜索&#xff1a;Perplexity AI可以理解用户的自然…

【AI实践】Dify调用本地和在线模型服务

背景 Ollama可以本地部署模型&#xff0c;如何集成私有数据、如何外部应用程序对接&#xff0c;因此需要有一个应用开发框架 Dify功能介绍 欢迎使用 Dify | 中文 | Dify 下文将把dify部署在PC上&#xff0c;windows环境&#xff1b; 安装部署 安装dify及docker jacobJacobs…