Statistics
| Branch: | Tag: | Revision:

mininet / INSTALL @ 35341142

History | View | Annotate | Download (6.04 KB)

1

    
2
Preliminary Mininet Installation/Configuration Notes
3

    
4
Development version, March 2010
5

    
6
---
7

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

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

    
15
http://www.openflowswitch.org/foswiki/bin/view/OpenFlow/MininetGettingStarted
16

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

    
20
1. Core Mininet installation
21

    
22
  To install Mininet itself, with root privileges:
23

    
24
  # make install
25

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

    
30
2. Linux Kernel requirements
31

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

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

    
48
    sudo su -c "cat sysctl_addon >> /etc/sysctl.conf"
49

    
50
  To save the config change, run:
51

    
52
    sudo sysctl -p
53
    
54
3. OpenFlow software and configuration requirements
55

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

    
62
  To switch to the most recent OpenFlow 0.8.9 release branch (the most
63
  recent one with full NOX support):
64

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

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

    
74
  See ~/mininet/util/modprobe_setup.sh for an example.
75

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

    
84
 To run the iperf test, you need to install iperf:
85

    
86
    sudo aptitude/yum install iperf
87

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

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

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

    
104
Good luck!
105
  
106
--- Patches and Footnones ---
107

    
108
[1] OpenFlow Reference Implementation patch for Linux 2.6.33/2.6.33.1
109

    
110
The OpenFlow kernel reference implementation does not compile out of the box
111
on Linux 2.6.33/2.6.33.1 with network namespaces enabled.
112

    
113
The following workaround modifies it to always use the root namespace, and should
114
enable it to work with Mininet under 2.6.33.x:
115

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

    
122
#include "compat.h"
123

    
124
+#ifdef CONFIG_NET_NS
125
+#include <net/net_namespace.h>
126
+#endif
127

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

    
143
[2] Linux kernel 2.6.33/2.6.33.1 tun driver patch
144

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

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

    
162

    
163
[3] Patch to reference OpenFlow controller to allow more than 16 switches
164

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

    
181