首页 文章

Ping在Mininet中失败,RYU - OpenFlow 1.3

提问于
浏览
1

我正在使用Mininet,RYU控制器和OpenFlow 1.3来创建一个拓扑,其中主机 h1 使用交换机 p0es0 连接到主机 h2 ,方法如下:

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,duration = 1103.414s,table = 0,n_packets = 0,n_bytes = 0,send_flow_rem priority = 100,ip, nw_dst=10.0.0.1 actions=output:3


但是,当我尝试从 h1 ping h2 时,反之亦然,我得到目标主机无法访问错误 . 我尝试在 p0es0-eth3 上使用tcpdump - 我只看到ARP请求数据包 .

我在这里错过了什么吗?

谢谢 .

1 回答

  • 0

    我在没有arp标志的情况下运行Mininet . 添加arp选项修复了我的问题 .

    即,sudo mn --arp --custom fTreeTopo.py --topo ftreetopo --controller = remote,ip = 127.0.0.1

相关问题