x86 ICOS and OpenFlow

If you need an OpenFlow-based network, you can go through a CLI set of commands and do it old-school way.

As we mention already, ICOS offers a possibility to work via Linux shell with L2/L3 networks.
It is true to the OpenFlow-related things as well.

How to do it?

It’s very simple!

1. Switch to Open-Flow passive mode via icos-cli

#configure
#openflow passive-mode

2. Install OVS common component via Linux shell:

#sudo apt-get install openvswitch-common

That’s all. You can check connectivity with the simple show command:

#ovs-ofctl show tcp:127.0.0.1

You’ll see something like this:

root@nba720:~# ovs-ofctl show tcp:127.0.0.1

OFPT_FEATURES_REPLY (xid=0x2): dpid:00000005642f3c7d n_tables:255, n_buffers:256
capabilities:  FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP SET_DL_SRC SET_DL_DST
SET_NW_SRC  SET_NW_DST  SET_NW_TOS
1(0/2):  addr:00:05:64:2f:3c:7d      config:    0    state:      LINK_DOWN
peer:        10MB-HD 100MB-HD 100MB-FD 10GB-FD AUTO_PAUSE_ASYM      speed: 0 Mbps now, 0 Mbps max
2(0/3):  addr:00:05:64:2f:3c:7d      config:      0      state:   LINK_DOWN
peer:       10MB-HD 10GB-FD COPPER AUTO_PAUSE_ASYM      speed: 0 Mbps now, 0 Mbps max
3(0/4): addr:00:05:64:2f:3c:7d      config:      0      state:      LINK_DOWN
peer:      100MB-HD 10GB-FD COPPER AUTO_PAUSE AUTO_PAUSE_ASYM      speed: 0 Mbps now, 0 Mbps max
4(0/5): addr:00:05:64:2f:3c:7d      config:    0      state:      LINK_DOWN
peer:      10MB-HD 100MB-HD 100MB-FD 1GB-HD 1GB-FD 10GB-FD
COPPER FIBER AUTO_PAUSE AUTO_PAUSE_ASYM      speed: 0 Mbps now, 0 Mbps max
5(0/6): addr:00:05:64:2f:3c:7d      config:      0      state:      LINK_DOWN
peer:      10MB-HD 10MB-FD 1GB-FD COPPER FIBER AUTO_NEG      speed: 0 Mbps now, 0 Mbps max

Now you are able to manage flows with ovs-ofctl directly from the switch.

For example:

ovs-ofctl show tcp:127.0.0.1

33(0/33): addr:00:05:64:2f:3c:7d
config: 0 state: 0
speed: 0 Mbps now, 0 Mbps max  34(0/34): addr:00:05:64:2f:3c:7d      config:     0      state:      0
speed: 0 Mbps now, 0 Mbps max  35(0/35): addr:00:05:64:2f:3c:7d      config:     0      state:      0
speed: 0 Mbps now, 0 Mbps max  172(3/1): addr:00:05:64:2f:3c:7d      config:     0      state:      0
speed: 0 Mbps now, 0 Mbps max  173(3/2): addr:00:05:64:2f:3c:7d      config:     0      state:      0
speed: 0 Mbps now, 0 Mbps max

Now you can do things like:

#####################################################
### Input (Source) port : 1,2,3,4,5,6 -> Filter (10.10.10.x and tcp and port 80) -> hash Load-balancing -> Output (Destination) port group : 8,9,10
#####################################################
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=1,nw_proto=6,nw_src=10.10.10.0/24,tp_dst=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=1,nw_proto=6,nw_dst=10.10.10.0/24,tp_src=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=2,nw_proto=6,nw_src=10.10.10.0/24,tp_dst=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=2,nw_proto=6,nw_dst=10.10.10.0/24,tp_src=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=3,nw_proto=6,nw_src=10.10.10.0/24,tp_dst=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=3,nw_proto=6,nw_dst=10.10.10.0/24,tp_src=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=4,nw_proto=6,nw_src=10.10.10.0/24,tp_dst=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=4,nw_proto=6,nw_dst=10.10.10.0/24,tp_src=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=5,nw_proto=6,nw_src=10.10.10.0/24,tp_dst=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=5,nw_proto=6,nw_dst=10.10.10.0/24,tp_src=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=6,nw_proto=6,nw_src=10.10.10.0/24,tp_dst=80/0xffff,actions=output:171
ovs-ofctl add-flow br0 dl_type=0x0800,in_port=6,nw_proto=6,nw_dst=10.10.10.0/24,tp_src=80/0xffff,actions=output:171

#####################################################
### Input : 11,12,13,14,15,16 -> Aggregation -> Output : 17,18
#####################################################
ovs-ofctl add-flow br0 in_port=11,actions=output:17,18
ovs-ofctl add-flow br0 in_port=12,actions=output:17,18
ovs-ofctl add-flow br0 in_port=13,actions=output:17,18
ovs-ofctl add-flow br0 in_port=14,actions=output:17,18
ovs-ofctl add-flow br0 in_port=15,actions=output:17,18
ovs-ofctl add-flow br0 in_port=16,actions=output:17,18

#####################################################
### Input : 21,22,23,24,25,26,27,28,29,30 -> Hash Load-balancing -> Output group 1 and 2 : (31,32,33,34), (35,36,37,38)
#####################################################
ovs-ofctl add-flow br0 in_port=21,actions=output:172,173
ovs-ofctl add-flow br0 in_port=22,actions=output:172,173
ovs-ofctl add-flow br0 in_port=23,actions=output:172,173
ovs-ofctl add-flow br0 in_port=24,actions=output:172,173
ovs-ofctl add-flow br0 in_port=25,actions=output:172,173
ovs-ofctl add-flow br0 in_port=26,actions=output:172,173
ovs-ofctl add-flow br0 in_port=27,actions=output:172,173
ovs-ofctl add-flow br0 in_port=28,actions=output:172,173
ovs-ofctl add-flow br0 in_port=29,actions=output:172,173
ovs-ofctl add-flow br0 in_port=30,actions=output:172,173
#####################################################

If you want to keep flows after the switch reboot – you need to add a script to the system boot file. Check our x86 ICOS guide for how-to.