- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
27 Nov 2016 8 min read 9 Comments SDN7 T7 M. C% W; q S% L
Vanilla openstack networking has many functional, performance and scaling limitations. Projects like L2 population, local ARP responder, L2 Gateway and DVR were conceived to address those issues. However good a job these projects do, they still remain a collection of separate projects, each with its own limitations, configuration options and sets of dependencies. That led to an effort outside of OpenStack to develop a special-purpose OVS-only SDN controller that would address those issues in a centralised and consistent manner. This post will be about one such SDN controller, coming directly from the people responsible for OpenvSwitch, Open Virtual Network (OVN).
) C7 s8 @# F( }7 X) y K; ?( s, j* @# h9 i: R: v3 n& B
OVN quick introduction: p- w2 t2 \, z% X
OVN is a distributed SDN controller implementing virtual networks with the help OVS. Even though it is positioned as a CMS-independent controller, the main use case is still OpenStack. OVN was designed to address the following limitations of vanilla OpenStack networking:
3 }( o( _3 _' m4 m5 J, J+ ^" Z6 i U- Y3 ?# ]- f& F, h
Security groups could not be implemented directly on OVS ports and, therefore, required a dedicated Linux bridge between the VM and the OVS integration bridge.
) ?: v; B, \1 l- L% K9 B% XRouting and DHCP agents required dedicated network namespaces.
& d; b" H$ s: m3 A0 }) VNAT was implemented using a combination of network namespaces, iptables and proxy-ARP.
6 |- w. l* C4 R6 ?; |* ^/ h6 jOVN implements security groups, distributed virtual routing, NAT and distributed DHCP server all inside a single OVS bridge. This dramatically improves performance by reducing the number of inter-process packet handling and ensures that all flows can benefit from kernel fast-path switching.% \& \ C6 {/ W# F7 }6 a
3 m, @) |* N. m! dAt a high level, OVN consists of 3 main components:
9 R7 }# Y* c- w' w. L
; ?; h* x. ?& X0 lOVN ML2 Plugin - performs translation between Neutron data model and OVN logical data model stored in Northbound DB.
' Y3 ~9 G4 O4 C# @, v: {: b; iOVN northd - the brains of OVN, translates the high level networking abstractions (logical switches, routers and ports) into logical flows. These logical flows are not yet OpenFlow flows but similar in concept and a very powerful abstraction. All translated information is stored in Southbound DB.
9 |! E& e; {2 M$ g( `" e( d% B0 W* ]OVN controllers - located on each compute node, receive identical copies of logical flows (centralised network view) and exchange logical port to overlay IP binding information via the central Southbound DB. This information is used to perform logical flow translation into OpenFlow which are then programmed into the local OVS instance.1 D# |5 x* c* e2 ]
. x2 h* g4 N% `0 @/ `5 m! t* S) C+ o) m* u, U/ x4 S/ c
If you want to learn more about OVN architecture and use cases, OpenStack OVN page has an excellent collection of resources for further reading.
/ x; X: O4 ^& K( M6 }4 ^" F! K/ @
$ w, @% {; N( HOpenStack installation
, ?6 v7 L( O6 W0 H; gI’ll use RDO packstack to help me build a 1 controller and 2 compute nodes OpenStack lab on CentOS7. I’ll use the master trunk to deploy the latest OpenStack Ocata packages. This is required since at the time of writing (Nov 2016) some of the OVN features were not available in OpenStack Newton.
- s$ }& C- ^4 f& d
0 ?9 ]6 L. F! v9 I; x8 Xcd /etc/yum.repos.d/& W6 i! V9 e) q8 V+ w3 ^# m
wget http://trunk.rdoproject.org/centos7/delorean-deps.repo/ T% ~2 ^3 n- w
wget https://trunk.rdoproject.org/centos7-master/current/delorean.repo5 t; c: D% O/ o3 g7 V ~
On the controller node, generate a sample answer file and modify settings to match the IPs of individual nodes. Optionally, you can disable some of the unused components like Nagios and Ceilometer similar to how I did it in my earlier post.% P2 s1 O9 e; \# [6 p% u
* C( X* ]. m* M- w6 `
yum install -y openstack-packstack crudini
2 r( u6 ?0 e: X$ [( vpackstack --gen-answer-file=/root/packstack.answer
8 j. ?5 a1 o m1 X0 a$ Scrudini --set --existing defautl CONFIG_COMPUTE_HOSTS 169.254.0.12,169.254.0.13* `7 ]8 {6 ?" P5 r1 j. t0 i
crudini --set --existing defautl CONFIG_CONTROLLER_HOST 169.254.0.11
% t2 a* x% D( r& I: jcrudini --set --existing defautl CONFIG_NETWORK_HOSTS 169.254.0.11! T$ Z$ x* l9 B/ x q) H0 N$ C: k7 [
packstack --answer-file=/root/packstack.answer
6 `8 H! E. b2 c( ^ G1 pAfter the last step we should have a working 3-node OpenStack lab, similar to the one depicted below. If you want to learn about how to automate this process, refer to my older posts about OpenStack and underlay Leaf-Spine fabric build using Chef.5 X- V( H; Z( e( w! V* `
( O( e3 v( P3 m3 W- @4 ~0 J. \7 _
# `" |+ _; @4 B P. z5 z8 p' U# `4 J0 ^( m8 x. w
OVN Build7 _' b- Q/ U. |+ s
OVN can be built directly from OVS source code. Instead of building and installing OVS on each of the OpenStack nodes individually, I’ll build a set of RPM’s on the Controller and will use them to install and upgrade OVS/OVN components on the remaining nodes., _& H. \; K+ p& S) P
$ q' U. o$ `. l! ~7 ^2 y& F) E$ yPart of OVN build process includes building an OVS kernel module. In order to be able to use kmod RPM on all nodes we need to make sure all nodes use the same version of Linux kernel. The easiest way would be to fetch the latest updates from CentOS repos and reboot the nodes. This step should result in same kernel version on all nodes, which can be checked with uname -r command.
. N: W! q! c O2 d
$ y7 {2 G; L1 S4 h' }6 I0 Fyum -y update kernel2 E& i, H1 i+ X/ \) n
reboot
: A! V5 x) }7 }$ H8 E/ U- HThe official OVS installation procedure for CentOS7 is pretty accurate and requires only a few modifications to account for the packages missing in the minimal CentOS image I’ve used as a base OS.( G U2 I9 ^) j. U. w& E8 }
1 {+ g" e |* n. W! z) pyum install rpm-build autoconf automake libtool systemd-units openssl openssl-devel python python-twisted-core python-zope-interface python-six desktop-file-utils groff graphviz procps-ng libcap-ng libcap-ng-devel2 N. r, p! c2 S V6 Q
: @ S2 n4 H6 S) C5 e0 ?9 b5 Y/ k9 ?yum install selinux-policy-devel kernel-devel-`uname -r` git2 A* V5 d W; z
# y H, j& D( ?0 C
git clone https://github.com/openvswitch/ovs.git && cd ovs
3 |- o' e# g) p./boot.sh$ N* P% E$ g) [ j% Y2 b4 N
./configure
% Y* P; G! u @) W! `* G( M+ _make rpm-fedora RPMBUILD_OPT="--without check"
7 u: y8 B) ^- umake rpm-fedora-kmod
3 o% S( @9 w8 `, a7 zAt the end of the process we should have a set of rpms inside the ovs/rpm/rpmbuild/RPMS/ directory.( U. ]4 w/ d, N/ @
7 E' g) l9 h: NOVN Install
! ^/ \' D$ y" J4 [" i# u, P' ], rBefore we can begin installing OVN, we need to prepare the existing OpenStack environment by disabling and removing legacy Neutron OpenvSwitch agents. Since OVN natively implements L2 and L3 forwarding, DHCP and NAT, we won’t need L3 and DHCP agents on any of the Compute nodes. Network node that used to provide North-South connectivity will no longer be needed.: x' U# ]5 R/ Z6 y. i2 {
) C8 ~/ u9 w1 X1 }7 ^/ uOpenStack preparation6 S- ?5 W W$ }. B$ O3 Q
First, we need to make sure all Compute nodes have a bridge that would provide access to external provider networks. In my case, I’ll move the eth1 interface under the OVS br-ex on all Compute nodes.
2 H0 s/ n: B2 ? R* {2 E ]% t' R/ F% d0 l9 i, L0 J
DEVICE=eth1+ b# u7 U | b }
NAME=eth1
* n. t ~! S% {DEVICETYPE=ovs6 s# F1 ^* T0 f/ h. P/ X
TYPE=OVSPort
7 W6 j% _' Q/ j+ IOVS_BRIDGE=br-ex
! }6 G+ D2 D: PONBOOT=yes0 g8 }) u1 U* |$ n a
BOOTPROTO=none1 g! v# x& E; [* {; b( A3 r
IP address needs to be moved to br-ex interface. Below example is for Compute node #2:4 T& L9 j1 d4 G. R0 @
: O" R4 p: d7 {ONBOOT=yes
l* ^* [4 e. M+ N0 [% UDEFROUTE=yes
% `: n& j, U1 y1 s0 WIPADDR=169.254.0.12, s/ G/ X) j( n, w
PREFIX=248 R6 x3 s/ m: x3 |
GATEWAY=169.254.0.17 r8 M j8 u& T2 j; m* O
DNS1=8.8.8.8& O. b) L8 J3 J, w: `/ g
DEVICE=br-ex
; F1 }( P" _# M6 L7 m$ Y( J/ ~NAME=br-ex
+ A( G& M% R- ?/ \# @ o% G: b+ Z" x/ \DEVICETYPE=ovs
3 y+ L# `6 B: T: u& w4 I1 C$ yOVSBOOTPROTO=none4 N) p& I2 O& o( k. l
TYPE=OVSBridge
2 G$ p5 D: E' PAt the same time OVS configuration on Network/Controller node will need to be completely wiped out. Once that’s done, we can remove the Neutron OVS package from all nodes.' D: I" n6 N1 Z U7 X6 Q
2 E8 Z+ f& }% l0 oyum remove openstack-neutron-openvswitch1 T5 L0 U& P1 t+ V* ]6 Z
OVS packages installation1 D8 g$ D2 h/ v& w# c
Now everything is ready for OVN installation. First step is to install the kernel module and upgrade the existing OVS package. Reboot may be needed in order for the correct kernel module to be loaded.
9 Y! g# X& i$ O8 M* j5 @+ v1 n$ E& r
3 ]& E3 L0 r. Y! t# grpm -i openvswitch-kmod-2.6.90-1.el7.centos.x86_64.rpm4 G/ b+ Q& w4 R% F" L2 |
rpm -U openvswitch-2.6.90-1.el7.centos.x86_64.rpm$ P- f0 {& u( }/ D8 V. b4 o: P4 s( n
reboot) \% y# M5 R n6 n8 ^
Now we can install OVN. Controllers will be running the ovn-northd process which can be installed as follows:8 n& c7 c) n5 A: }" j
7 d& C2 O$ y. Y+ b2 `9 K
rpm -i openvswitch-ovn-common-*.x86_64.rpm; F! p. }0 L5 j f' u% K
rpm -i openvswitch-ovn-central-*.x86_64.rpm
3 f! F: O9 o, {. Xsystemctl start ovn-northd
6 F% ^. C3 M( `. ?The following packages install the ovn-controller on all Compute nodes:
/ @: b; L% P; k9 s3 h7 V ?9 x8 y# J0 H& n J/ s
rpm -i openvswitch-ovn-common-*.x86_64.rpm/ e! S; P8 M: q! a+ z0 ]
rpm -i openvswitch-ovn-host-*.x86_64.rpm
+ n- f2 d) z/ p: m6 `systemctl start ovn-controller* }. A3 s1 t- G, E1 P
The last thing is to install the OVN ML2 plugin, a python library that allows Neutron server to talk to OVN Northbound database.$ {) n5 j% Q7 y' `, t+ y
# y# A" E, [2 W, C* I
yum install python-networking-ovn/ U- i! n2 x9 Y: U+ k
OVN Configuration
3 d. J2 P1 d/ p( `Now that we have all the required packages in place, it’s time to reconfigure Neutron to start using OVN instead of a default openvswitch plugin. The installation procedure is described in the official Neutron integration guide. At the end, once we’ve restarted ovn-northd on the controller and ovn-controller on the compute nodes, we should see the following output on the controller node:8 {5 l9 D' [" v; W# L' {
" q+ C1 J, }$ u6 d" t$ J
$ ovs-sbctl show* i: X/ e2 A* ~( k/ a. q
Chassis "d03bdd51-e687-4078-aa54-0ff8007db0b5"1 W( |, Q6 t( L0 C# a7 U& y
hostname: "compute-3"' o/ k3 e) ]+ l' H) f
Encap geneve
& F' A) X, a8 }$ s* t ip: "10.0.0.4"% T. N) c `& P& [7 F: [
options: {csum="true"}
2 _7 v' B( d& H Encap vxlan9 k, L. h8 h' ?) @) W' y3 r
ip: "10.0.0.4"% f( l8 J* E/ K4 s
options: {csum="true"}
! _+ u% C" Z+ k7 w, }" YChassis "b89b8683-7c74-43df-8ac6-1d57ddefec77"% W! P; x, P' W, a7 |
hostname: "compute-2"
. _2 ?4 K0 V8 K0 k4 g6 H Encap vxlan" |; ?! S% d, u4 v: ]4 n: X5 a
ip: "10.0.0.2"
- q2 I/ [& h' w4 w options: {csum="true"}- l2 Y* o `- S) {3 H
Encap geneve, ]. M& N$ Q* ^. t4 y' M- I
ip: "10.0.0.2"
$ ?! B# ]% r5 V) H- @ options: {csum="true"}+ ^1 q' P: _& R/ q3 z4 F2 Z; f
This means that all instances of a distributed OVN controller located on each compute node have successfully registered with Southbound OVSDB and provided information about their physical overlay addresses and supported encapsulation types.
9 }- q8 t y* {5 v6 ?9 [% T. {6 K' _4 d0 Y5 Q$ } R! t' o) G# _! o
(Optional) Automating everything with Chef* ]; L; Z+ R# z- B' M
At this point of time there’s no way to automate OVN deployment with Packstack (TripleO already has OVN integration templates). For those who want to bypass the manual build process I have created a new Chef cookbook, automating all steps described above. This Chef playbook assumes that OpenStack environment has been built as described in my earlier post. Optionally, you can automate the build of underlay network as well by following my other post. Once you’ve got both OpenStack and underlay built, you can use the following scripts to build, install and configure OVN:
9 Q6 E+ W% c3 g2 p+ b; \
}( |6 H$ E7 E# @+ [9 Pgit clone https://github.com/networkop/chef-unl-os.git9 @2 n$ B% R1 V6 g) U
cd chef-unl-os# y4 c( a! `; Y2 K% F' k8 L: T
chef-client -z -E lab ovn.rb
- m# {2 Y* l% R( s; l- tTest topology setup9 u* o- L: m+ B; }
Now we should be able to create a test topology with two tenant subnets and an external network interconnected by a virtual router.
]5 n6 i2 X7 A5 _$ r3 p+ T5 C6 R: L8 g7 ?6 g
neutron net-create NET-RED- h0 V( _) G3 Q: x
neutron net-create NET-BLUE t" c) t7 @2 ~1 ]1 E6 L5 y a
neutron subnet-create --name SUB-BLUE NET-BLUE 10.0.0.0/24
' t$ t8 r v, K) ^; wneutron subnet-create --name SUB-RED NET-RED 20.0.0.0/24& I6 j6 o3 z! M. w# ~& U
neutron net-create NET-EXT --provider:network_type flat \9 m: X5 }6 A: o" m5 M: R
--provider:physical_network extnet \
0 p8 @% r, [4 f% d* k --router:external --shared
# @7 A/ f J+ v* ? h' F7 Dneutron subnet-create --name SUB-EXT --enable_dhcp=False \
) [) u, R; [1 r% E- G --allocation-pool=start=169.254.0.50,end=169.254.0.99 \
& U9 U9 n6 y0 e --gateway=169.254.0.1 NET-EXT 169.254.0.0/24 z3 Y( f, A( ]9 G* B
neutron router-create R1/ [ L j& f8 g# {
neutron router-interface-add R1 SUB-BLUE
& G" F0 g4 O' X2 l% uneutron router-interface-add R1 SUB-RED
# K# {) T N& {* F$ s8 W$ N5 yneutron router-gateway-set R1 NET-EXT
+ v; h' c6 h: O, Z, \6 q8 bWhen we attach a few test VMs to each subnet we should be able to successfully ping between the VMs, assuming the security groups are setup to allow ICMP/ND.
+ {# r, f9 Z" i1 ]; A8 k5 N6 N4 q- w A; a7 L9 Y; o
curl http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img | glance \
' V6 w% X, ]# U. A, W* i1 Cimage-create --name='IMG-CIRROS' \
: i4 Z# E" d/ o. y --visibility=public \
; G9 ?/ P8 y' ^- b$ L- w [ --container-format=bare \# O4 @; {* Q- U, E& N) X7 a/ T8 c
--disk-format=qcow22 T( ]* s. r. i P2 V( L H
nova aggregate-create AGG-RED AZ-RED
9 Z! [8 s R# C1 u! x" \nova aggregate-create AGG-BLUE AZ-BLUE/ a1 k7 W5 B. [) F+ V8 Y5 Z
nova aggregate-add-host AGG-BLUE compute-2( a5 c. J% l: B# B2 i
nova aggregate-add-host AGG-RED compute-3
2 y* _% S2 ]( c' `- F$ Y0 {% @nova boot --flavor m1.tiny --image 'IMG-CIRROS' \
0 N5 w% H, ?( c/ W+ |1 u --nic net-name=NET-BLUE \9 A% X1 C4 D5 S/ O3 q
--availability-zone AZ-BLUE \! O' ~( N! d/ S' q$ h6 _( X
VM17 U# D8 x* m, x2 X; e' `
- Q5 T. F7 M ^" e7 xnova boot --flavor m1.tiny --image 'IMG-CIRROS' \
( Y7 ^. }# w' i --nic net-name=NET-RED \
; l5 }9 \) @$ S --availability-zone AZ-RED \. j, R' l. K1 `& q( P3 e
VM2
2 k+ h7 k) m9 e1 @' f4 ynova boot --flavor m1.tiny --image 'IMG-CIRROS' \/ I `% F7 y5 T6 S6 ?8 U e
--nic net-name=NET-BLUE \
1 L( B! h) N6 D0 J8 f+ I8 S --availability-zone AZ-RED \
6 [+ g- W0 k+ n# L7 {4 X; U VM3
/ W! `6 Z$ |8 W! t9 R" Z# W; g" { Vopenstack floating ip create NET-EXT
3 O1 T" \- p2 m6 I( e; Iopenstack server add floating ip VM3 169.254.0.53
- K8 Y6 A( e" A- W; m" ~' ?
' f# e, H& o1 P5 k6 @/ P7 w4 M1 Q7 x( {3 E& B( a
In the next post we will use the above virtual topology to explore the dataplane packet flow inside an OVN-managed OpenvSwitch and how it uses the new encapsulation protocol GENEVE to optimise egress forwarding lookups on remote compute nodes.
9 [ K, B. ?% H4 W+ p& N5 P* C; \2 y7 O D+ q( M0 {% g P
OpenStack-SDN OVN
+ C9 U# b$ H$ ERelated
5 w m( N2 P: j: kOpenStack SDN - Distributed Virtual Routing
. Q! I- |. y9 p1 l+ |Automating the Build of OpenStack Lab (Part 2)
j+ d. } o5 F1 d/ `- W% bAutomating the Build of OpenStack Lab (Part 1)* o+ ?8 }- ]# o& Q" L+ |
OpenStack SDN - Interconnecting VMs and Physical Devices With Cumulus VX L2 Gateway
6 V! m$ A9 y) ~7 F8 sOpenStack SDN - Extending a L2 Provider Network Over a L3 Fabric |
|