使用RYU控制器将主机放入VLAN
我已经使用以下命令将四个主机H1 H2 H3 H4连接到单个开关S1中的两个VLAN,其中有VLAN标签10和20,
第一个启动Mininet。
sudo mn - topo单,4 - controller远程-MAC -I 10.0.0.1/24
然后使用OVS命令
首先将S1删除作为快捷方式来删除端口 sudo ovs-vsctl del-br s1
然后添加开关S1并添加带有标签的同一端口,
sudo ovs-vsctl add-br s1
sudo ovs-vsctl add-port s1 s1-eth1 tag=10
sudo ovs-vsctl add-port s1 s1-eth2 tag=20
sudo ovs-vsctl add-port s1 s1-eth3 tag=10
sudo ovs-vsctl add-port s1 s1-eth4 tag=20
现在H1和H3将在同一VLAN上; H2和H4将在同一v局域网上。
现在我的问题是如何使用不使用OVS命令而是使用编程的RYU控制器进行相同的操作。
I have used the following commands to put four hosts h1 h2 h3 h4 connected to a single switch s1 in two vlan with vlan tag 10 and 20,
First start mininet.
sudo mn --topo single,4 --controller remote --mac -i 10.0.0.1/24
then using ovs commands
first delete s1 as a shortcut to remove the portssudo ovs-vsctl del-br s1
then adding switch s1 and adding same ports with tags
sudo ovs-vsctl add-br s1
sudo ovs-vsctl add-port s1 s1-eth1 tag=10
sudo ovs-vsctl add-port s1 s1-eth2 tag=20
sudo ovs-vsctl add-port s1 s1-eth3 tag=10
sudo ovs-vsctl add-port s1 s1-eth4 tag=20
now h1 and h3 will be on the same vlan ; h2 and h4 will be on the same v lan.
Now my question is how to do the same using ryu controller not using ovs commands but using programming.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我并不完全使用VLAN,而是一个列表。
这里是。
在simple_switch_13.py中,
将此行添加为全局变量
port_to_vlan = {1:10,2:20,3:10,4:20}
in Handler中的数据包在操作后添加此操作= [Parser。 ofPactionOutput(out_port)]:
最终代码是:
输出为:

I have done it not exactly using vlan but a list.
Here it is.
In simple_switch_13.py
Add this line as global variable
port_to_vlan = {1: 10, 2: 20, 3: 10, 4: 20}
And in packet in handler add this after the actions = [parser.OFPActionOutput(out_port)]:
The final code is:
The output is:
