易陆发现互联网技术论坛

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

Mininet and Open vSwitch on CentOS 7

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

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

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

x
SEPTEMBER 13, 2014 6 COMMENTS
- a4 C5 [. A0 \/ M; D$ dThe 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 U- n+ V+ |' MInstalling Mininet on CentOS7+ t$ b: L; U$ ^
– I needed VM with 2GB memory to get OS installed., G# G/ N, o. f& a) e7 r7 c* L/ [
– I used CentOS-7.0-1406-x86_64-livecd.iso to install the VM. I’m not going to outline steps for installing CentOS.! A0 ^9 |7 Q9 |! O  |
– I created a local user called mininet and gave it sudo access and ran the remainder as that user.
4 Y! L/ b' e& ~. @2 a7 Y% ~/ ~6 [0 k– Install SSHD8 @6 l2 h9 g' T$ }5 N/ a: \
sudo yum -y install openssh-server
# `. |& P7 o% A5 ]sudo chkconfig sshd on
* b! Q1 r% a/ D9 {: ?sudo service sshd start$ A* p7 T3 f; R  a4 f& I
– Disable SELinux to get OVSDB to stasrt; j9 d8 D' T3 f& G5 a" f# P8 u
sudo setenforce Permissive# R( y/ M, ]& z. G5 p; l
– Modify sudoers secure_path to add /usr/local/bin so the ‘controller’ which be found.# ^0 ^6 r3 _* {& }7 o) p
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
6 q, c2 ~+ {: l  G5 P$ _– Install GIT
1 z5 y" b5 l3 y( s3 r; g  B2 k! Xsudo yum -y install git) U+ F/ R1 S  o+ k, D% J0 a
– Get Mininet.
( Y3 h: g! _! j4 t" |4 p8 Mgit clone git://github.com/mininet/mininet.git, b: a- _4 j6 i, B3 k2 ?$ t
– Update installer mininet/util/install.sh.7 M* P$ N' e& M7 D6 |/ W& P) V0 B
***ADD the following before the line ‘test -e /etc/fedora-release && DIST=”Fedora”‘. Somewhere around line 47.  May differ.5 l4 O8 `. P* R- \# O; H2 @
test -e /etc/centos-release && DIST="CentOS"
' K$ \2 K1 C5 j3 K2 oif [ "$DIST" = "CentOS" ]; then
9 v$ e" q) D- q/ I8 X/ ^( Y1 ^# _    install='sudo yum -y install'1 ?. i8 W' q+ ~
    remove='sudo yum -y erase'% f% j, \% q* y& r+ t
    pkginst='sudo rpm -ivh'
1 H4 R; {; C0 G. a    # Prereqs for this script* F- e# U7 D) Q
    if ! which lsb_release &> /dev/null; then
9 ?- t# G7 o1 `        $install redhat-lsb-core2 G4 C7 U( f. {
    fi  p9 _7 ]$ |, S. i5 n: \9 y! z- q1 P
fi/ }3 _6 M8 c5 @* g
***EDIT/ J6 K* B. @4 V. _, y2 `
if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora|CentOS'; then
/ x: o4 Q7 u1 v; ^6 S    echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
: p9 l$ Q1 P/ s; [( ~$ c* S    exit 10 P/ f) U; J/ v7 ^# C$ c; a! p9 k
fi
8 l6 R7 f7 z4 `: t) N7 ?– Install Mininet and OpenFlow reference.  Not OVS.9 L* O" X& u" d: x& U2 P* `
mininet/util/install.sh -nf
9 h  Q( I6 g1 G" [# ?( ?7 A( }% i" F– Build and Install OVS* C% W& `+ b# U5 P. t  @6 w
sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \9 |+ ^! X: h( Z( A% j
kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
+ f1 ]2 y0 F) E7 j; B; Zlibtool wget0 a: e' z9 P1 M, m4 V2 {5 C
$ C/ \4 @8 e4 l5 b7 Y
mkdir -p /home/mininet/rpmbuild/SOURCES/( c% }4 m: p, }) p+ w/ |- y# k% C3 n. z+ C
cd /home/mininet/rpmbuild/SOURCES/) d: b0 j; c: C( j5 I  `' z9 ]
wget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz
1 G: i' Q+ m: H; ?' a3 A/ K' Jtar zxvf openvswitch-2.3.0.tar.gz3 @& t% {1 {3 P9 A! w2 b3 u
cd openvswitch-2.3.01 O6 D9 T* T4 u4 q' g
rpmbuild -bb --without check rhel/openvswitch.spec
! H; L- D1 Y- @& Zsudo rpm -ivh --nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm
  A2 Q; F# {0 a* w' Q– Start OVS! c0 P7 C( R5 c$ A( N# q
sudo /etc/init.d/openvswitch start; p/ _, v: {( e& A# l  y! z
– Check working( Z1 A- v4 W2 `0 e7 S
[mininet@localhost ~]$ sudo ovs-vsctl show+ |( b3 Q1 `: K. i6 v
76ed3664-6b6b-4325-85c1-c9a2bf735e30
5 i! t2 |. i3 b3 Z( S% m2 h1 E    ovs_version: "2.3.0"6 F" y5 Q2 Y4 R# D
– Test out Mininet3 W: }- j+ _1 O3 L# v! B
[mininet@localhost ~]$ sudo mn --test pingall
! w7 o( i1 l- V- y+ d1 g) b*** Creating network
! B5 M/ c( D( I5 P( ^$ x4 Z*** Adding controller
+ m, [- {4 `! X* Y. V*** Adding hosts:3 e9 J* i$ {, H7 L; y5 W
h1 h2
6 t5 G& k% b' S" S*** Adding switches:$ d: L: p. M  g6 I1 \
s13 i6 Q6 x3 E6 M5 R! v' d( c8 }
*** Adding links:
( s, k! b5 \0 E. S1 m(h1, s1) (h2, s1)
* m' L+ M2 E7 W+ G*** Configuring hosts4 G+ ?6 d! ~, Z. [5 N
h1 h2# v2 j( d( p# \6 L' y
*** Starting controller
8 ?$ M4 u/ a4 z*** Starting 1 switches: g' `5 k2 N4 V* g! R! H
s1
0 ]& k! R3 |0 k2 y: G- a8 K*** Waiting for switches to connect* a( U5 q) M) {+ \8 ?9 }' s
s1, v# {" N& b; g) d
*** Ping: testing ping reachability
. G0 F) d# |) p% Fh1 -> h23 d$ M& E* d$ ^) Z, ]9 m
h2 -> h15 l/ c8 X7 u6 d3 N8 U( F8 B) t- w
*** Results: 0% dropped (2/2 received)
% o/ F, `/ B6 l; k( b9 `7 r*** Stopping 1 controllers# i. L8 F- G* X4 v/ j4 W( o
c02 e7 k* l- ?5 p; y" \  s& p' m
*** Stopping 1 switches
& G& d5 Z3 S" K- W( Fs1 ..
6 k, x+ J( _0 S$ f*** Stopping 2 hosts
, \* m9 Y: L3 V9 F7 j8 _h1 h2$ ~( v: J3 q5 Z) y
*** Done
. I2 o4 M, I6 H9 y0 Acompleted in 5.397 seconds
. F- s$ r* ]% q+ b  [2 q7 y  mSo it seems to work.  But there are a few things to note.3 u4 n5 s- A% q! n, v
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.) q5 z) p/ A+ t- q( ]# ]
2. The above is the extent of the testing I did.  There may be other issues that crop up.
% c; L5 V6 @- I3 V5 t+ d/ yHope this helps anyone that uses CentOS or RHEL 7 with Mininet.
. S  m, j3 r) b* @: e- U- ]
, i! q4 Q* B  I& o; |/ Y; fThis post ‘Mininet and OVS on CentOS 7’ first appeared on https://techandtrains.com/.
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 点击这里给我发消息

GMT+8, 2026-4-8 12:09 , Processed in 0.045942 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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