The ovs-ofctl command line tool that ships with Open vSwitch provides a very convenient way to interact with OpenFlow forwarding rules, not just with Open vSwitch, but with any switch that can be configured to accept passive connections from an OpenFlow controller.
This article looks takes the example in Integrated hybrid OpenFlow and repeats it without an OpenFlow controller, using ovs-ofctl instead.
First start Mininet without a controller and configure the switch to listen for OpenFlow commands:
DDoS mitigation is only one use case for large flow control, others described on this blog include: ECMP / LAG load balancing, traffic marking and packet capture. This script can be modified to address these different use cases. The Mininet test bed provides a useful way to test hybrid OpenFlow control schemes before moving them into production using physical switches that support integrated hybrid OpenFlow and sFlow.
This article looks takes the example in Integrated hybrid OpenFlow and repeats it without an OpenFlow controller, using ovs-ofctl instead.
First start Mininet without a controller and configure the switch to listen for OpenFlow commands:
sudo mn --topo single,3 --controller none --listenport 6633Next use enable normal forwarding in the switch:
ovs-ofctl add-flow tcp:127.0.0.1 priority=10,action=normalThe following command blocks traffic from host 1 (10.0.0.1):
ovs-ofctl add-flow tcp:127.0.0.1 priority=11,dl_type=0x0800,nw_src=10.0.0.1,action=dropThe following command removes the block:
ovs-ofctl --strict del-flows tcp:127.0.0.1 priority=11,dl_type=0x0800,nw_src=10.0.0.1Finally, modify the controller script with the following block() and allow() functions:
function addFlow(spec) {Moving from Mininet to a production setting is simply a matter of modifying the script to connect to the remote switch, configuring the switch to listen for OpenFlow commands, and configuring the switch to send sFlow data to sFlow-RT.
runCmd(['ovs-ofctl','add-flow','tcp:127.0.0.1',spec.join(',')]);
}
function removeFlow(spec) {
runCmd(['ovs-ofctl','--strict','del-flows','tcp:127.0.0.1',spec.join(',')]);
}
function block(address) {
if(!controls[address]) {
addFlow(['priority=11','dl_type=0x0800','nw_src=' + address,'action=drop']);
controls[address] = { action:'block', time: (new Date()).getTime() };
}
}
function allow(address) {
if(controls[address]) {
removeFlow(['priority=11','dl_type=0x0800','nw_src=' + address]);
delete controls[address];
}
}
DDoS mitigation is only one use case for large flow control, others described on this blog include: ECMP / LAG load balancing, traffic marking and packet capture. This script can be modified to address these different use cases. The Mininet test bed provides a useful way to test hybrid OpenFlow control schemes before moving them into production using physical switches that support integrated hybrid OpenFlow and sFlow.