Statistics
| Branch: | Tag: | Revision:

mininet / INSTALL @ 178a3d84

History | View | Annotate | Download (6.03 KB)

1
Preliminary Mininet Installation/Configuration Notes
2

    
3
Development version, March 2010
4

    
5
Disclaimer: this is not (yet) a 'release'; things may be broken.
6

    
7
These installation notes assume you understand how to do things 
8
like compile kernels, apply patches, configure networks, write code, 
9
etc.. If this is unfamiliar territory, we recommend using one of
10
our pre-built virtual machine images from:
11

    
12
http://www.openflowswitch.org/foswiki/bin/view/OpenFlow/MininetGettingStarted
13

    
14
If you are Linux-savvy and wish to take on the challenge of installing
15
Mininet and its dependencies from scratch, here are the requirements:
16

    
17
1. Core Mininet installation
18

    
19
  To install Mininet itself, with root privileges:
20

    
21
  # make install
22

    
23
  This places the mininet package in /usr/lib/python-2.5/site-packages/,
24
  so that 'import mininet' will work, and installs the primary mn
25
  script (mn) as well as its helper utility (mnexec.)
26

    
27
2. Linux Kernel requirements
28

    
29
  Mininet requires a kernel built with network namespace support enabled,
30
  i.e. with CONFIG_NET_NS=Y
31
  
32
  If your kernel doesn't support it, you will need to build and install a 
33
  kernel that does! >= 2.6.33 works best, but requires a patch to
34
  ofdatapath and to tun.c (see patches [1] and [2], below.)
35
  
36
  2.6.26 works with CONFIG_NET_NS enabled and no additional patches, but
37
  it is much slower at removing veth interfaces, resulting in much slower
38
  switch shutdown.
39

    
40
  For scalable configurations, you might need to increase some of your
41
  kernel limits. Sample params are in sysctl_addon, which can be appended to
42
  /etc/sysctl.conf (and modified as necessary for your desired
43
  configuration):
44

    
45
    sudo su -c "cat sysctl_addon >> /etc/sysctl.conf"
46

    
47
  To save the config change, run:
48

    
49
    sudo sysctl -p
50
    
51
3. OpenFlow software and configuration requirements
52

    
53
  Mininet requires either the reference OpenFlow switch implementation
54
  (from openflowswitch.org) or Open vSwitch (openvswitch.org) to be 
55
  installed. "make test" requires the reference user and kernel
56
  space implementations as well as Open vSwitch. Note the kernel
57
  implementation is not currently included in OpenFlow 1.0.
58

    
59
  To switch to the most recent OpenFlow 0.8.9 release branch (the most
60
  recent one with full NOX support):
61

    
62
  git checkout -b release/0.8.9 remotes/origin/release/0.8.9
63
  
64
  To compile for Linux >= 2.6.33, you may need to apply patch [1]
65
  included below.
66

    
67
  Mininet will automatically load and remove kernel module dependencies for
68
  supported switch types, using modprobe and rmmod - but these modules must be
69
  in a location where modprobe can find them.
70

    
71
  See ~/mininet/util/modprobe_setup.sh for an example.
72

    
73
  The reference OpenFlow controller (controller(8)) only supports 16
74
  switches by default! If you wish to run a network with more than 16
75
  switches, please recompile controller(8) with larger limits, or use a
76
  different controller such as nox. A patch to controller(8) is included
77
  as patch [3] below.
78
  
79
4. Other software dependencies
80

    
81
 To run the iperf test, you need to install iperf:
82

    
83
    sudo aptitude/yum install iperf
84

    
85
  We assume you already have ping installed. ;-)
86
  
87
 To use xterm or sshd with Mininet, you need the following:
88

    
89
    sudo aptitude/yum install sshd xterm screen
90
    
91
 Some examples may have additional requirements - consult the specific
92
 example file for details.
93
  
94
5. Other notes and recommendations
95

    
96
  Mininet should probably be run either on a machine with
97
  no other important processes, or on a virtual machine.
98
  
99
  Multiple concurrent Mininet instances are not supported!
100

    
101
Good luck!
102
  
103
--- Patches and Footnones ---
104

    
105
[1] OpenFlow Reference Implementation patch for Linux 2.6.33/2.6.33.1
106

    
107
The OpenFlow kernel reference implementation does not compile out of the box
108
on Linux 2.6.33/2.6.33.1 with network namespaces enabled.
109

    
110
The following workaround modifies it to always use the root namespace, and should
111
enable it to work with Mininet under 2.6.33.x:
112

    
113
diff --git a/datapath/datapath.c b/datapath/datapath.c
114
index 4a4d3a2..365aa25 100644
115
--- a/datapath/datapath.c
116
+++ b/datapath/datapath.c
117
@@ -47,6 +47,9 @@
118

    
119
#include "compat.h"
120

    
121
+#ifdef CONFIG_NET_NS
122
+#include <net/net_namespace.h>
123
+#endif
124

    
125
/* Strings to describe the manufacturer, hardware, and software.  This data 
126
 * is queriable through the switch description stats message. */
127
@@ -259,7 +262,11 @@ send_openflow_skb(const struct datapath *dp,
128
                 struct sk_buff *skb, const struct sender *sender)
129
{
130
       return (sender
131
-               ? genlmsg_unicast(skb, sender->pid)
132
+#ifdef CONFIG_NET_NS
133
+               ? genlmsg_unicast(&init_net, skb, sender->pid)
134
+#else
135
+               ? genlmsg_unicast(skb, sender->pid)
136
+#endif
137
               : genlmsg_multicast(skb, 0, dp_mc_group(dp), GFP_ATOMIC));
138
}
139

    
140
[2] Linux kernel 2.6.33/2.6.33.1 tun driver patch
141

    
142
The tun driver in Linux 2.6.33/2.6.33.1 doesn't work correctly in a network
143
namespace. As a result, running the user datapath in a network namespace
144
(e.g. as is done in examples/scratchnetuser.py) will cause a kernel panic
145
when sysfs cannot create an entry for a tap interface, since the tun network
146
device has a missing parent kobj. As a workaround, the following patch
147
skips creating the sysfs entries when this is the case. This is an acceptable
148
workaround as long as sysfs entries for tap interfaces are not being actively
149
used (and they are not currently in Mininet.)
150

    
151
diff linux-2.6.33.1/drivers/net/tun-orig.c linux-2.6.33.1/drivers/net/tun.c 
152
1009c1009,1011
153
< 		if (device_create_file(&tun->dev->dev, &dev_attr_tun_flags) ||
154
---
155
> 		/* BL workaround: check for null parent kobj */
156
> 		if (!tun->dev->dev.kobj.sd ||
157
> 		    device_create_file(&tun->dev->dev, &dev_attr_tun_flags) ||
158

    
159

    
160
[3] Patch to reference OpenFlow controller to allow more than 16 switches
161

    
162
diff --git a/controller/controller.c b/controller/controller.c
163
index 41f2547..6eec590 100644
164
--- a/controller/controller.c
165
+++ b/controller/controller.c
166
@@ -58,8 +58,8 @@
167
 #include "vlog.h"
168
 #define THIS_MODULE VLM_controller
169
 
170
-#define MAX_SWITCHES 16
171
-#define MAX_LISTENERS 16
172
+#define MAX_SWITCHES 4096
173
+#define MAX_LISTENERS 4096
174
 
175
 struct switch_ {
176
     struct lswitch *lswitch;
177

    
178