易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 3827|回复: 0
收起左侧

Mininet and Open vSwitch on CentOS 7

[复制链接]
发表于 2018-12-20 01:22:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
SEPTEMBER 13, 2014 6 COMMENTS/ V$ S  E3 z# m: h1 b
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.( X& j3 \* I9 k' [6 t
Installing Mininet on CentOS7. o$ `: q% |8 Q  a/ Q  h: S
– I needed VM with 2GB memory to get OS installed.5 `  Y  O% y+ m/ |4 M& X6 G
– I used CentOS-7.0-1406-x86_64-livecd.iso to install the VM. I’m not going to outline steps for installing CentOS.* @$ R- l1 F  ~( t: b
– I created a local user called mininet and gave it sudo access and ran the remainder as that user." j" k4 _; \% \; ~
– Install SSHD
6 @% U, u3 d4 J% I! L9 L: _sudo yum -y install openssh-server1 W# x( l! {/ Z  W; e/ d
sudo chkconfig sshd on
3 i9 ?' L: P# V; _! nsudo service sshd start
3 V% T6 ~, _8 j; E) q8 x- G  D5 O– Disable SELinux to get OVSDB to stasrt
# O2 t- H2 ]! R: _sudo setenforce Permissive( Q7 I. y; w5 ~5 a  y( w: t$ l/ o' O* G
– Modify sudoers secure_path to add /usr/local/bin so the ‘controller’ which be found.
8 X/ `7 |8 t  j' uDefaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin* k- G* U. t' B9 g1 \" P
– Install GIT# k* I5 U5 Y0 B% [$ y
sudo yum -y install git
  s' M8 \4 G9 n0 r– Get Mininet.+ @$ A4 v" _! |
git clone git://github.com/mininet/mininet.git' E% Z' L" \" Q; M3 q5 v& J; v
– Update installer mininet/util/install.sh.) n& e( {) j; F' B7 O0 Y
***ADD the following before the line ‘test -e /etc/fedora-release && DIST=”Fedora”‘. Somewhere around line 47.  May differ.% e! \2 J; J/ {: E; Q* [0 |
test -e /etc/centos-release && DIST="CentOS"
% e0 Q% X% H4 X8 [7 n; I  P' Aif [ "$DIST" = "CentOS" ]; then) H2 F" @# B, l! s" ]( @' E
    install='sudo yum -y install': X& d" {9 D' l0 j. _2 a7 Z
    remove='sudo yum -y erase'+ H5 N9 W% a+ G# H& k$ A
    pkginst='sudo rpm -ivh'  V& n3 b" D6 k
    # Prereqs for this script
: ]3 d; s" L5 G) C5 R7 J    if ! which lsb_release &> /dev/null; then3 M. p! x1 ~2 L9 T; T
        $install redhat-lsb-core
" Q  ?8 @7 A! C    fi. M  p7 A. |2 H( Q, c% M
fi# e8 e! {# z1 k  T8 x2 r# x
***EDIT
0 P6 s& X; F3 ~  G0 eif ! echo $DIST | egrep 'Ubuntu|Debian|Fedora|CentOS'; then1 M  I# ~1 r: c6 {5 g
    echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
0 g  v- S, S$ _2 U+ v' n0 p    exit 14 L( h' }0 ~* c2 m- e
fi7 t6 G; t: ?2 a
– Install Mininet and OpenFlow reference.  Not OVS.
6 m  [" c$ c$ D9 t; L8 H  v$ }: Y4 Lmininet/util/install.sh -nf! G+ U+ V  b4 k# X* Z% @/ @' y
– Build and Install OVS
' i5 l( Y; \* ^% _sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \
& d3 [$ m$ }4 Y% akernel-debug-devel autoconf automake rpm-build redhat-rpm-config \9 n" [. s* t" q; J
libtool wget8 O/ g/ [2 e% [
4 Z/ c; b5 N2 h( F
mkdir -p /home/mininet/rpmbuild/SOURCES/- p) z9 g2 _4 N% P; K
cd /home/mininet/rpmbuild/SOURCES/( H+ Y0 H; l( b
wget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz
9 F! t. W$ N8 {. B7 C0 _8 ztar zxvf openvswitch-2.3.0.tar.gz
( d( A: S+ S2 x6 }8 Zcd openvswitch-2.3.0$ v. r3 O; j( m4 e. Q
rpmbuild -bb --without check rhel/openvswitch.spec
. K2 T; Z0 Y' p2 F* ]sudo rpm -ivh --nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm
$ c! N' U4 H0 k9 p– Start OVS) i  n4 u9 F* g+ l
sudo /etc/init.d/openvswitch start
0 _- n% u9 S4 g– Check working
% h! z9 x8 n9 I% C[mininet@localhost ~]$ sudo ovs-vsctl show
# s4 T' F! Z0 h" ]! J; z7 @76ed3664-6b6b-4325-85c1-c9a2bf735e30
5 i3 u' C& {1 i    ovs_version: "2.3.0"# N# V: o- a. n( n# x% ?4 Z
– Test out Mininet! p$ B3 P; `+ L+ q( m
[mininet@localhost ~]$ sudo mn --test pingall
* I2 P9 G. |' v) j8 U/ n0 J*** Creating network
2 ?/ [- z: ]0 J1 g& R9 ?  p0 l*** Adding controller% _4 P2 V) a" s6 y4 ~# A
*** Adding hosts:
9 l4 R6 L3 `8 U. Y" Hh1 h2
& H; V, P4 Q5 b*** Adding switches:
  ?* a/ t1 H# V1 {9 fs1
# }' ]! X$ `8 D# b6 I% \$ u$ {9 U*** Adding links:
3 j0 e1 p" V" b7 p  t(h1, s1) (h2, s1)# a3 K) Z$ J* @' ]
*** Configuring hosts
5 h% y" S; r9 L" g: Y$ a& Bh1 h2$ u! h! R! m3 D7 \$ {% d
*** Starting controller) ]/ L% t( h: S
*** Starting 1 switches
- A' x: x9 R2 a! ms1/ N* o  H! `/ w( o" R9 V( w' c
*** Waiting for switches to connect
. \& Z7 e& O/ F+ }7 ps1- O4 `/ e+ e# o/ N
*** Ping: testing ping reachability8 p; c& y. G, ~: }9 E1 \2 c
h1 -> h2. }0 V2 s8 F1 Y3 ^3 y* }, J7 R
h2 -> h1
" q$ A+ n# h. x*** Results: 0% dropped (2/2 received)9 y3 P) G; X( z/ l# k; _: b. B
*** Stopping 1 controllers% m! ^6 a+ q# w# E
c0* c" s& E, |, L6 v. M  G
*** Stopping 1 switches9 o! O2 S% n4 J( s
s1 ..
7 t3 w' l6 h6 e7 m' v& m: E- k$ w3 `*** Stopping 2 hosts
) W' p3 {+ E! J4 z# p" {h1 h27 F$ L" N6 n" P/ D9 h2 m1 [
*** Done
9 B  B5 X$ |5 M4 l; d0 @completed in 5.397 seconds$ G6 c% W/ k+ W. u  A
So it seems to work.  But there are a few things to note.7 ^/ U7 I( C: }2 s" C
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.
, z$ l6 X& Q, w8 \. g: I0 N2 r2. The above is the extent of the testing I did.  There may be other issues that crop up./ R, w- l$ n% r" w
Hope this helps anyone that uses CentOS or RHEL 7 with Mininet.) r6 @& E% ]! y
; O5 A5 h  l7 g, j
This post ‘Mininet and OVS on CentOS 7’ first appeared on https://techandtrains.com/.
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-9 01:11 , Processed in 0.049395 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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