86 | | |
| 89 | == 2. Point your switch to a controller == |
| 90 | An OpenFlow switch will not forward any packet, unless instructed by a controller. Basically the forwarding table is empty, until an external controller inserts forwarding rules. The OpenFlow controller communicates with the switch over the control network and it can be anywhere in the Internet as long as it is reachable by the OVS host. For the purpose of this tutorial and in order to minimize the resources we have reserved we are going to run OpenFlow controller at the same host as the OVS switch. This is '''merely''' for convenience reasons, the controller could have been anywhere on the Internet. |
| 91 | |
| 92 | In order to point our software OpenFlow switch to the controller run: |
| 93 | {{{ |
| 94 | sudo ovs-vsctl set-controller br0 tcp:127.0.0.1:6633 |
| 95 | }}} |
| 96 | |
| 97 | === `standalone` vs `secure` mode === |
| 98 | The OpenFlow controller is responsible for setting up all flows on the switch, which means that when the controller is not running there should be no packet switching at all. Depending on the setup of your network, such a behavior might not be desired. It might be best that when the controller is down, the switch should default back in being a learning layer 2 switch. In other circumstances however this might be undesirable. In OVS this is a tunable parameter, called `fail-safe-mode` which can be set to the following parameters: |
| 99 | * `standalone` [default] : in which case OVS will take responsibility for forwarding the packets if the controller fails |
| 100 | * `secure` : in which case only the controller is responsible for forwarding packets, and if the controller is down all packets are going to be dropped. |
| 101 | |
| 102 | In OVS when the parameter is not set it falls back to the `standalone` mode. For the purpose of this tutorial we will set the `fail-safe-mode` to `secure`, since we want to be the ones controlling the forwarding. Run: |
| 103 | {{{ |
| 104 | sudo ovs-vsctl set-fail-mode br0 secure |
| 105 | }}} |
| 106 | |
| 107 | |