找回密码
 注册
查看: 4587|回复: 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.2 O, s& ~$ X, f5 r

: }* ^, o. S% LBelow 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).
5 D6 U0 t- b1 f, B: r2 `4 Q! d
+ y$ z5 O( h- M# UInstall the requisite packages.- S9 t' Q/ D* @" C( f; C3 h
#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
7 Y1 {. P7 _1 K! `- \; vNecessary steps for building RPM
/ `1 P4 C$ O4 u5 L#mkdir -p ~/rpmbuild/SOURCES) c, ~9 K* q1 g8 D% k0 K$ n- D
#wget http://openvswitch.org/releases/openvswitch-2.5.1.tar.gz1 L8 ?& i  k- X$ U
#cp openvswitch-2.5.1.tar.gz ~/rpmbuild/SOURCES/
' f/ r; Y3 C7 W  Q# d) e#tar xfz openvswitch-2.5.1.tar.gz. P3 C( Z) U9 K$ ^& ?' |
#sed 's/openvswitch-kmod, //g' openvswitch-2.5.1/rhel/openvswitch.spec > openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec
6 g9 v4 N5 A) X, _9 p5 U1 mBuild the RPM
0 N( Z. D7 S3 H) ^# ~& V5 d) D#rpmbuild -bb --nocheck ~/openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec
# [) X7 \% v' U, A. d% C3 IInstall the RPM( H8 Y& |" f2 c$ n" ~5 w# [
#ls -l ~/rpmbuild/RPMS/x86_64/
7 ~9 ?1 i3 K) E#yum localinstall ~/rpmbuild/RPMS/x86_64/openvswitch-2.5.1-1.x86_64.rpm
0 A  Q' t) t& n- [6 `. Z$ G+ rStart the OVS service and enable it for the next boot
8 L9 {  P0 d# g2 {0 J# E6 w; S#systemctl start openvswitch.service. c. z; G1 O2 v/ Y
#chkconfig openvswitch on8 ?+ ~5 W- L8 z# Y  s& v. Q
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.
3 d% X# s" ^1 T% d; S0 L& h( I& d! ?1 v! m8 s
Test the OVS Version# Q0 a) q/ q4 g3 u1 Z8 ?$ g8 p# A
#ovs-vsctl -V
0 @# n, c1 q# _3 P; W$ R. Q$ h$ d$ W2 x; u- c8 t( \& W
Useful OVS commands* }! J3 p- P. @! b3 H0 {" N1 g) n
#ovs-vsctl show
" q7 l0 o" S, ^+ ~8 d. Q8 B  V8 G#ovs-ofctl show br0! P$ `7 v, _1 g9 |+ j
! t$ z, p5 L( T( z4 M; L
Create a new OVS Bridge, add physical ports, connect OVS with ODL controller
6 G$ ?6 f+ m' U- v#ovs-vsctl add-br ovsbr0# h1 o2 P7 G  l! s0 H- H
#ovs-vsctl set bridge ovsbr0 protocols=OpenFlow13
1 `1 |' f0 {1 R! t; [#ovs-vsctl list controller
2 u% v* N. G* ~. O  E9 S#ovs-vsctl add-port ovsbr0 eth4
$ t) [2 k+ x3 j#ovs-vsctl add-port ovsbr0 eth8  D$ v' R  c3 O) Z
#ovs-vsctl set-controller ovsbr0 tcp:192.168.15.57:6633
! k. Y' A* S+ f0 |& F' @#ovs-vsctl show

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-12-20 01:32:53 | 显示全部楼层
Install some packages
; E+ y  I( |! K& |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' O9 q4 f% C9 X% K2 k
You can add a user that can see the file and directory clearly, up to you.- u- ]$ s. i  v9 _6 C+ E8 }
adduser ovs6 F9 d' ~7 r) p" w3 t
su - ovs
, M/ _! ?# y2 P7 P- h7 p  n! AGet the file and decompress it" K9 l) E! u  j% H
mkdir -p ~/rpmbuild/SOURCES' V7 `; Y3 N. @! r% G! Y8 Y- |
wget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz# s1 I7 Y  `2 T8 V9 i- r
cp openvswitch-2.3.1.tar.gz ~/rpmbuild/SOURCES/
+ v% d7 O3 L, _% Qtar xfz openvswitch-2.3.1.tar.gz2 f; ~9 B( N% K2 w  N# C/ @( ]
Modify the file& e, L( \% f" R2 y4 |
sed 's/openvswitch-kmod, //g' openvswitch-2.3.1/rhel/openvswitch.spec > openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec' \) y: ^5 }  H7 J
Generate the rpm file" x* D0 X. t+ C  a2 y$ @2 P3 o
rpmbuild -bb --nocheck ~/openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec# T1 F6 K8 H/ @% W2 ]
exit( H" q0 u, w; T& z/ f" O
Install the rpm package' k1 d8 y+ {3 }; a$ x
yum localinstall /home/ovs/rpmbuild/RPMS/x86_64/openvswitch-2.3.1-1.x86_64.rpm
4 o7 w; ]  S/ y& T4 x1 A7 T7 ^Check that the command-line tools are ready
2 M$ B' V3 _% v+ L% a; F: X* Xovs-vsctl -V4 p( _7 k& p6 X8 J" \
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.
+ m, @' g# C! U: A) nyum install policycoreutils-python
0 _  [0 s( z0 z+ E1 E* Dmkdir /etc/openvswitch: ~; b2 M3 I# {; N- S+ n! i
semanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?"& H- ~9 l/ ~& X4 t
restorecon -Rv /etc/openvswitch
3 e1 E+ l# ^8 Z" R' P9 l! r0 jStart OpenvSwitch
! M* ]! B2 k: D/etc/init.d/openvswitch start
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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