我正在使用 Mininet、RYU 控制器和 OpenFlow 1.3 创建一个拓扑,其中主机通过以下方式使用交换机h1
连接到主机:h2
p0es0
h1 h1-eth0:p0es0-eth3
h2 h2-eth0:p0es0-eth4
在我的 Ryu 控制器应用程序中,我有以下代码片段来在我的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,持续时间=1103.417s,表=0,n_packets=0,n_bytes=0,send_flow_rem 优先级=100,ip,nw_dst=10.0.0.2 动作=输出:4
cookie=0x0,持续时间=1103.414s,表=0,n_packets=0,n_bytes=0,send_flow_rem 优先级=100,ip,nw_dst=10.0.0.1 动作=输出:3
但是,当我尝试从 pingh2
或h1
反之亦然时,我收到 Destination Host Unreachable 错误。我尝试使用 tcpdump p0es0-eth3
-- 我只看到 ARP 请求数据包。
我在这里错过了什么吗?
谢谢。