View Christos Tranoris's profile on LinkedIn

Visit The Model Driven Software Network

Who's online

There are currently 0 users and 11 guests online.

Recent comments


Syndicate content

OpenFlow: Port forwarding and modifying the network source and destination

OpenFlow allows the path of network packets through the network of switches to be determined by software running on multiple routers This separation of the control from the forwarding allows for more sophisticated traffic management. Its inventors consider OpenFlow an enabler of software-defined networking (SDN). More on OpenFlow at
 Open vSwitch is a switch stack which enables the creation of automated network infrastructure for virtualized environments. It is primarily developed and deployed in Linux, used with some virtualization systems like Xen. Cloud management systems like Xen Cloud Platform and Open Stack have it integrated.
A typical deployment we have is like the following:

Since I couldn't find examples for modifying the network source and destination and port forwarding with Open VSwitch both with cli and through an OpenFlow controller, I post it here.
Modifying the network source and destination is useful in different scenarios. A typical scenario is like the following, where for testing a new application or for load balancing reasons to modify destination network IP and port :

 The client believes that "talks" with, but it's actually connected to on another port. To accomplish this with openvswitch, one can do this through the following commands in the host machine:

sudo ovs-ofctl --strict add-flow pubbr0 priority=100,idle_timeout=50000,

sudo ovs-ofctl --strict add-flow pubbr0 priority=100,idle_timeout=50000,

In scenarios were we have other OpenFlow enabled switches, we can use the so called OpenFlow controllers. An OpenFlow controller can control multiple switches utilizing the OpenFlow protocol. The good thing with controllers, is that now applications can have easy access to the network fabric and modify networking according their needs.
One such controller is Floodlight. Floodlight can be expanded through modules, but a nice feature (let aside Java) is that it exposes a RESTful API which makes really easy for apps to exploit it .
The API accepts regular get/post/put/delete http request passing JSON payloads. To connect the controller with the switch, the only thing you need to do is to configure your OpenFlow switch with the location of your controller. After this the controller monitors/manages your switch.
So the following can be done to repeat the above scenario, this time from our controller and through the REST API, assuming we're sitting on the same machine with the controller (localhost) and post the following:
curl -d '{"switch": "00:00:00:1b:21:cb:fe:44", "name":"static-flow1", "cookie":"0", "priority":"32768", "ether-type":"0x0800", "protocol":"6", "dst-mac":"00:16:3e:4a:06:bf", "dst-ip":"", "dst-port":"80","active":"true", "actions":"set-dst-ip=,set-dst-port=8000,output=2"}' http://localhost:8080/wm/staticflowentrypusher/json
curl -d '{"switch": "00:00:00:1b:21:cb:fe:44", "name":"static-flow2", "cookie":"0", "priority":"32768", "ether-type":"0x0800", "protocol":"6", "src-ip":"", "src-port":"8000", "src-mac":"00:16:3e:4a:06:bf", "active":"true", "actions":"set-src-ip=,set-src-port=80,output=1"}' http://localhost:8080/wm/staticflowentrypusher/json
Aplying similar commands by modifying only ports you can also make some simple port forwarding.

Posted in Submitted by tranoris on February 28, 2013 - 11:27.


  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Copy the characters (respecting upper/lower case) from the image.