netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / vtep / README.ovs-vtep.md
1 How to Use the VTEP Emulator
2 ============================
3
4 This document explains how to use ovs-vtep, a VTEP emulator that uses
5 Open vSwitch for forwarding.
6
7 Requirements
8 ------------
9
10 The VTEP emulator is a Python script that invokes calls to tools like
11 vtep-ctl and ovs-vsctl and is useful only when OVS daemons like ovsdb-server
12 and ovs-vswitchd are running. So those components should be installed. This
13 can be done by either of the following methods.
14
15 1. Follow the instructions in the INSTALL.md file of the Open vSwitch repository
16 (don't start any daemons yet).
17
18 2. Follow the instructions in INSTALL.Debian.md file and then install the
19 "openvswitch-vtep" package (if operating on a debian based machine). This
20 will automatically start the daemons.
21
22 Design
23 ======
24
25 At the end of this process, you should have the following setup:
26
27
28       +---------------------------------------------------+
29       | Host Machine                                      |
30       |                                                   |
31       |                                                   |
32       |       +---------+ +---------+                     |
33       |       |         | |         |                     |
34       |       |   VM1   | |   VM2   |                     |
35       |       |         | |         |                     |
36       |       +----o----+ +----o----+                     |
37       |            |           |                          |
38       | br0 +------o-----------o--------------------o--+  |
39       |            p0          p1                  br0    |
40       |                                                   |
41       |                                                   |
42       |                              +------+   +------+  |
43       +------------------------------| eth0 |---| eth1 |--+
44                                      +------+   +------+
45                                      10.1.1.1   10.2.2.1
46                         MANAGEMENT      |          |
47                       +-----------------o----+     |
48                                                    |
49                                    DATA/TUNNEL     |
50                                  +-----------------o---+
51
52 Notes:
53
54 1. We will use Open vSwitch to create our "physical" switch labeled br0
55
56 2. Our "physical" switch br0 will have one internal port also named br0
57    and two "physical" ports, namely p0 and p1.
58
59 3. The host machine may have two external interfaces. We will use eth0
60    for management traffic and eth1 for tunnel traffic (One can use
61    a single interface to achieve both). Please take note of their IP
62    addresses in the diagram. You do not have to use exactly
63    the same IP addresses. Just know that the above will be used in the
64    steps below.
65
66 4. You can optionally connect physical machines instead of virtual
67    machines to switch br0. In that case:
68
69    4.1. Make sure you have two extra physical interfaces in your host
70         machine, eth2 and eth3.
71
72    4.2. In the rest of this doc, replace p0 with eth2 and p1 with eth3.
73
74 5. In addition to implementing p0 and p1 as physical interfaces, you can
75    also optionally implement them as standalone TAP devices, or VM
76    interfaces for simulation.
77
78 6. Creating and attaching the VMs is outside the scope of this document
79    and is included in the diagram for reference purposes only.
80
81 Startup
82 -------
83
84 These instructions describe how to run with a single ovsdb-server
85 instance that handles both the OVS and VTEP schema. You can skip
86 steps 1-3 if you installed using the debian packages as mentioned in
87 step 2 of the "Requirements" section.
88
89 1. Create the initial OVS and VTEP schemas:
90
91       ```
92 ovsdb-tool create /etc/openvswitch/ovs.db vswitchd/vswitch.ovsschema
93 ovsdb-tool create /etc/openvswitch/vtep.db vtep/vtep.ovsschema
94       ```
95
96 2. Start ovsdb-server and have it handle both databases:
97
98       ```
99 ovsdb-server --pidfile --detach --log-file \
100 --remote punix:/var/run/openvswitch/db.sock \
101 --remote=db:hardware_vtep,Global,managers \
102 /etc/openvswitch/ovs.db /etc/openvswitch/vtep.db
103       ```
104
105 3. Start OVS as normal:
106
107       ```
108 ovs-vswitchd --log-file --detach --pidfile \
109 unix:/var/run/openvswitch/db.sock
110       ```
111
112 4. Create a "physical" switch and its ports in OVS:
113
114       ```
115 ovs-vsctl add-br br0
116 ovs-vsctl add-port br0 p0
117 ovs-vsctl add-port br0 p1
118       ```
119
120 5. Configure the physical switch in the VTEP database:
121
122       ```
123 vtep-ctl add-ps br0
124 vtep-ctl set Physical_Switch br0 tunnel_ips=10.2.2.1
125       ```
126       
127 6. Start the VTEP emulator. If you installed the components by reading the
128    INSTALL.md file, run the following from the same directory as this
129    README.md:
130
131       ```
132 ./ovs-vtep --log-file=/var/log/openvswitch/ovs-vtep.log \
133 --pidfile=/var/run/openvswitch/ovs-vtep.pid \
134 --detach br0
135       ```
136
137   If the installation was done by installing the openvswitch-vtep
138   package, you can find ovs-vtep at /usr/share/openvswitch/scripts.
139
140 7. Configure the VTEP database's manager to point at an NVC:
141
142       ```
143 vtep-ctl set-manager tcp:<CONTROLLER IP>:6640
144       ```
145
146    Where CONTROLLER IP is your controller's IP address that is accessible
147    via the Host Machine's eth0 interface.
148
149 Simulating an NVC
150 -----------------
151
152 A VTEP implementation expects to be driven by a Network Virtualization
153 Controller (NVC), such as NSX.  If one does not exist, it's possible to
154 use vtep-ctl to simulate one:
155
156 1. Create a logical switch:
157
158       ```
159 vtep-ctl add-ls ls0
160       ```
161
162 2. Bind the logical switch to a port:
163
164       ```
165 vtep-ctl bind-ls br0 p0 0 ls0
166 vtep-ctl set Logical_Switch ls0 tunnel_key=33
167       ```
168
169 3. Direct unknown destinations out a tunnel:
170
171       ```
172 vtep-ctl add-mcast-remote ls0 unknown-dst 10.2.2.2
173       ```
174
175 4. Direct unicast destinations out a different tunnel:
176
177       ```
178 vtep-ctl add-ucast-remote ls0 00:11:22:33:44:55 10.2.2.3
179       ```