题目
软件定义网络部分
在考试机器的任意一台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