[pox-dev] writing flow rules in intermediate nodes

Murphy McCauley murphy.mccauley at gmail.com
Wed Nov 15 12:07:34 PST 2017


First off, in many cases, it doesn't make much sense to think of the
switches as having IP addresses.  Hosts have IP addresses.  There are
exceptions, but... are you sure you're in one of those exceptional cases?
If not, this is just going to be confusing.

That aside, you mention wanting to get packets from n1 to n3.  The entry
you've written there won't help because you have the destination set to
match 10.0.0.2, but IP packets to n3's IP address will always have a
destination of 10.0.0.3.  It's also worth noting that you don't need to
match on the source in order to match packets going to a destination.
Finally, in order to match on IP addresses (at L3), you need to match on
the Ethertype (at L2) to ensure that only IP packets match -- this is
explained in the OpenFlow 1.0 specification.  Off the top of my head, I
think a suitable n1 match is...
fm.match.dl_type = 0x800
fm.match.nw_dst = IPAddr("10.0.0.3") # It's best to explicitly use POX's
IPAddr here

And, indeed, you should be able to use the exact same entry on n2.  For n3,
I think you'll want to change the output port from OFPP_FLOOD to OFPP_LOCAL
if you really do want to deliver the packet to n3's local IP address.

Good luck.

-- Murphy

On Wed, Nov 15, 2017 at 11:25 AM, S hj <segunhz at gmail.com> wrote:

> Hello,
>
>
>
> I have the following topology and want to install rules in nodes
> (openvswitch nodes) to communicate with each other.
>
> N1(10 <https://maps.google.com/?q=N1(10&entry=gmail&source=g>.0.0.1) ---
> N2(10.0.0.2)--- N3(10
> <https://maps.google.com/?q=N3(10&entry=gmail&source=g>.0.0.3)
>
>
>
> each node has another interface to connect to the controller directly.
>
>
> I want to write flow rules to help n2 to forward a packet from n1 to n3.
>
>
> So at first n1 sends a packetIn message to get the rules to communicate
> with n2 as following:
>
> (If the source of packet is n1 and the destination in n2, send the packet
> to the port)
>
> fm= of.ofp_flow_mod()
>
> fm.match.nw_src = “10.0.0.1”
>
> fm.match.nw_dst = “10.0.0.2”
>
> fm.actions.append(of.ofp_action_output(port= of.OFPP_FLOOD)
>
> event.connection.send(fm)
>
>
>
> Then in n2, I want to write a flow rule that if it receive a packet from
> n1 , forward that to n3.
>
> Could you let me know how should I write this rule?
>
>
>
> Thank you
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20171115/44250fd1/attachment-0002.html>


More information about the pox-dev mailing list