1
votes

I have a virtual network like this:

http://imgur.com/wjPf2AG

The switch is an Open VSwitch and the whole network is controlled by the Big Switch Floodlight controller.

I am trying to set two flows to switch1:

1) Capture any packet from h1 to h2 and change their dst-IP and dst-MAC -addresses to that of h3.

2) Capture any packet from h3 to h1 and change their src-IP and src-MAC -addresses to that of h2.

(Check bottom of the question for the exact Floodlight REST API requests)

So when I ping h2 from h1 the ping should instead go to h3 and back, but so far I haven't been succesful.

Can this be done? If so, what am I missing? Thanks in advance!

Mininet setup:

sudo mn --topo single,3 --controller remote

Floodlight REST API requests:

Finding IP and MAC addresses and parsing with jq:

curl localhost:8080/wm/device/ | jq '.[]|{mac,ipv4}'

Setting the first flow (Note, if you try this by yourself, MAC addresses may be different):

curl -d '{"switch": "00:00:00:00:00:00:00:01", "name":"redirection", "src-ip":"10.0.0.1", "dst-ip":"10.0.0.2", "src-mac":"7a:b9:87:ee:d2:b7","dst-mac":"a6:77:bf:8f:c4:db", "ether-type":"0x0800","active":"true","actions":"set-dst-ip=10.0.0.3,set-dst-mac=c2:65:e3:d3:6c:11"}' localhost:8080/wm/staticflowentrypusher/json

Setting the second flow:

curl -d '{"switch": "00:00:00:00:00:00:00:01", "name":"redirection2", "src-ip":"10.0.0.3", "dst-ip":"10.0.0.1", "src-mac":"c2:65:e3:d3:6c:11","dst-mac":"7a:b9:87:ee:d2:b7", "ether-type":"0x0800","active":"true","actions":"set-src-ip=10.0.0.2,set-src-mac=a6:77:bf:8f:c4:db"}' http://localhost:8080/wm/staticflowentrypusher/json
2

2 Answers

0
votes

Each OpenFlow rule has a match and an action. You need to specify the action for packets that match your rules.

0
votes

Your flows don't have any forwarding action specified (i.e. "output:2"). So the Mac/IPs are modified in the packet and then the packet is just dropped by the switch. OVS is a simple openflow switch and doesn't do any traditional switching/routing.

For your flow to do what you're trying to achieve, you need to specify an output action as follows:

curl -d '{"switch": "00:00:00:00:00:00:00:01", "name":"redirection", "src-ip":"10.0.0.1", "dst-ip":"10.0.0.2", "src-mac":"7a:b9:87:ee:d2:b7","dst-mac":"a6:77:bf:8f:c4:db", "ether-type":"0x0800","active":"true","actions":"set-dst-ip=10.0.0.3,set-dst-mac=c2:65:e3:d3:6c:11,output=2"}' localhost:8080/wm/staticflowentrypusher/json

where 2 is the port id on which the desired host (10.0.0.3) is connected.