找回密码
 注册
查看: 4585|回复: 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.8 ^8 C+ I' B* G& Q- x/ B3 W
. E1 Q) Q" P6 Z% t, K  G% D
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).
, H3 N: C+ V" l8 N8 q' w/ J8 U- {5 g: L1 `& j
Install the requisite packages.* b( S, v( V. x+ I& d
#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
' o# |; H# m4 k6 O. DNecessary steps for building RPM) p+ H: G9 o* s5 \9 F
#mkdir -p ~/rpmbuild/SOURCES/ i! t% W1 }) A4 r
#wget http://openvswitch.org/releases/openvswitch-2.5.1.tar.gz6 {* a2 n0 N* s: O7 r* t
#cp openvswitch-2.5.1.tar.gz ~/rpmbuild/SOURCES/+ D! v) B, N  i  j# f
#tar xfz openvswitch-2.5.1.tar.gz4 O9 J' z0 ?  K+ d* F4 a- m
#sed 's/openvswitch-kmod, //g' openvswitch-2.5.1/rhel/openvswitch.spec > openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec. t' q0 K. D) I% `
Build the RPM$ k* q) Z, S: T( W
#rpmbuild -bb --nocheck ~/openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec: B# v1 _' o) w' Z. A
Install the RPM
" e; }5 j8 d8 q. H0 i#ls -l ~/rpmbuild/RPMS/x86_64/
) H+ a6 O+ o# W/ T) b#yum localinstall ~/rpmbuild/RPMS/x86_64/openvswitch-2.5.1-1.x86_64.rpm
5 g& L9 r+ t3 j& V! \. m: {" M: HStart the OVS service and enable it for the next boot
' L7 U0 R8 H  |- g* D6 H* G  T#systemctl start openvswitch.service1 T: u0 d. `1 q( A" v  V
#chkconfig openvswitch on
7 S  h+ e3 L  q% A7 h. s3 `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.
* C; e. V! x  W7 L4 A9 b9 _4 }/ S% h$ ]4 X
Test the OVS Version- I: |0 e1 ^1 a. S  J& x/ ], G
#ovs-vsctl -V
3 H! Y* m: m4 T7 N) E- r1 i  @3 K! f1 G
4 [3 j- I3 ~( K, U) b+ N; EUseful OVS commands
: i! W) W: k6 k# j  h, m) z#ovs-vsctl show
. W1 a' F' t/ i, v# z4 }#ovs-ofctl show br0
, ]: |5 y6 X/ K; V
& H( T  b4 _$ a) DCreate a new OVS Bridge, add physical ports, connect OVS with ODL controller. r( T" f/ o' l/ c& L# V
#ovs-vsctl add-br ovsbr0
4 p# \5 Z0 V! L1 z#ovs-vsctl set bridge ovsbr0 protocols=OpenFlow13
9 _- f  x& [" C4 f/ c#ovs-vsctl list controller2 K1 c7 _1 z' Q+ s2 h$ {, t
#ovs-vsctl add-port ovsbr0 eth4( w+ {; \8 I* u+ h6 `
#ovs-vsctl add-port ovsbr0 eth82 }1 ]4 l" s- f; h6 c- @5 p$ b" Q- s
#ovs-vsctl set-controller ovsbr0 tcp:192.168.15.57:6633
1 K0 j. A9 o( J$ J#ovs-vsctl show

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2018-12-20 01:32:53 | 显示全部楼层
Install some packages
" }! I3 w) Z4 |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
, W- D3 C. L% P3 h4 R% F* eYou can add a user that can see the file and directory clearly, up to you.
2 u+ ]3 B. F, o# t. _adduser ovs2 m6 w0 a8 C" g& @8 V
su - ovs6 ]* f- P2 l/ L* V6 `7 h
Get the file and decompress it0 V0 i2 K+ [; ?  c8 A
mkdir -p ~/rpmbuild/SOURCES7 ^4 p2 W: H% a5 u; A
wget http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz
- c9 _2 S# t1 o" N9 m9 a/ ?: ~; z# xcp openvswitch-2.3.1.tar.gz ~/rpmbuild/SOURCES/
: ]0 J- k: S3 h$ ^( f3 Ytar xfz openvswitch-2.3.1.tar.gz
0 n( ?0 `4 d7 hModify the file& G# O/ i/ O  ]2 }6 w
sed 's/openvswitch-kmod, //g' openvswitch-2.3.1/rhel/openvswitch.spec > openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec
# |' A* m# ?' WGenerate the rpm file
- }' q& I' M( Nrpmbuild -bb --nocheck ~/openvswitch-2.3.1/rhel/openvswitch_no_kmod.spec5 U( B5 j2 j% T; F
exit
' P1 j9 h! `1 K# Q/ O% jInstall the rpm package
8 B+ B0 L5 i3 D( Y) o2 fyum localinstall /home/ovs/rpmbuild/RPMS/x86_64/openvswitch-2.3.1-1.x86_64.rpm
/ d1 l. X) _7 d( @( z( ^# p7 OCheck that the command-line tools are ready$ j2 I' D$ W* r1 ~& h
ovs-vsctl -V
7 O- }" a- X5 v- a. |$ rNOW, 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.2 I2 b7 l+ A7 d- p8 l
yum install policycoreutils-python
9 x; B& M( |4 l7 {+ emkdir /etc/openvswitch3 n, {9 W+ h% L) B( X
semanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?"# L/ {8 x, l# O' [( J
restorecon -Rv /etc/openvswitch# r( K! K: o, q* O
Start OpenvSwitch
+ k2 v1 V8 ~7 R. ~# X$ L, H8 t/etc/init.d/openvswitch start
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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