- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
Mininet on CentOS 7 KVM! f7 F0 p3 f. L2 n# i
$ R/ B+ v: L, A( o& rMininet is a Linux-based network emulator which enables the prototyping, development and sharing of OpenFlow and Software-Defined Networking (SDN) networks. Given the growing importance of these networking technologies, Mininet has potential as a teaching tool in the IT lab. This post describes how to get Mininet running in KVM on CentOS 7, and introduces some basic commands and workflows.
1 A, n6 i( s& [8 W; H5 X) f6 ^1 s e# }0 g& e
The recommended way to install Mininet is to use the pre-built VM appliance available on the project website. This is based in the long-term support version of Ubuntu (Trusty Tahr 14.04). The download is a zipped package containing an OVF file and a VMDK image. For use in KVM (Virtual Machine Manager) on CentOS 7, disregard the OVF file and convert the VMDK image to QCOW2 format as follows:
8 ~+ t1 K3 t5 m) u* i* [
E% j& {! t9 t" v3 Q$ h4 n" z" Lqemu-img convert -O qcow2 MyAppliance.vmdk MyAppliance.qcow21 e) B" F% d( x3 V. d4 \/ R3 z
This image is now ready for used in a new KVM virtual machine. A quick look at the OVF file indicates that the VM expects only 1 CPU, 1024 MB of RAM and an E1000 network card.* J7 }: m$ Q+ t3 L) l
# G) e) F" R3 E t/ {6 k
When the Mininet VM boots up, log in as user mininet with password mininet. This can be done directly in KVM’s Virtual Machine Manager console, or (once you know the VM’s IP address) via SSH. If using SSH don’t forget to add the -X option to allow X11 forwarding if you want to use xterm terminals (see below):
/ V! e6 k$ B# ]0 J3 c/ _4 k+ r' W" b2 I9 S- f; w5 ?" ?
ssh -X mininet@192.168.122.xxx+ p$ N0 K& n1 Q2 D
Once logged in, Mininet can be started immediately with a default minimal configuration by running this short command:
- b! ^: M. i6 d9 p O& ?* {1 E% {' P4 v( x
[sudo] mn
! ]( Q0 M& g% Q7 `This network topology consists of one OpenFlow kernel switch connected to two hosts, plus the OpenFlow reference controller. The Mininet CLI prompt now awaits further input:: Q% J: u I/ S+ U
/ u4 Y. [8 e1 Q
mininet1
. s$ c1 s! D) s5 a2 r, m- L7 ^. m; k6 Q/ Q: r& }6 A
The help command provides an overview of where we can go from here:
$ v2 u# X! g1 W+ L3 ^+ ^+ w: ?* s$ f! o
mininet2
6 d1 v$ v( k0 Q0 I" F1 Q" j
! D1 l' ^1 Q- F5 I4 [$ X k$ g) LThe basic informational commands are as follows:: U2 g1 N% j* c0 t; m& j
) c$ \1 _# S( ?6 f% G1 emininet3
9 v2 T$ c* y. C$ F: V# c* U {+ f% C; b S
The output of these commands when used with the minimal topology is:0 z8 b3 ]* i( E6 j3 s
3 Q, r/ L S1 Z( Y& h
mininet41 A% @6 b" K% A' f) [% l4 j
) D) _* O4 T- FTerminals can be opened on nodes and normal system commands (eg. ip, tcpdump, tshark and arp) run in those terminals:+ p4 T: D4 l# D Y0 p+ e2 J% y5 w8 _
/ I Y% x/ n5 p+ `; T* H; G! Z
mininet5
& p* o* f- D! R1 @$ s: Q3 s( y
Tip: to start an Xterm for every node on startup, pass the -x option:7 b0 u# y. }- K$ e; x! F% e
0 @+ ^" U! [2 v: G2 R[sudo] mn -x7 Y$ n! r- m8 e1 L8 J3 G; p
Note that Mininet is an example of network virtualisation using network namespaces. It virtualises only the network; otherwise, each host process in a topology sees the same set of processes and directories (those of the Mininet host VM).
; |3 L3 |9 j+ A
3 v/ b# B3 f0 wThe Mininet website has two good resources for getting started with Mininet:( S: j# ?; x* ^3 G# }! K& m, ~
! t" P7 G# _ o9 @1 N% c4 @
Sample Workflow
5 Z* @2 b U' X+ `6 D: Z# KWalkthrough1 Q3 D: O4 }4 f
There are also quite a few videos available on Mininet:
+ G( V0 [, ^* ?9 x
8 y1 D. @# I. y6 z6 @# ~. xVideos' S% B5 G* Z, \6 N4 |; Z
There are also some Mininet teaching resources available:
! L. l( m( N4 L7 |/ z) A
" @/ d3 M% t& @; iTeaching and learning with Mininet- J! T3 S, _, Z, y: u
Hopefully this post has been enough to demonstrate Mininet’s potential as a modern network design and testing tool, and to get you started.1 ]: W, J: u" \7 @
8 _7 E4 l1 Q+ B* ?7 ZFor CentOS users not overly familiar with Ubuntu, an Ubuntu system can be shutdown like this:1 b1 j i0 N9 j
) m! G2 k0 v7 T$ R
[sudo] shutdown -P now |
|