2018年SDN软件定义网络部分

本文档详细介绍了如何在VMware中设置ODL环境,配置Mininet来构建SDN拓扑,通过OpenFlow1.3管理网络,并进行流量控制。通过在虚拟交换机上设置流表实现特定主机间通信的访问控制,并利用iperf测试网络带宽。
摘要由CSDN通过智能技术生成


题目

软件定义网络部分
在考试机器的任意一台PC上已部署的Vmware Workstation软件,导入ODL集成模板,虚拟机的内存设置为2G。采用桥接的网卡模式,配置IP地址为192.168.10.128/24,网关设置成192.168.1.254/24。默认系统登录的用户名/密码都是mininet(大小写区分)。
启动OpenDayLight的karaf程序,并安装如下组件:
feature:install odl-restconf
feature:install odl-l2switch-switch-ui
feature:install odl-mdsal-apidocs
feature:install odl-dluxapps-applications
使用Mininet构建拓扑,采用ovsk交换格式,连接ODL的远程地址为192.168.10.128:6653,协议类型是Openflow1.30,构造如下拓扑:

在这里插入图片描述

访问ODL管理页面并查看网元拓扑结构。
H1启动HTTP-Server功能,WEB端口为80,H2作为HTTP-Client,获取H1的html网页文件。
通过OVS手工命令在openflow:1虚拟交换机下发流表,只允许下发一条流表,优先级为priority=50实现如下需求:H1与H2可以互通,H1与H3不能互通,但H3和H4之间可以互通。
用iperf工具测试H3和H4的带宽。


一、安装并导入mininet

双击软件包
在这里插入图片描述
然后点导入

在这里插入图片描述
在这里插入图片描述

二、配置IP以及karaf程序启动

用户名密码都是:mininet
在这里插入图片描述

mininet@mininet-vm:~$ sudo -s
root@mininet-vm:~# vim /etc/network/interfaces

在这里插入图片描述

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5). 
# The loopback network interface
auto lo
iface lo inet loopback 

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.10.128
netmask 255.255.255.0
gateway 192.168.10.254

在这里插入图片描述
重启网卡

root@mininet-vm:~# ifdown eth0 && ifup eth0

在这里插入图片描述
crt连接上

在这里插入图片描述

启动OpenDayLight的karaf程序

root@mininet-vm:~# /home/mininet/ODL/bin/karaf 

在这里插入图片描述
安装组件

feature:install odl-restconf
feature:install odl-l2switch-switch-ui
feature:install odl-mdsal-apidocs
feature:install odl-dluxapps-applications

在这里插入图片描述

三、创建拓扑

root@mininet-vm:~# cd /home/mininet/mininet/custom/
root@mininet-vm:~/mininet/custom# cp topo-2sw-2host.py mytopo.py
root@mininet-vm:~/mininet/custom# vim mytopo.py 

在这里插入图片描述
在这里插入图片描述

"""Custom topology example

Two directly connected switches plus a host for each switch:

   host --- switch --- switch --- host

Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""

from mininet.topo import Topo

class MyTopo( Topo ):
    "Simple topology example."

    def __init__( self ):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        H1 = self.addHost( 'h1' )
        H2 = self.addHost( 'h2' )
        H3 = self.addHost( 'h3' )
        H4 = self.addHost( 'h4' )
        S1 = self.addSwitch( 's1' )
        S2 = self.addSwitch( 's2' )
        S3 = self.addSwitch( 's3' )

        # Add links
        self.addLink( H1, S2)
        self.addLink( H2, S2)
        self.addLink( H3, S3)
        self.addLink( H4, S3)
        self.addLink( S1, S2)
        self.addLink( S1, S3)


topos = { 'mytopo': ( lambda: MyTopo() ) }

在这里插入图片描述
生成拓扑

root@mininet-vm:~/mininet/custom# mn --controller=remote,ip=192.168.10.128,port=6653 --custom=mytopo.py --topo=mytopo --switch=ovsk,protocols=OpenFlow13

在这里插入图片描述
pingall一下生成
在这里插入图片描述

四、打开网页查看拓扑

浏览器输入http://192.168.10.128:8181/index.html

http://192.168.10.128:8181/index.html

在这里插入图片描述
用户名密码都是:admin
在这里插入图片描述
在这里插入图片描述

五、启动HTTP-Server功能并获取

h1 python -m SimpleHTTPServer 80 & 

在这里插入图片描述

h2 wget –O - h1

在这里插入图片描述

六、下发流表设置访问控制

mininet> sh ovs-ofctl add-flow s1 priority=50,in_port=2,actions=drop -O openflow13

在这里插入图片描述
pingall测试
在这里插入图片描述

七、iperf工具测试带宽

mininet>  iperf h3 h4

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

痞痞鸭

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

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

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

打赏作者

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

抵扣说明:

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

余额充值