找回密码
 注册
查看: 4586|回复: 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.
( I5 @" v8 v$ |1 \( a0 M5 J
) k' g. K6 {9 t3 v" hBelow 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).9 A2 B  s! X  u- _0 C/ L

9 O& P% n5 A8 u3 P" JInstall the requisite packages.% U% _+ [; l) y; g+ G% N; w
#yum -y install make gcc openssl-devel autoconf automake rpm-build redhat-rpm-config python-devel openssl-devel kernel-devel kernel-debug-devel libtool wget5 y4 E) i& \: g' H
Necessary steps for building RPM2 ]0 t. d; n' s: s( Y, _' g
#mkdir -p ~/rpmbuild/SOURCES. L3 j' s( s; r
#wget http://openvswitch.org/releases/openvswitch-2.5.1.tar.gz9 Q' e6 X) o% ^8 F( q: {, S
#cp openvswitch-2.5.1.tar.gz ~/rpmbuild/SOURCES/+ C' G. R" q% W5 R
#tar xfz openvswitch-2.5.1.tar.gz" O& M/ J* P# x% B5 O* V/ s/ T9 p
#sed 's/openvswitch-kmod, //g' openvswitch-2.5.1/rhel/openvswitch.spec > openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec
& c4 U6 P* {6 k8 x7 E' R' fBuild the RPM& J# h$ ]6 M" g7 B! k% d7 H) B
#rpmbuild -bb --nocheck ~/openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec5 ^6 A; E; B4 m3 X
Install the RPM
9 b9 j2 `3 y8 v#ls -l ~/rpmbuild/RPMS/x86_64/7 _4 T+ G8 ?' k/ k
#yum localinstall ~/rpmbuild/RPMS/x86_64/openvswitch-2.5.1-1.x86_64.rpm( H& a9 ~# b/ w+ L& z; d3 `4 o
Start the OVS service and enable it for the next boot
  S- k8 m0 k; \0 a#systemctl start openvswitch.service, k7 i0 q4 L1 |1 R
#chkconfig openvswitch on
! m* t- c  I  q1 X! ?5 VThis 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.
* H; B+ i/ _( M* H# C: E
' M' @* X5 E6 Z$ ?3 K* @Test the OVS Version
8 a/ U1 _9 p3 F  A1 |#ovs-vsctl -V. r: E; Z& W- j3 ~
( j. r  Q" n7 Y
Useful OVS commands9 Q# e# _0 T# A3 g& a6 Z4 ]
#ovs-vsctl show
6 b4 y" E8 m4 z: G5 o#ovs-ofctl show br0
$ X3 ]% ?" ^; K; u" k. @9 R
# W" ^+ S5 j- M3 |7 W0 F" V5 E9 Y4 WCreate a new OVS Bridge, add physical ports, connect OVS with ODL controller
- |' ~/ S7 L+ v& ]' C- j$ J#ovs-vsctl add-br ovsbr0
2 r% a5 }5 o1 X8 G, `#ovs-vsctl set bridge ovsbr0 protocols=OpenFlow13
; S4 ]4 A7 A9 P# T& C#ovs-vsctl list controller
- e6 W- d* \4 u' m! W; s#ovs-vsctl add-port ovsbr0 eth4
9 S4 @8 {( O, b, S#ovs-vsctl add-port ovsbr0 eth8
' ^: t. Q& k0 Q) p#ovs-vsctl set-controller ovsbr0 tcp:192.168.15.57:6633
7 `6 E7 x9 K" w" a0 ?#ovs-vsctl show

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-12-20 01:32:53 | 显示全部楼层
Install some packages0 s, _4 y, h) d6 h4 \6 ?
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
- C3 @- `3 R4 BYou can add a user that can see the file and directory clearly, up to you.: Q! ~8 D( k6 R+ n4 N9 A/ k3 c. `
adduser ovs3 j8 F! h; r  C' u& k
su - ovs
; `' G2 Q5 X% _: n: V6 ~Get the file and decompress it' ^- Y4 R% Z. Y8 h! {$ x
mkdir -p ~/rpmbuild/SOURCES
% j7 k7 e6 k" w, rwget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz
" B7 H8 o! ]& u( j" o: {cp openvswitch-2.3.1.tar.gz ~/rpmbuild/SOURCES/9 M# t( h& M! a
tar xfz openvswitch-2.3.1.tar.gz3 C2 ^- ]/ C& M. Q. p
Modify the file
- |+ y  i. p3 Z8 Used 's/openvswitch-kmod, //g' openvswitch-2.3.1/rhel/openvswitch.spec > openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec, G4 d' x) p2 `* L
Generate the rpm file) B% \+ e  ~! o
rpmbuild -bb --nocheck ~/openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec
) @, M) f+ M! E9 i& l- ?exit  W/ I: z; j( ~* o# p! M2 N
Install the rpm package
% e4 {7 t" Y5 @! z3 g: }yum localinstall /home/ovs/rpmbuild/RPMS/x86_64/openvswitch-2.3.1-1.x86_64.rpm
  t+ d  H% ~$ k' T- [& p# y% n& }Check that the command-line tools are ready
# d0 ]( m/ K" \5 R8 J: k, covs-vsctl -V" L$ S, D2 J; n: W
NOW, 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.0 }/ h$ y& s6 n% m9 }3 e& l6 n
yum install policycoreutils-python. S3 {: B/ h9 V4 e
mkdir /etc/openvswitch- m' j* r& S9 T2 j! _1 {, Z
semanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?": u0 t. T/ w* u
restorecon -Rv /etc/openvswitch
( r# Z, s( J4 E, C2 MStart OpenvSwitch
- P7 Q0 ?' H( l1 x# X+ t/etc/init.d/openvswitch start
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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