首页 > 其他分享 >实验3:OpenFlow协议分析实践

实验3:OpenFlow协议分析实践

时间:2022-11-09 17:14:33浏览次数:47  
标签:info mininet OpenFlow s2 实践 实验 import net cls

实验3:OpenFlow协议分析实践

1.拓扑文件

from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call

def myNetwork():

    net = Mininet( topo=None,
                   build=False,
                   ipBase='192.168.0.0/24')

    info( '*** Adding controller\n' )
    c0=net.addController(name='c0',
                      controller=Controller,
                      protocol='tcp',
                      port=6633)

    info( '*** Add switches\n')
    s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
    s2 = net.addSwitch('s2', cls=OVSKernelSwitch)

    info( '*** Add hosts\n')
    h1 = net.addHost('h1', cls=Host, ip='192.168.0.101/24', defaultRoute=None)
    h2 = net.addHost('h2', cls=Host, ip='192.168.0.102/24', defaultRoute=None)
    h3 = net.addHost('h3', cls=Host, ip='192.168.0.103/24', defaultRoute=None)
    h4 = net.addHost('h4', cls=Host, ip='192.168.0.104/24', defaultRoute=None)

    info( '*** Add links\n')
    net.addLink(s1, s2)
    net.addLink(s2, h2)
    net.addLink(s2, h4)
    net.addLink(s1, h3)
    net.addLink(s1, h1)

    info( '*** Starting network\n')
    net.build()
    info( '*** Starting controllers\n')
    for controller in net.controllers:
        controller.start()

    info( '*** Starting switches\n')
    net.get('s1').start([c0])
    net.get('s2').start([c0])

    info( '*** Post configure switches and hosts\n')

    CLI(net)
    net.stop()

if __name__ == '__main__':
    setLogLevel( 'info' )
    myNetwork()

2.wireshark抓包的结果

a).hello

控制器6633端口---> 交换机35534端口

标签:info,mininet,OpenFlow,s2,实践,实验,import,net,cls
From: https://www.cnblogs.com/aJSALaSJalnxlA/p/16874389.html

相关文章

  • 实验2:Open vSwitch虚拟交换机实践
    实验2:OpenvSwitch虚拟交换机实践1.a).执行ovs-vsctlshow命令b).p0和p1连通性测试2.a).MininetCLIb).执行pingall命令c).查看OVS流表d).wireshark抓包截图......
  • python实验报告(第十章)
    一、实验目的1.掌握基本的文件操作2.掌握目录操作3.掌握高级文件操作二、实验环境python版本:3.10(64-bit)三、实验内容1.实例一:  实验结果:  2.实例二:  ......
  • 实验1:SDN拓扑实践
    实验1:SDN拓扑实践1.Mininet运行结果截图2.使用Mininet的命令行生成如下拓扑a).3台交换机,每个交换机连接1台主机,3台交换机连接成一条线。b).3台主机,每个主机都连......
  • 软件工程基础实验一
    沈阳航空航天大学软件工程基础实验报告实验名称:实验一实验题目:个人项目专业软件工程学号223201062228姓名崔贺指导教师孟桂英成绩完成......
  • 实验一
    请阅读北航陈彦吉同学的这篇博客中的各参考资料,并回答如下问题:(1) 回顾你过去将近3年的学习经历当初你报考的时候,是真正喜欢计算机这个专业吗?不喜欢你现在后悔选择了......
  • 拓端tecdat:R语言因子实验设计nlme拟合非线性混合模型分析有机农业施氮水平
    测试非线性回归中的交互作用因子实验在农业中非常普遍,它们通常用于测试实验因素之间相互作用的重要性。例如,可以在两种不同的施氮水平(例如高和低)下进行基因型评估,以了解基因......
  • 实验2
    1.2.2阅读材料并思考请阅读北航陈彦吉同学的这篇博客中的各参考资料,并回答如下问题:(1)回顾你过去将近3年的学习经历当初你报考的时候,是真正喜欢计算机这个专业吗?  ......
  • 实验四
    vectorInt.hpp#pragmaonce#include<iostream>#include<cassert>usingnamespacestd;classvectorInt{public:vectorInt(intn);vectorInt(intn,in......
  • 实验1/任务2
    请阅读北航陈彦吉同学的这篇博客中的各参考资料,并回答如下问题:(1)回顾你过去将近3年的学习经历问:当初你报考的时候,是真正喜欢软件工程这个专业吗?答:当初报考的时候并不......
  • 实验四
    #include<iostream>#include<vector>#include<string>usingnamespacestd;classvectorInt{public:vectorInt();vectorInt(intn);......