How to create specific Qos rules? - sdn

I have the topology that is represented in the image:
I want the hosts 1 and 2 to have high priority with max bandwidth 8mbps and the host(server) 4 to receive packets at maximum bandwidth of 4mbps. Host 3 is irrelevant for now. I have achieved the connections between h1 h2 h4 but when I turn the host 4 in a server as shown it becomes unreachable and I can't make it reachable with everything I tried so far.How can I make it reachable from h1 and h2 after making it a server? The other problem I have faced is that I can't find a way to implement the Qos rules for achieving the wanted bandwidth. Everything is implemented with mininet, ODL remote controller and for the bandwidth checks I use Xterm.
mininet> sh ovs-ofctl add-flow s2 priority=500,in_port=1,actions=output:3
mininet> sh ovs-ofctl add-flow s2 priority=500,in_port=3,actions=output:1
mininet> sh ovs-ofctl add-flow s2 priority=600,in_port=2,actions=output:3
mininet> sh ovs-ofctl add-flow s2 priority=600,in_port=3,actions=output:2
mininet> sh ovs-ofctl add-flow s2 dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,actions=output:2
mininet> sh ovs-ofctl add-flow s2 dl_src=00:00:00:00:00:02,dl_dst=00:00:00:00:00:01,actions=output:1
mininet> sh ovs-ofctl add-flow s2 dl_type=0x806,nw_proto=1,action=flood
mininet> sh ovs-ofctl add-flow s2 priority=500,dl_type=0x800,nw_src=10.0.0.0/24,nw_dst=10.0.0.0/24,actions=normal
mininet> sh ovs-ofctl add-flow s2 priority=800,dl_type=0x800,nw_src=10.0.0.4,nw_dst=10.0.0.0/24,actions=mod_nw_tos:184,normal
mininet> sh ovs-ofctl add-flow s3 priority=500,in_port=3,actions=output:2
mininet> sh ovs-ofctl add-flow s3 priority=500,in_port=2,actions=output:3
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 X h4
h2 -> h1 X h4
h3 -> X X X
h4 -> h1 h2 X
*** Results: 50% dropped (6/12 received)
Thank you in advance.

Since you are in a tree topology, you don't have loop, and I assume that you configured ODL correctly.
I don't see the necessity to install most of the rules that you listed.
Before adding any rule try to run the pingall and check that the controller is working correctly (since some ping are received it seems to work)
*** Configuring hosts
h1 h2 h3 h4
*** Starting controller
c0
*** Starting 3 switches
s1 s2 s3 ...
*** Starting CLI:
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3 h4
h2 -> h1 h3 h4
h3 -> h1 h2 h4
h4 -> h1 h2 h3
*** Results: 0% dropped (12/12 received)
mininet>
I think that for what you are trying to do, you need to act only on s3 or s2 with the mod_nw_tos parameter.
sh ovs-ofctl add-flow s3 priority=500,dl_type=0x800,nw_src=10.0.0.0/24,nw_dst=10.0.0.0/24,actions=normal
sh ovs-ofctl add-flow s3 priority=800,ip,nw_src=10.0.0.4,actions=mod_nw_tos:184,normal

Related

Is it possible to split traffic between two ports in percentage basis with openflow rules?

Say, I have two output ports, Y, Z, and one input port, X. I want to forward N% of all the traffic from X to Y and the rest of the traffic to Z. Is it possible to achieve this behavior with OpenFlow?
I have tried following with the group tables:
ovs-ofctl add-group s1 group_id=1,type=select,bucket=weight:50,output:2
ovs-ofctl add-group s1 group_id=2,type=select,bucket=weight:50,output:3
ovs-ofctl add-flow s1 "in_port=1,actions=group:1,group:2"
ovs-ofctl add-flow s1 "in_port=2,actions=output:1"
ovs-ofctl add-flow s1 "in_port=3,actions=output:1"
After installing these rules, traffic is split between ports 2 and 3, but it isn't 50-50. Both of the ports are getting way less traffic than expected. I am not sure why that is the case. Do you think this method should work?
This method of using group tables to split traffic on a percentage basis works. However, the command sequences presented in the question to achieve this are wrong.
One group table with two buckets is enough to split traffic between two ports. For example, to split traffic from port 1 to ports 2 and 3 with an 80:20 ratio:
ovs-ofctl add-group s1 group_id=1,type=select,bucket=weight:80,output:2,bucket,output:3
ovs-ofctl add-flow s1 in_port=1,actions=group:1 # Ingress path
ovs-ofctl add-flow s1 in_port=2,actions=output:1 # Egress path 2
ovs-ofctl add-flow s1 in_port=3,actions=output:1 # Egress path 2

use openflow to reject (and not! just drop) packets

is it possible to have packages rejected instead of just dropped?
E.g. this
ovs-ofctl add-flow ovs_eth0 "table=0, priority=10000, ip, nw_proto=17, tp_dst=$port, actions=drop"
just drops it. But I would like to have it sent an explicit reject back.

Pause Open vSwitch (OVS) with the POX controller

I am trying to pause an OVS with POX as described in
http://www.openvswitch.org/support/dist-docs/ovs-ofctl.8.txt
The respective add-flow command is (thanks to pchaigno for his answer):
sudo ovs-ofctl add-flow c2 "dl_dst=00:00:00:00:00:01,actions=controller(pause)"
(switch name c2)
But, I cannot find in the POX documentation a way of sending such command to the switch.

how to ping between hosts under 2 switches,which dont have a switch-switch link? pox controller

how to ping between hosts under 2 switches,which have no link switch-switch connection??
switch1(connect to host1) and switch2(connect to host2) are connected to the controller,...Is it possible to ping between host1 and host2?
c1
/\
s1 s2
/ \
h1 h2
No it is not possible and the controller will not be able to find a route between the two hosts.

OVS L3 Routing with mininet

I am trying to make mininet topology L3 OVS OF13 such as:
sudo mn --controller=remote,ip=127.0.0.1 --topo linear,2 --switch ovsk,protocols=OpenFlow13
H1: IP 10.0.0.1/24
H2: IP 10.0.1.1/24
Add route:
h1 route add default gw 10.0.0.254
h2 route add default gw 10.0.1.254
I add the following flows:
sh ovs-ofctl add-flow -OOpenflow13 s1 priority=500,dl_type=0x800,nw_src=10.0.0.0/24,nw_dst=10.0.1.0/24,actions=normal
sh ovs-ofctl add-flow -OOpenflow13 s2 priority=500,dl_type=0x800,nw_src=10.0.1.0/24,nw_dst=10.0.0.0/24,actions=normal
sh ovs-ofctl add-flow -OOpenflow13 s1 arp,nw_dst=10.0.0.1,actions=ouput:1
sh ovs-ofctl add-flow -OOpenflow13 s2 arp,nw_dst=10.0.1.1,actions=ouput:1
In the interface s1-eth1 IP 10.0.0.254 and interface s2-eth1 IP 10.0.1.254. i do ping to see connection but i have always Destination Host Unreachable
Can anyone help me thanks..
It is not recommended to configure IP address on the switch data ports. The IP addresses on the data ports should ideally be configured using OpenFlow, that is, we should add flows in such a way that the controller responds to the ARP requests for default gateway IP address. Please refer to the link https://github.com/mininet/openflow-tutorial/wiki/Router-Exercise.
If you configure IP address on the data ports of the switch, you will have to setup complete routing in Linux, that is, you will need to enable forwarding on the switches possibly the IP addresses on the interfaces connecting the two switches.