我正在使用Mininet,RYU控制器和OpenFlow 1.3创建一个拓扑,其中主机h1
使用交换机h2
以下列方式连接到主机p0es0
:
h1 h1-eth0:p0es0-eth3
h2 h2-eth0:p0es0-eth4
在我的Ryu Controller应用程序中,我有以下代码片段在我的p0es0
开关上安装规则,以便能够从h2到达h1,反之亦然:
# Install rule to forward packets destined to "10.0.0.2" (h2) via port 3
ofproto = sw.ofproto
match = sw.ofproto_parser.OFPMatch( eth_type = 0x0800, ipv4_dst="10.0.0.1")
action = sw.ofproto_parser.OFPActionOutput(4)
inst = [sw.ofproto_parser.OFPInstructionActions(sw.ofproto.OFPIT_APPLY_ACTIONS, [action])]
mod = sw.ofproto_parser.OFPFlowMod(datapath=sw, match=match,
instructions=inst, cookie=0, command=ofproto.OFPFC_ADD, idle_timeout=0,
hard_timeout=0, priority=100, flags=ofproto.OFPFF_SEND_FLOW_REM)
sw.send_msg(mod)
# Install rule to forward packets destined to "10.0.0.1" (h1) via port 4
match = sw.ofproto_parser.OFPMatch( eth_type = 0x0800, ipv4_dst="10.0.0.1")
action = sw.ofproto_parser.OFPActionOutput(4)
inst = [sw.ofproto_parser.OFPInstructionActions(sw.ofproto.OFPIT_APPLY_ACTIONS, [action])]
mod = sw.ofproto_parser.OFPFlowMod(datapath=sw, match=match,
instructions=inst, cookie=0, command=ofproto.OFPFC_ADD, idle_timeout=0,
hard_timeout=0, priority=100, flags=ofproto.OFPFF_SEND_FLOW_REM)
sw.send_msg(mod)
我的dump-flow命令按预期确认交换机中规则的正确安装:
*** p0es0 ------------------------------------------- ----------------------
OFPST_FLOW回复(OF1.3)(xid = 0x2):
cookie = 0x0,duration = 1103.417s,table = 0,n_packets = 0,n_bytes = 0,send_flow_rem priority = 100,ip, nw_dst = 10.0.0.2 actions = output:4
cookie = 0x0,持续时间= 1103.414s,表= 0,n_packets = 0,n_bytes = 0,send_flow_rem优先级= 100,ip, nw_dst = 10.0.0.1动作=输出:3
但是,当我尝试从h2
ping h1
或反之亦然时,我收到目标主机无法访问错误。我尝试在p0es0-eth3
上使用tcpdump - 我只看到ARP请求数据包。
我在这里遗漏了什么吗?
感谢。
答案 0 :(得分:0)
我在没有arp标志的情况下运行Mininet。添加arp选项修复了我的问题。
即,sudo mn - arp --custom fTreeTopo.py --topo ftreetopo --controller = remote,ip = 127.0.0.1