易陆发现互联网技术论坛

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

Open vSwitch installation on CentOS 7.2

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

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

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

x
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.; T( ?: y- ~* i

) o6 O2 c) s  H5 uBelow 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).2 `& |9 t& f& {$ J
% Z! X. ^, D2 E  U+ E
Install the requisite packages.
7 [& B: N' X$ E$ ?+ d2 p#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; ~/ s6 g: j$ A  u/ Z$ ^6 |
Necessary steps for building RPM
3 {6 O" t% t7 R, w* M#mkdir -p ~/rpmbuild/SOURCES& D% [7 l$ P4 a- p+ q
#wget http://openvswitch.org/releases/openvswitch-2.5.1.tar.gz" N; ^5 K4 G  E& [3 R! v3 w
#cp openvswitch-2.5.1.tar.gz ~/rpmbuild/SOURCES/; h. r& X5 l& b
#tar xfz openvswitch-2.5.1.tar.gz; y: b6 A+ ]6 m% u+ v( z0 _' S
#sed 's/openvswitch-kmod, //g' openvswitch-2.5.1/rhel/openvswitch.spec > openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec% m! f. U, f7 ?) d$ O
Build the RPM
# d' c. z& L1 H8 C4 S$ R* ^#rpmbuild -bb --nocheck ~/openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec
4 k2 |% X' ]: K) O9 _Install the RPM
: L" ?6 J* ~  i' K8 d5 _#ls -l ~/rpmbuild/RPMS/x86_64/
0 `- ?! u6 M! j% F- p#yum localinstall ~/rpmbuild/RPMS/x86_64/openvswitch-2.5.1-1.x86_64.rpm
. z5 C* F8 f  q5 B- Z, OStart the OVS service and enable it for the next boot) R3 m  X, {( E6 R5 l2 ]; T
#systemctl start openvswitch.service
" g+ X, w' L8 _) F& Z#chkconfig openvswitch on! h* _  x2 I( S9 x) [9 e, Z* ?6 P
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.2 s+ H0 ?) U/ n; V1 x+ k( c

% g. i6 T& }, CTest the OVS Version. k8 X) }3 H- k& `) I
#ovs-vsctl -V+ p) |5 z0 b& ?( l$ X' ~( F
: ~; m, D7 A- A- e1 L# A
Useful OVS commands
3 l! j3 V5 D8 ?- n# t#ovs-vsctl show- g$ L2 j8 S( J1 n4 E4 Y+ z
#ovs-ofctl show br0
' s! H: R2 [- L$ y6 r8 }: B% j$ R& G9 o& _# g- Q2 @, _
Create a new OVS Bridge, add physical ports, connect OVS with ODL controller* g" x6 T& x/ x8 p4 ~9 [
#ovs-vsctl add-br ovsbr0; ~3 s" L, n( j* o
#ovs-vsctl set bridge ovsbr0 protocols=OpenFlow13  h. B, l, T% Q( t
#ovs-vsctl list controller2 n/ ~# c/ }5 E5 _' v) E8 x
#ovs-vsctl add-port ovsbr0 eth47 F( {2 s8 M# D7 k
#ovs-vsctl add-port ovsbr0 eth8
$ r  f8 k3 D9 {: f. \6 s3 P1 j/ n! R#ovs-vsctl set-controller ovsbr0 tcp:192.168.15.57:6633
- {$ x3 {7 \8 g. _# \#ovs-vsctl show
 楼主| 发表于 2018-12-20 01:32:53 | 显示全部楼层
Install some packages
2 k6 O- x; Q' k. a5 jyum -y install wget openssl-devel gcc make python-devel openssl-devel kernel-devel kernel-debug-devel autoconf automake rpm-build redhat-rpm-config libtool0 ]' P. p: r  d2 ?1 q
You can add a user that can see the file and directory clearly, up to you.5 z- t) [7 [: ~6 P( J5 F
adduser ovs  h, G  W1 `. Q! I; n0 V/ E) ~
su - ovs
0 Y6 ~9 Y  |/ B; ]" e/ pGet the file and decompress it
, L1 ^) N+ z% O6 A( V7 [mkdir -p ~/rpmbuild/SOURCES
$ T) ?4 z, d5 M6 zwget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz% r& t+ s" p% N! e" K* K# I
cp openvswitch-2.3.1.tar.gz ~/rpmbuild/SOURCES/
1 P$ v* ]8 X/ z9 P8 rtar xfz openvswitch-2.3.1.tar.gz. I& a/ t; U5 K! i. \" ^# M' P3 Z" s
Modify the file) j+ s# s: R' T9 P( F" D* r
sed 's/openvswitch-kmod, //g' openvswitch-2.3.1/rhel/openvswitch.spec > openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec
: G0 N+ Z8 ^3 j; UGenerate the rpm file
/ g. p4 [. s6 _9 I0 z, O- Wrpmbuild -bb --nocheck ~/openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec, s; ?( n: _7 @
exit
0 F6 W" W/ c' I3 e  wInstall the rpm package" v5 {  ]2 I- v  Z! a) Y
yum localinstall /home/ovs/rpmbuild/RPMS/x86_64/openvswitch-2.3.1-1.x86_64.rpm/ M. Y1 q: X4 o9 Q6 w4 ^
Check that the command-line tools are ready) q. v8 @( C7 ]$ r. F
ovs-vsctl -V8 Y8 l! w: ^- E' U: V
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.
* J5 l) Y3 ?* @) Z2 l2 }- Kyum install policycoreutils-python
' |6 H9 j3 y* v6 f2 W7 O) dmkdir /etc/openvswitch1 q0 t2 q! h8 J6 p7 p( ^& q
semanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?"
$ k, J2 l* b3 Y- `3 B0 brestorecon -Rv /etc/openvswitch
! D% q9 l# y- \; g7 E5 K: eStart OpenvSwitch. N; ~2 I' R6 g  i$ x
/etc/init.d/openvswitch start
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

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

GMT+8, 2026-4-8 23:53 , Processed in 0.498547 second(s), 23 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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