找回密码
 注册
查看: 3830|回复: 0

Mininet and Open vSwitch on CentOS 7

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2018-12-20 01:22:57 | 显示全部楼层 |阅读模式
SEPTEMBER 13, 2014 6 COMMENTS& y3 w3 u2 p8 q1 f" }. x
The following are the steps I took to get Mininet running in CentOS 7.  I ran into many issues trying to get OVS installed and running.  There was a conflict between the OVS script tools starting OVSDB and SELinux.  I had to set SELinux to Passive to work around it.  So depending on what system you are running this on,  be advised of the following steps and what system level settings I changed for security.  I assume most of these will be corrected once OVS officially supports CentOS/RHEL 7.2 c: i8 }8 t, l2 s" I# Z% u
Installing Mininet on CentOS7
; P! d5 R+ C$ N6 U' r– I needed VM with 2GB memory to get OS installed.
. t: d- x8 R, I  W– I used CentOS-7.0-1406-x86_64-livecd.iso to install the VM. I’m not going to outline steps for installing CentOS.
+ G& n, V; `5 k  P: `– I created a local user called mininet and gave it sudo access and ran the remainder as that user.
5 Q+ s7 R* C+ t# @0 _4 g+ ?– Install SSHD- J7 M% h5 ?' B* I4 W; J' S  A! F
sudo yum -y install openssh-server* s/ [# J  V( e- y% d
sudo chkconfig sshd on
9 [! ]  |* I1 I/ L1 B/ _sudo service sshd start
) s$ L/ k. S" B% C  U9 K– Disable SELinux to get OVSDB to stasrt- z9 L9 v) `( a/ @
sudo setenforce Permissive
* n9 i: ^7 H: ?– Modify sudoers secure_path to add /usr/local/bin so the ‘controller’ which be found.* v9 r5 Y: E( a9 M! x* }
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
3 Q/ z7 c% l" P% E$ C– Install GIT9 k; P+ B' C+ ^6 g
sudo yum -y install git2 u9 L3 \4 I7 M+ m- k
– Get Mininet.( ?  J5 C3 t$ B4 B- h% k3 _# p# \
git clone git://github.com/mininet/mininet.git* T3 l* l) _+ i& D# s$ ]! s
– Update installer mininet/util/install.sh.
" B/ g4 F4 C# [# i/ z***ADD the following before the line ‘test -e /etc/fedora-release && DIST=”Fedora”‘. Somewhere around line 47.  May differ.% h, q8 K2 @. R# i% M% O9 x$ ~
test -e /etc/centos-release && DIST="CentOS"0 J" v1 ?: J% B- g
if [ "$DIST" = "CentOS" ]; then% i& C% {3 {" ^
    install='sudo yum -y install'- }5 A$ r* R4 k& ]3 t
    remove='sudo yum -y erase'
9 l9 k1 v+ i3 K3 j' s. t7 ?8 _+ `! H    pkginst='sudo rpm -ivh'* m% M6 A4 k- V/ I# O
    # Prereqs for this script. \" l7 f  O8 X$ s) s- b
    if ! which lsb_release &> /dev/null; then* H* m. p  v0 |# y  s( w) X& \
        $install redhat-lsb-core/ ~. |( Q6 C3 K
    fi
1 i7 P, \/ I: Tfi5 V( q) V+ U$ M2 X' }. f
***EDIT8 x7 G) g' z) ~$ N( I/ z
if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora|CentOS'; then
  Y% F. I& [. m4 }# i' ?    echo "Install.sh currently only supports Ubuntu, Debian and Fedora."0 ^8 n5 r; d; f
    exit 1
( b, j! L9 v4 u  ^4 K4 M) T7 v$ dfi
/ S" \$ w- x4 E) o% W1 U– Install Mininet and OpenFlow reference.  Not OVS.
% B+ K1 Y% J4 Z9 G0 c. F, D! }mininet/util/install.sh -nf
' h7 e, t9 `0 {9 ~6 C6 R– Build and Install OVS
4 m+ p0 F- \, y2 a9 P: f: T2 Gsudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
2 {; L  I) y7 r, tkernel-debug-devel autoconf automake rpm-build redhat-rpm-config \0 y3 k. N/ V, M$ V
libtool wget2 j4 c; Q2 y4 c3 L
: T3 v7 m7 I  X! f  P4 G: E  L
mkdir -p /home/mininet/rpmbuild/SOURCES/
% T5 Z; h% H- k5 h; K! Kcd /home/mininet/rpmbuild/SOURCES/
1 {' ]0 C) Z6 q& Qwget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz: y7 Q2 u* E4 o% s: ~
tar zxvf openvswitch-2.3.0.tar.gz! W1 u' Q7 g* u
cd openvswitch-2.3.0& `5 I0 h: Y2 r8 F+ g
rpmbuild -bb --without check rhel/openvswitch.spec
+ T0 y7 [! G: a4 I! P; Usudo rpm -ivh --nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm/ B2 z4 g' l% R  H; L3 v' T8 V
– Start OVS
/ K& Z% j' h8 Esudo /etc/init.d/openvswitch start
' t- k; o" y6 q! l/ m– Check working
- ]7 y8 X* T5 Z5 ]+ ?[mininet@localhost ~]$ sudo ovs-vsctl show
2 }- {8 G% a% x4 j' K$ Y76ed3664-6b6b-4325-85c1-c9a2bf735e30
4 p$ [' i3 J! p. ~1 l: \    ovs_version: "2.3.0"
5 R( Q5 o' h7 }– Test out Mininet7 X2 Q8 D/ `7 p7 ^! S: `' Q7 D
[mininet@localhost ~]$ sudo mn --test pingall
) I# X4 l7 x4 m& J/ b3 s4 o*** Creating network0 E- e: P  ?) @* i
*** Adding controller
/ ~6 v3 O' ~. J  P: P( H*** Adding hosts:# b5 O$ J, Z* n# m2 R2 h) L) H
h1 h29 x: \9 z; q; T% _6 c; ^- C# [% p
*** Adding switches:4 Q  }, O, ~8 S9 b+ ^
s14 @' a* [! r. v- I8 R
*** Adding links:
3 w3 y7 n4 P2 |/ U. V: o) T(h1, s1) (h2, s1)# p5 E* C$ e9 D1 n- C/ ]" _
*** Configuring hosts
; B+ ?: N3 R; ~3 ]  J1 a/ kh1 h2: G' c8 @/ R5 R: \- o
*** Starting controller
& M4 y9 U$ R+ w/ y2 D*** Starting 1 switches9 S% t1 B/ q1 `% x0 P
s1
! B! d, R' ?( g% d' J*** Waiting for switches to connect% l% i" v0 a5 }$ o6 A! [* |" K6 n
s1
% i  g$ g$ Y. n+ C1 i+ J*** Ping: testing ping reachability
+ k$ K% m$ a- I- \4 a1 T! ~5 mh1 -> h2
" k$ ^1 {; @( Q4 o6 h$ q0 {5 \h2 -> h1) j% M; Y8 N) T) ^- F, z: O" x
*** Results: 0% dropped (2/2 received)  K) ?3 P. ]; Y! R
*** Stopping 1 controllers+ M: N6 z. M- j9 V# g  E
c0
: j$ }% T9 o% a1 V*** Stopping 1 switches
6 c# I4 c  a& J! C( _# ~$ M- U. _s1 ..: @) O1 G1 N7 r) B, Y1 j# C" g
*** Stopping 2 hosts3 H" E- Z& }, K- a' ]
h1 h2; _+ X7 c: @) k6 Q) p! Z
*** Done
2 U' D, k3 m- w3 u4 ecompleted in 5.397 seconds
0 Z- I6 @' f. x4 i! e% VSo it seems to work.  But there are a few things to note.
2 P. ]+ G& q: |1. The kernel datapath is not installed.  This is totally userspace.  I could not get the kernel module to compile.  Wait until official support of RHEL7., y# ^- G7 r( j. U  c
2. The above is the extent of the testing I did.  There may be other issues that crop up.
$ u, X( z- W  d# b% }2 T6 `( R7 QHope this helps anyone that uses CentOS or RHEL 7 with Mininet.
4 q" ^  Q- h2 f: c0 ~' ?# Z+ d 3 d, H$ [: t' p# i0 I! }
This post ‘Mininet and OVS on CentOS 7’ first appeared on https://techandtrains.com/.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:58 , Processed in 0.015518 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表