找回密码
 注册
查看: 4588|回复: 1

Open vSwitch installation on CentOS 7.2

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2018-12-20 01:25:47 | 显示全部楼层 |阅读模式
Open vSwitch (OVS) is a production quality, multilayer virtual switch software available for various platforms. The server platforms include x86 based latest Linux distributions e.g. Debian 16 LTS or CentOS 7.2. Popular SDN switch operating system development company Pica8 also bundles the OVS in a custom Ubuntu version for Pronto, Dell, and many other switches.3 A  i0 b+ B3 G& ^, S
2 o* _# }9 e8 O+ y$ P; @
Below is an effort to provide easy installation instructions for OVS on CentOS 7.2 and also to integrate OVS with the OpenDaylight. Note this blog is updated to use OVS version 2.5.1 (bug fix release for OVS 2.5.0).: i+ y6 {. m4 ]' m) q
# w0 [6 p, e* l/ l
Install the requisite packages.) z( k# W3 b: j, T  ^0 D( C; m
#yum -y install make gcc openssl-devel autoconf automake rpm-build redhat-rpm-config python-devel openssl-devel kernel-devel kernel-debug-devel libtool wget/ I* Q: J5 ^# P  M' n! ~& p- x
Necessary steps for building RPM
: _5 I# `3 R' t% z. t3 c#mkdir -p ~/rpmbuild/SOURCES9 x) W: o9 H4 h9 `: _, p
#wget http://openvswitch.org/releases/openvswitch-2.5.1.tar.gz( y1 ?- u; H8 D% ^9 b9 G1 ^; D% P
#cp openvswitch-2.5.1.tar.gz ~/rpmbuild/SOURCES// f$ Z4 t' k/ D0 `- C
#tar xfz openvswitch-2.5.1.tar.gz# S5 S" j0 T7 }- x
#sed 's/openvswitch-kmod, //g' openvswitch-2.5.1/rhel/openvswitch.spec > openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec3 U6 B/ i" l7 X& H  ~
Build the RPM
$ z. L( }8 @6 W- c#rpmbuild -bb --nocheck ~/openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec
" w1 t# @, o% a  W) qInstall the RPM
1 F! r; k( `  ^6 ?#ls -l ~/rpmbuild/RPMS/x86_64/5 v$ J( f0 U. C. B. P+ g
#yum localinstall ~/rpmbuild/RPMS/x86_64/openvswitch-2.5.1-1.x86_64.rpm
; A" p/ B8 X- L2 ~3 ~1 q; DStart the OVS service and enable it for the next boot5 W7 j) {; p9 F8 X. S, k
#systemctl start openvswitch.service
: x! k' A" g7 d, Y( B6 B9 O#chkconfig openvswitch on; m4 b' K" [2 q8 |1 E
This process will install the OVS on the server and start the process. Firewall should be open to accept the incoming TCP connection at port 6633.- T0 k$ B/ M4 B: V/ f% e5 p" m7 [
! r- }! K7 C. y4 Q
Test the OVS Version
# s2 v! M) h1 N) X* ~#ovs-vsctl -V# w/ J7 K8 J/ z* b, k: @& l

- h3 A# z5 V# W! V" b. mUseful OVS commands
( b. y( Z6 Q/ r. W- |+ I6 x& K2 w0 i#ovs-vsctl show
! }8 m' q/ p" k#ovs-ofctl show br09 ]+ W6 _" s0 @

) R5 h+ ]. \# l* B4 GCreate a new OVS Bridge, add physical ports, connect OVS with ODL controller" P& F/ }3 d9 U) D& N8 L
#ovs-vsctl add-br ovsbr0
8 p: n2 D8 x4 j! Y/ q#ovs-vsctl set bridge ovsbr0 protocols=OpenFlow13
1 U: S6 T. S/ j" K' `#ovs-vsctl list controller: ~" C" D7 [4 C8 h& y+ d
#ovs-vsctl add-port ovsbr0 eth4
. l4 m4 O& Y) q0 f4 o#ovs-vsctl add-port ovsbr0 eth8$ ]6 x+ Q2 x$ `
#ovs-vsctl set-controller ovsbr0 tcp:192.168.15.57:66336 t( y$ I5 ~9 u, M% u! p
#ovs-vsctl show

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-12-20 01:32:53 | 显示全部楼层
Install some packages3 ?8 X; J) E' A* J
yum -y install wget openssl-devel gcc make python-devel openssl-devel kernel-devel kernel-debug-devel autoconf automake rpm-build redhat-rpm-config libtool
- D( @! A- n/ I2 y5 K, c% yYou can add a user that can see the file and directory clearly, up to you.
) O% d$ ^, a) `  k0 _- Z6 Vadduser ovs' V( j8 ~, e& B
su - ovs! W+ \  p) F0 n+ O; \- `* M$ v: d# K
Get the file and decompress it5 l) Z! _- c. w
mkdir -p ~/rpmbuild/SOURCES, G3 J5 F" J) b' F) O2 u
wget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz
, S5 [6 ^! V% _2 x. mcp openvswitch-2.3.1.tar.gz ~/rpmbuild/SOURCES/& ]3 ]/ D5 h, e% Q# l
tar xfz openvswitch-2.3.1.tar.gz
# }- K8 P. |2 b; t# L1 xModify the file" k8 B1 _9 I7 c6 H" e4 v- j- m" z
sed 's/openvswitch-kmod, //g' openvswitch-2.3.1/rhel/openvswitch.spec > openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec
) M6 O0 P" n& U* J/ s8 ~# a+ VGenerate the rpm file
; i+ e- N3 }# o, Y+ ^1 jrpmbuild -bb --nocheck ~/openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec
3 L2 r8 S7 V% t9 B" z) Q9 eexit
% p$ h. v9 t) G5 |Install the rpm package4 R1 ?1 P) G2 d# @; y, e
yum localinstall /home/ovs/rpmbuild/RPMS/x86_64/openvswitch-2.3.1-1.x86_64.rpm# S# t1 D; L) c4 l
Check that the command-line tools are ready4 K9 H2 I* e4 ]9 ~( u) ]- _
ovs-vsctl -V
' C6 C8 F; r. M( U% W( u$ uNOW, if you're using SELinux in enfocing mode and try to start the service, you'll find some errors. Please follow the steps to solve it.
. v% c  h! o2 Y; N, W  @6 V* Gyum install policycoreutils-python
" K4 @$ L7 `1 `mkdir /etc/openvswitch
! p; B, g/ |3 A4 I4 _0 z4 S" Isemanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?"1 h1 I/ V* q# z9 F
restorecon -Rv /etc/openvswitch
% \3 d8 M' M- M; K$ zStart OpenvSwitch
$ s6 V% e/ [! T/etc/init.d/openvswitch start
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 01:01 , Processed in 0.013650 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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