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

Mininet and Open vSwitch on CentOS 7

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2018-12-20 01:22:57 | 显示全部楼层 |阅读模式
SEPTEMBER 13, 2014 6 COMMENTS
- G) P  ]. _9 ?, G4 ^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.% k% p, n4 {2 W
Installing Mininet on CentOS7- a' ^( ]) M+ T
– I needed VM with 2GB memory to get OS installed.8 K* `( h3 u/ V9 s7 {
– I used CentOS-7.0-1406-x86_64-livecd.iso to install the VM. I’m not going to outline steps for installing CentOS.
2 R2 \6 r5 N6 ]& ^6 W; d7 T1 @– I created a local user called mininet and gave it sudo access and ran the remainder as that user.
" b) h2 q- [4 r6 C) ]- _% z' P3 s– Install SSHD" Y  ]! q, o9 e5 `6 n$ P- X
sudo yum -y install openssh-server7 Z+ c: r$ H/ N6 x; s$ F
sudo chkconfig sshd on
+ Z3 u/ j- n! Q  G2 ]) Psudo service sshd start/ ~7 v" j) S% p5 I4 a9 J- O: s
– Disable SELinux to get OVSDB to stasrt" Z1 m  h4 I1 f- |" G! {7 U
sudo setenforce Permissive$ e; Q% |( `- [5 Q% w: m
– Modify sudoers secure_path to add /usr/local/bin so the ‘controller’ which be found.' y3 ~- k7 s# U5 c! h5 B, n
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
; K0 \. I8 k4 p: k3 O( O– Install GIT
7 h! _4 E+ U' D! o' B* qsudo yum -y install git6 y8 X3 ~* h1 L0 x- i
– Get Mininet./ Z; z5 ]1 P+ n7 J0 k7 R0 M
git clone git://github.com/mininet/mininet.git7 T3 I. Z4 B* [0 G8 Q
– Update installer mininet/util/install.sh.
1 s6 l6 h* R$ `" D' l% ]: h5 W***ADD the following before the line ‘test -e /etc/fedora-release && DIST=”Fedora”‘. Somewhere around line 47.  May differ.
3 \0 \$ j  \- x( Q% [1 }' ^test -e /etc/centos-release && DIST="CentOS"
# O* c. W' j" v# E+ Sif [ "$DIST" = "CentOS" ]; then1 N3 X' c3 Z+ `7 P$ r/ f7 I8 v8 Z
    install='sudo yum -y install'5 L2 T& V# R4 l2 x7 ^  Y2 H
    remove='sudo yum -y erase'' _' z2 S0 O0 r5 s1 v* {( q
    pkginst='sudo rpm -ivh'1 ~1 Z: f$ H& H+ P
    # Prereqs for this script3 V$ X% m# G2 z
    if ! which lsb_release &> /dev/null; then
! G* c3 y- z/ v        $install redhat-lsb-core
- e; r/ |/ b: y/ A, Z    fi
6 j7 T1 H8 t8 m- Kfi
6 H+ M9 t+ _6 O/ f) A( T. K% }  |***EDIT* |6 ^, Z5 N  g: y, I
if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora|CentOS'; then' H6 \" s7 P, `, J( c
    echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
! C+ p8 k/ G$ U2 T& D% E    exit 1+ E. q  j9 C$ `) m9 i1 \# E
fi
+ A4 P4 ?  r+ d) d% Q" l– Install Mininet and OpenFlow reference.  Not OVS.
1 H- t" a" z& u# xmininet/util/install.sh -nf3 o$ _% p5 F+ e$ B' U4 D5 {7 f* f
– Build and Install OVS" T8 v( t; Y# D9 t& p
sudo yum -y install gcc make python-devel openssl-devel kernel-devel graphviz \! N' l! V* ?# v9 U5 E% N. R% L
kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \+ q9 n" N; e* E' e( p) @" n6 C( ?7 x
libtool wget
; R( A( W0 Z: z
. U& \5 h6 ]& M# Bmkdir -p /home/mininet/rpmbuild/SOURCES/2 K- Z5 X- n& s* P, h' k
cd /home/mininet/rpmbuild/SOURCES/
6 S9 [7 o7 Z: O# H9 bwget http://openvswitch.org/releases/openvswitch-2.3.0.tar.gz% S# J  L; q5 W- D/ X
tar zxvf openvswitch-2.3.0.tar.gz
, A4 v# `4 P2 l" N1 S. m, `  i9 Kcd openvswitch-2.3.0
5 \1 \8 P" x. ~$ g5 Zrpmbuild -bb --without check rhel/openvswitch.spec
. b- v0 R$ K+ lsudo rpm -ivh --nodeps /home/mininet/rpmbuild/RPMS/x86_64/openvswitch*.rpm
, G7 N  x* _, {) i4 }! z( h5 c– Start OVS1 U0 `, c8 h9 ]4 |; V
sudo /etc/init.d/openvswitch start: j" t# x/ H: W6 b
– Check working
: k! Y7 K9 O* }9 ]* L! [[mininet@localhost ~]$ sudo ovs-vsctl show+ _; K7 R* S9 L5 u6 X$ R
76ed3664-6b6b-4325-85c1-c9a2bf735e30) [8 t9 q# H% |0 C
    ovs_version: "2.3.0", x  r; t( c& L7 o
– Test out Mininet$ O+ n# J% [; Z$ L
[mininet@localhost ~]$ sudo mn --test pingall$ k! V% y: t6 g9 H7 \5 i; }3 r9 P
*** Creating network0 [# ?& F+ F/ y+ V
*** Adding controller/ T; x  ~" Y+ A' h/ q% A! w' |
*** Adding hosts:
. J7 H5 t* ~5 q- z& n$ Fh1 h2
# X1 M3 L, i& P*** Adding switches:4 a6 }$ @; K$ X! K+ M6 s' a7 T
s1
9 s$ s' A# [* U% C% j* B' R*** Adding links:
/ w3 s1 @) H2 K7 p(h1, s1) (h2, s1)
3 c0 e. ?, w' g: \* t0 J*** Configuring hosts
" r) ^1 `  j3 J7 I  x" D* vh1 h2) Y9 W/ Q4 `* X4 q3 @
*** Starting controller% E# y! E* e, l
*** Starting 1 switches: ^! l9 F+ D2 b3 T. d1 B/ X
s1
  p/ n8 _, u4 I0 \( a! Z$ T*** Waiting for switches to connect
3 o) ]0 f3 N. v1 r' U: L% hs1* m- q* @+ W; R& G) o+ \$ _# C+ G7 t
*** Ping: testing ping reachability
; A- P$ F5 B6 A3 I5 F6 G1 Xh1 -> h2
( M4 H5 v. S% U7 ch2 -> h1" j# P- C4 |* ?# S" s
*** Results: 0% dropped (2/2 received)7 a, t( |- r) D9 w0 g
*** Stopping 1 controllers7 U  m0 K9 D7 R- b6 p
c0* f% j: J( y5 b+ N6 {' b' U0 ~
*** Stopping 1 switches
8 l0 E9 ^) |' v* rs1 ..
: Z8 @7 q$ i4 M# j6 `# h6 X8 K*** Stopping 2 hosts, b# ^' A" f6 |5 U/ @( Q4 b
h1 h2* W; c" y0 c4 A$ N1 C/ _3 O
*** Done; J0 y2 Y4 L  `1 t, h7 m) O( D
completed in 5.397 seconds
/ S/ q8 s* B: QSo it seems to work.  But there are a few things to note.
4 P, y6 f1 @! U7 _8 g1. 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.
8 v+ x* x8 [8 _) Z6 n2. The above is the extent of the testing I did.  There may be other issues that crop up.
$ X2 ]+ @3 j' W7 SHope this helps anyone that uses CentOS or RHEL 7 with Mininet.% U0 S" h3 M" j/ \+ J, s- V
  T. s# l8 @6 v  M
This post ‘Mininet and OVS on CentOS 7’ first appeared on https://techandtrains.com/.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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