Postman下发流表至Opendaylight

news2024/10/5 19:15:05

目录

任务目的

任务内容

实验原理

实验环境

实验过程

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.coloradmin.cn/o/1818647.html

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

相关文章

【AI绘画】Stable Diffusion 3开源

Open Release of Stable Diffusion 3 Medium 主要内容 Stable Diffusion 3是Stability AI目前为止最先进的文本转图像开放源代码算法。 这款模型的小巧设计使其完美适合用于消费级PC和笔记本电脑&#xff0c;以及企业级图形处理单元上运行。它已经满足了标准化的文字转图像模…

红黑树(C++)

文章目录 写在前面1. 红黑树的概念及性质1. 1 红黑树的概念1. 2 红黑树的性质 2. 红黑树节点的定义3. 红黑树的插入3.1 按照二叉搜索的树规则插入新节点3.2 检测新节点插入后&#xff0c;红黑树的性质是否造到破坏 4.红黑树的删除5.红黑树的验证6.源码 写在前面 在上篇文章中&…

移动UI:登录页如此哇塞,不发出就有点锦衣夜行啦。

移动UI登录页是移动应用中非常重要的一环。一个出色的登录页可以给用户留下深刻的印象&#xff0c;提供良好的用户体验&#xff0c;并确保用户的账号安全 在设计登录页时&#xff0c;可以考虑以下几个方面&#xff1a; 简洁明了的界面&#xff1a;登录页应该简洁明了&#xf…

关于一元方程求根中牛顿迭代法的分析

文末含有程序源代码以及可执行exe文件&#xff0c;文中部分内容参考网上博客以及GPT协助&#xff0c;希望能对你有所帮助~ 一、理论知识简述 牛顿迭代法&#xff08;Newton’s Method&#xff09;&#xff0c;也称为牛顿-拉弗森方法&#xff08;Newton-Raphson Method&#xf…

罗森伯格1800M 2000M 2400M 900M无源互调分析仪

在无线通信领域&#xff0c;频段是宝贵的资源&#xff0c;不同的通信系统通常会采用不同的频段以满足其传输需求。随着技术的发展&#xff0c;越来越多的通信系统被部署在各种频段上。为了准确、高效地测试和调试这些 信系统&#xff0c;各种测试设备也应运而生。源互调分析仪便…

rizhuti1.9-最新版-推荐文章缩略图

下载地址&#xff1a;rizhuti1.9-最新版-推荐文章缩略图 商城功能后台可以一键开启关闭&#xff0c;关闭后就是一个布局灵活&#xff0c;界面优美&#xff0c;速度超快的wordpress博客主题

2024新版AI创作系统pro搭建,支持文生漫画视频ai对话问答/ai音乐创作/ai测评/ai换脸/ai写真

一、系统介绍 一款结合了多种功能应用&#xff0c;是当前市场最热门的AI工具综合体 AI动漫生成 AI音乐创作 AI写真 AI换脸 AI绘画 AI趣测 六大AI功能 AI创作小程序是一种利用人工智能技术为用户提供服务&#xff0c;并通过某种方式实现的小程序。这种小程序可以应用于多…

微服务 | Springboot整合Dubbo+Nacos实现RPC调用

官网&#xff1a;Apache Dubbo 随着互联网技术的飞速发展&#xff0c;越来越多的企业和开发者开始关注微服务架构。微服务架构可以将一个大型的应用拆分成多个独立、可扩展、可维护的小型服务&#xff0c;每个服务负责实现应用的一部分功能。这种架构方式可以提高开发效率&…

RK3568技术笔记 Ubuntu 安装VMware Tools

安装 VMware Tools 后可以直接使用复制粘贴功能拷贝 Ubuntu 系统和 windows 主机内的文件&#xff0c;非常方便。 开启虚拟机&#xff0c;必须要进入ubuntu系统后才能进行下面的步骤。 单击 VMware 软件中的标签“虚拟机”&#xff0c;在下拉的菜单中单击“安装VMware Tools &…

x64-linux下在vscode使用vcpkg

1.使用vscode远程连接上对应的linux &#xff0c;或者直接在图形化界面上使用。 2.安装vcpkg 插件&#xff0c;然后打开插件设置。 注意&#xff1a;defalut和host的主机一定和你自己的主机一致&#xff0c;且必须符合vcpkg三元组格式&#xff0c;其中你可以选择工作台的设置&a…

R语言ggHoriPlot包绘制地平线图

数据和代码获取&#xff1a;请查看主页个人信息&#xff01;&#xff01;&#xff01; 关键词“地平线图” 1. 数据读取与处理 首先&#xff0c;从TSV文件中读取数据&#xff0c;并进行数据清洗和处理。 rm(listls()) pacman::p_load(tidyverse,ggalt,ggHoriPlot,hrbrthemes…

ACM MM2024 Rebuttal Latex模板如何去掉标题

声明 Latex初学者&#xff0c;非官方指定做法&#xff0c;仅供大家参考 问题 ACM MM 2024会议&#xff0c;官方给定的Rebuttal latex模板&#xff0c;title占据了两行&#xff0c;但又限制Rebuttal只能有一页&#xff0c;所以在微信群里&#xff0c;大家希望能将这个title删…

springboot 整合redis问题,缓存击穿,穿透,雪崩,分布式锁

boot整合redis 压力测试出现失败 解决方案 排除lettuce 使用jedis <!-- 引入redis --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId><exclusions><exclus…

快来!AI绘画Stable Diffusion 3终于开源了,更强的文字渲染和理解力,12G显卡可跑!

大家好&#xff0c;我是设计师阿威 Stable Diffusion 3终于开源了&#xff0c;2B参数的Stable Diffusion 3 Medium模型已经可以在HuggingFace上下载了&#xff01;如无法科学上网的小伙伴我也准备好了网盘资料&#xff0c;请看文末扫描获取哦&#xff01; Stable Diffusion 3 …

力扣每日一题-419

题目 给你一个大小为 m x n 的矩阵 board 表示甲板&#xff0c;其中&#xff0c;每个单元格可以是一艘战舰 X 或者是一个空位 . &#xff0c;返回在甲板 board 上放置的 战舰 的数量。 战舰 只能水平或者垂直放置在 board 上。换句话说&#xff0c;战舰只能按 1 x k&#xff…

C++中stack和queue

前言 在 C 中&#xff0c;stack&#xff08;栈&#xff09;和 queue&#xff08;队列&#xff09;是两种常用的容器适配器&#xff0c;分别用于管理数据的后进先出&#xff08;LIFO&#xff09;和先进先出&#xff08;FIFO&#xff09;访问模式。本文将详细介绍这两种数据结构的…

一文彻底理解机器学习 ROC-AUC 指标

在机器学习和数据科学的江湖中&#xff0c;评估模型的好坏是非常关键的一环。而 ROC&#xff08;Receiver Operating Characteristic&#xff09;曲线和 AUC&#xff08;Area Under Curve&#xff09;正是评估分类模型性能的重要工具。 这个知识点在面试中也很频繁的出现。尽管…

如何将接口返回/n替换为react.js中的换行符

将每个/n替换为ReactJS中的一个<br>标记。cpa_ability为后端返回的字段名

技术流 | ClickHouse工具ckman v3.1.3 sinker v3.1.8 版本发布

【本文作者&#xff1a;擎创科技 ClickHouse专家&#xff0c;ckman作者禹鼎侯】 在这个端午小长假里&#xff0c;ckman和clickhouse_sinker分别带来了全新的版本。让我们一起来看看&#xff0c;新版本都有哪些新特性吧&#xff01; ckman v3.1.3新版本特性 ckman v3.1.3作为…

【全开源】多功能投票小程序系统源码(ThinkPHP+FastAdmin+Uniapp)

&#x1f680; 多功能投票小程序&#xff0c;让决策变得更简单&#xff01; 基于ThinkPHPFastAdminUniapp开发的多功能系统&#xff0c;支持图文投票、自定义选手报名内容、自定义主题色、礼物功能(高级授权)、弹幕功能(高级授权)、会员发布、支持数据库私有化部署&#xff0c…