title: can't ping between any of the hosts in my mininet emulated topology
body: <h1>  Picture of my mininet topology :</h1>
  
  <h1><a href="https://i.stack.imgur.com/gXqnJ.png" rel="nofollow noreferrer">Mininet Topology</a></h1>
  
  <hr>
  
  <p>Can anybody help me out in pinging hosts in loop topology. Static pox controller is below.
  My topology has 4 switches and three hosts. one host on the left and two on the right. and obviously i must implement a routing route for each host so that the packets could reach their destinations and not roam the network in an infinite loop. but i can not get it to work </p>
  
  <p>Any help would be much appreciated and thank you in advance</p>
  
  <pre><code>from pox.core import core
  import pox.openflow.libopenflow_01 as of
  from pox.lib.util import dpidToStr
  log = core.getLogger()
  s1_dpid=0
  
  s2_dpid=0
  s3_dpid=0
  s4_dpid=0
  
  def _handle_ConnectionUp (event):
   global s1_dpid, s2_dpid, s3_dpid, s4_dpid
   print "ConnectionUp: ", dpidToStr(event.connection.dpid)
  #remember the connection dpid for switch
   for m in event.connection.features.ports:
    if m.name == "s1-eth1":
       s1_dpid = event.connection.dpid
       print "s1_dpid=", s1_dpid
    elif m.name == "s2-eth3":
      s2_dpid = event.connection.dpid
      print "s2_dpid=", s2_dpid
    elif m.name == "s3-eth3":
      s3_dpid = event.connection.dpid
      print "s3_dpid=", s3_dpid
    elif m.name == "s4-eth4":
      s4_dpid = event.connection.dpid
      print "s4_dpid=", s4_dpid
  def _handle_PacketIn (event):
     global s1_dpid, s2_dpid, s3_dpid, s4_dpid
     print "PacketIn: ", dpidToStr(event.connection.dpid)
     if event.connection.dpid==s1_dpid:
       msg = of.ofp_flow_mod()
       msg.priority =1
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.dl_type = 0x0806
       msg.actions.append(of.ofp_action_output(port = of.OFPP_ALL))
       event.connection.send(msg)
       msg = of.ofp_flow_mod()
       msg.priority =10
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.dl_type = 0x0800
       msg.match.nw_dst = "10.0.0.1"
       msg.actions.append(of.ofp_action_output(port = 1))
       event.connection.send(msg)
       msg = of.ofp_flow_mod()
       msg.priority =10
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.dl_type = 0x0800
       msg.match.nw_dst = "10.0.0.6"
       msg.actions.append(of.ofp_action_output(port = 3))
       event.connection.send(msg)
       msg = of.ofp_flow_mod()
       msg.priority =10
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.dl_type = 0x0800
       msg.match.nw_dst = "10.0.0.2"
       msg.actions.append(of.ofp_action_output(port = 2))
       event.connection.send(msg)
  
  
     elif event.connection.dpid==s2_dpid:
       msg = of.ofp_flow_mod()
       msg.priority =1
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.in_port =3
       msg.actions.append(of.ofp_action_output(port =4))
       event.connection.send(msg)
       msg = of.ofp_flow_mod()
       msg.priority =1
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.in_port =4
       msg.actions.append(of.ofp_action_output(port =3))
       event.connection.send(msg)
  
     elif event.connection.dpid==s4_dpid:
       msg = of.ofp_flow_mod()
       msg.priority =1
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.in_port =3
       msg.actions.append(of.ofp_action_output(port = 4))
       event.connection.send(msg)
       msg = of.ofp_flow_mod()
       msg.priority =1
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.in_port =4
       msg.actions.append(of.ofp_action_output(port = 3))
       event.connection.send(msg)
       elif event.connection.dpid==s3_dpid:
       msg = of.ofp_flow_mod()
       msg.priority =1
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.dl_type = 0x0806
       msg.actions.append(of.ofp_action_output(port = of.OFPP_ALL))
       event.connection.send(msg)
       msg = of.ofp_flow_mod()
       msg.priority =10
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.dl_type = 0x0800
       msg.match.nw_dst = "10.0.0.6"
       msg.actions.append(of.ofp_action_output(port = 2))
       event.connection.send(msg)
  
       msg = of.ofp_flow_mod()
       msg.priority =10
       msg.idle_timeout = 0
       msg.hard_timeout = 0
       msg.match.dl_type = 0x0800
       msg.match.nw_src="10.0.0.6"
       msg.match.nw_dst = "10.0.0.1"
       msg.actions.append(of.ofp_action_output(port = 4))
       event.connection.send(msg)
       # msg = of.ofp_flow_mod()
       # msg.priority =10
       #msg.idle_timeout = 0
       #msg.hard_timeout = 0
       #msg.match.dl_type = 0x0800
       #msg.match.nw_src="10.0.0.5"
       #msg.match.nw_dst = "10.0.0.1"
       #msg.actions.append(of.ofp_action_output(port = 4))
       #event.connection.send(msg)
       def launch ():
       core.openflow.addListenerByName("ConnectionUp",_handle_ConnectionUp)
       core.openflow.addListenerByName("PacketIn",_handle_PacketIn)
  </code></pre>