如何在每两台交换机上添加流表? (mininet)

时间:2017-08-03 10:32:52

标签: sdn mininet openflow

我设置了拓扑,如下图所示。我想为每个开关添加不同的流表。但如果我输入

dpctl add-flow in_port=1,nw_dst=10.0.0.2,actions=output:3

将流表添加到s1和s2!

如何为每个开关添加不同的流表?

screen capture

2 个答案:

答案 0 :(得分:0)

使用dpctl命令无法执行此操作,必须使用“sh ovs-ofctl”命令。

此外,mininet在this link

中回答了与dpctl相关的问题

这就是我所做的:

yavuz@ubuntu:~$ sudo mn --topo linear,2,1  --switch ovsk --controller=remote
*** Creating network
*** Adding controller
Connecting to remote controller at 127.0.0.1:6653
*** Adding hosts:
h1 h2
*** Adding switches:
s1 s2
*** Adding links:
(h1, s1) (h2, s2) (s2, s1)
*** Configuring hosts
h1 h2
*** Starting controller
c0
*** Starting 2 switches
s1 s2 ...
*** Starting CLI:

让我们转储流程:

mininet> dpctl dump-flows
*** s1 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=10.979s, table=0, n_packets=21, n_bytes=1674, idle_age=1, priority=0 actions=CONTROLLER:65535
*** s2 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=10.974s, table=0, n_packets=21, n_bytes=1674, idle_age=1, priority=0 actions=CONTROLLER:65535

向s1添加流程:

mininet> sh ovs-ofctl add-flow s1 in_port=5,nw_dst=10.0.0.5,actions=output:5
2017-08-03T16:06:41Z|00001|ofp_util|INFO|normalization changed ofp_match, details:
2017-08-03T16:06:41Z|00002|ofp_util|INFO| pre: in_port=5,nw_dst=10.0.0.5
2017-08-03T16:06:41Z|00003|ofp_util|INFO|post: in_port=5

现在,如流转储中所示,每个交换机的流量都不同:

mininet> dpctl dump-flows
*** s1 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=2.644s, table=0, n_packets=0, n_bytes=0, idle_age=2, in_port=5 actions=output:5
 cookie=0x0, duration=20.971s, table=0, n_packets=21, n_bytes=1674, idle_age=11, priority=0 actions=CONTROLLER:65535
*** s2 ------------------------------------------------------------------------
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=20.965s, table=0, n_packets=21, n_bytes=1674, idle_age=11, priority=0 actions=CONTROLLER:65535
mininet>

答案 1 :(得分:-1)

如果已经创建了链接,我们如何从xterm主机设置链接的优先级