sdn

2019 SDN上机第6次作业

筅森魡賤 提交于 2019-12-07 17:01:26
1.实验拓扑 拓扑图: python脚本: 运行python脚本: 连接ryu控制器: 输入net,查看各主机与交换机之间的端口情况: 2.使用Ryu的REST API下发流表实现和第2次实验同样的VLAN 按实验二编写sh脚本 curl -X POST -d '{ "dpid": 1, "priority":1, "match":{ "in_port":1 }, "actions":[ { "type": "PUSH_VLAN", # s1将从主机发来的数据包打上vlan_tag "ethertype": 33024 # 帧类型0x8100(=33024): 表示IEEE 802.1Q的VLAN数据帧 }, { "type": "SET_FIELD", "field": "vlan_vid", # 设置VLAN ID "value": 4096 # 设置vlan_id的值 }, { "type": "OUTPUT", "port": 4 } ] }' http://127.0.0.1:8080/stats/flowentry/add curl -X POST -d '{ "dpid": 1, "priority":1, "match":{ "in_port":2 }, "actions":[ { "type": "PUSH_VLAN", # s1将从主机发来的数据包打上vlan

2019 SDN上机第6次作业

蹲街弑〆低调 提交于 2019-12-06 23:07:28
1.实验拓扑 实验拓扑 要求 使用Python脚本完成拓扑搭建,并连接ryu控制器。 答: 搭建拓扑: 连接控制器 命令: 2.使用Ryu的REST API下发流表实现和第2次实验同样的VLAN 参考资料 REST API:可以在线学习中国大学MOOC 《软件定义网络》第六讲 北向接口 ryu控制器的api文档 ryu的拓扑展示 要求 编写脚本,一键执行下发流表。 答: 安装curl 命令:sudo apt-get install curl 编写脚本如下 curl -X POST -d '{ "dpid": 1, "priority":1, "match":{ "in_port":1 }, "actions":[ { "type": "PUSH_VLAN", "ethertype": 33024 }, { "type": "SET_FIELD", "field": "vlan_vid", "value": 4096 }, { "type": "OUTPUT", "port": 4 } ] }' http://127.0.0.1:8080/stats/flowentry/add 端口号2发来数据 curl -X POST -d '{ "dpid": 1, "priority":1, "match":{ "in_port":2 }, "actions":[ { "type":

2019 SDN上机第6次作业

混江龙づ霸主 提交于 2019-12-06 15:24:24
1.实验拓扑 (1)实验拓扑 (2)使用Python脚本完成拓扑搭建 Python脚本如下: from mininet.topo import Topo class MyTopo( Topo ): "Simple topology example." def __init__( self ): # Initialize topology Topo.__init__( self ) sw1 = self.addSwitch('s1') sw2 = self.addSwitch('s2') h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') h4 = self.addHost('h4') h5 = self.addHost('h5') h6 = self.addHost('h6') self.addLink(h1,sw1,1,1) self.addLink(h2,sw1,1,2) self.addLink(h3,sw1,1,3) self.addLink(sw1,sw2,4,4) self.addLink(h4,sw2,1,1) self.addLink(h5,sw2,1,2) self.addLink(h6,sw2,1,3) topos = { 'mytopo': ( lambda:

2019 SDN上机第6次作业

巧了我就是萌 提交于 2019-12-06 13:55:15
1.实验拓扑 python编写网络拓扑 #!/usr/bin/python #创建网络拓扑 from mininet.topo import Topo from mininet.net import Mininet from mininet.node import RemoteController,CPULimitedHost from mininet.link import TCLink from mininet.util import dumpNodeConnections class MyTopo( Topo ): "Simple topology example." def __init__( self ): "Create custom topo." # Initialize topology Topo.__init__( self ) L1 = 2 s = [] # add core ovs for i in range( L1 ): sw = self.addSwitch( 's{}'.format( i + 1 ) ) s.append( sw ) # link s1 and s2 self.addLink(s[0],s[1]) #add hosts and its links with edge ovs count = 1 for sw1 in s: for i

2019 SDN上机第6次作业

感情迁移 提交于 2019-12-06 13:03:44
1.作业要求: 实验拓扑 1.实验拓扑见 2019 SDN上机第2次作业 ; 2.要求:使用Python脚本完成拓扑搭建,并连接ryu控制器; 使用Ryu的REST API下发流表实现和第2次实验同样的VLAN 1.参考资料:REST API:可以在线学习中国大学MOOC 《软件定义网络》第六讲 北向接口 Ryu控制器的API文档:ryu.app.ofctl_rest Ryu的拓扑展示 助教博客:基于RYU restful api实现的VLAN网络虚拟化 2.要求:完成自动化脚本编写,一键下发流表; 对比两种方法,写出你的实验体会 作业博客链接: https://edu.cnblogs.com/campus/fzu/fzusdn2019/homework/10134 2.具体操作步骤与截图说明: 实验环境:VMware Workstation Pro14.1、ubuntu-16.04 (1)实验拓扑: 给定的实验拓扑图如下所示: 编写Python脚本x.py,完成拓扑搭建,实验代码如下所示: from mininet.topo import Topo class Topo2( Topo ): def __init__( self ): # Initialize topology Topo.__init__( self ) # add switches s1 = self

2019 SDN上机第6次作业

北城余情 提交于 2019-12-06 13:02:17
1.实验拓扑 实验拓扑 要求 使用Python脚本完成拓扑搭建,并连接ryu控制器。 python代码 from mininet.topo import Topo class MyTopo( Topo ): "Simple topology example." def __init__( self ): Topo.__init__(self) sw1 = self.addSwitch('s1') sw2 = self.addSwitch('s2') h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') h4 = self.addHost('h4') h5 = self.addHost('h5') h6 = self.addHost('h6') self.addLink(h1,sw1,1,1) self.addLink(h2,sw1,1,2) self.addLink(h3,sw1,1,3) self.addLink(sw1,sw2,4,4) self.addLink(h4,sw2,1,1) self.addLink(h5,sw2,1,2) self.addLink(h6,sw2,1,3) topos = { 'mytopo': ( lambda: MyTopo() ) } 使用下列命令建立拓扑

2019 SDN上机第6次作业

為{幸葍}努か 提交于 2019-12-06 12:59:27
1.实验拓扑 (1)实验拓扑图 (2)构建拓建拓扑 from mininet.topo import Topo class Mytopo(Topo): def __init__(self): Topo.__init__(self) s=[] for i in range(2): sw = self.addSwitch('s{}'.format(i+1)) s.append(sw) count=1 for two in s: for i in range(3): host = self.addHost('h{}'.format(count)) self.addLink(two,host) count += 1 self.addLink(s[0],s[1]) topos = {'mytopo': (lambda:Mytopo())} (3)用以下命令构建拓扑 sudo mn --custom sdn6.py --topo mytopo --controller=remote,ip=127.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow13 (4)使用net命令查看端口情况 (5)使用pingall测试主机连通性 (6)进入文件夹的ryu文件夹下的app,通过以下的命令连接ryu控制器 ryu-manager ofctl_rest.py

2019 SDN上机第6次作业

霸气de小男生 提交于 2019-12-06 12:58:40
1.实验拓扑 from mininet.topo import Topo from mininet.net import Mininet from mininet.node import RemoteController,CPULimitedHost from mininet.link import TCLink from mininet.util import dumpNodeConnections class MyTopo( Topo ): "Simple topology example." def __init__( self ): "Create custom topo." Topo.__init__( self ) L1 = 2 s = [] for i in range( L1 ): sw = self.addSwitch( 's{}'.format( i + 1 ) ) s.append( sw ) count = 1 for sw1 in s: for i in range(3): host = self.addHost( 'h{}'.format( count ) ) self.addLink( sw1, host ) count += 1 self.addLink(s[0],s[1]) topos = { 'mytopo': ( lambda: MyTopo(

2019 SDN上机第6次作业

自作多情 提交于 2019-12-06 12:55:26
1.实验拓扑 拓扑结构如下 要求 使用Python脚本完成拓扑搭建,并连接ryu控制器。 python脚本 from mininet.topo import Topo class MyTopo( Topo ): def __init__( self ): # Initialize topology Topo.__init__( self ) switch1 = self.addSwitch('switch1') switch2 = self.addSwitch('switch2') h1 = self.addHost('h1') h2 = self.addHost('h2') h3 = self.addHost('h3') h4 = self.addHost('h4') h5 = self.addHost('h5') h6 = self.addHost('h6') self.addLink(h1,switch1,1,1) self.addLink(h2,switch1,1,2) self.addLink(h3,switch1,1,3) self.addLink(switch1,switch2,4,4) self.addLink(h4,switch2,1,1) self.addLink(h5,switch2,1,2) self.addLink(h6,switch2,1,3)

2019 SDN上机第6次作业

孤人 提交于 2019-12-06 12:52:38
1.实验拓扑 Python脚本 from mininet.topo import Topo class MyTopo( Topo ): "Simple topology example." def __init__( self ): "Create custom topo." # Initialize topology Topo.__init__( self ) L1 = 2 L2 = L1 * 3 s = [] h = [] for i in range( L1 ): sw = self.addSwitch( 's{}'.format( i + 1 ) ) s.append( sw ) self.addLink(s[0],s[1],4,4) count = 1 for sw1 in s: for i in range(3): host = self.addHost( 'h{}'.format( count ) ) self.addLink( sw1, host,i+1,1 ) count += 1 topos = { 'mytopo': ( lambda: MyTopo() ) } 运行以下代码创建拓扑 sudo mn --custom ./fattree.py --topo mytopo --controller=remote,ip=127.0.0.1,port=6653 -