[转]Examining Open vSwitch Traffic Patterns
In this post, I want to provide some additional insight on how the use of Open vSwitch (OVS) affects—or doesn’t affect, in some cases—how a Linux host directs traffic through physical interfaces, OVS internal interfaces, and OVS bridges. This is something that I had a hard time understanding as I started exploring more advanced OVS configurations, and hopefully the information I share here will be helpful to others.
To help structure this discussion, I’m going to walk through a few different OVS configurations and scenarios. In these scenarios, I’ll use the following assumptions:
· The physical host has four interfaces (eth0, eth1, eth2, and eth3)
· The host is running Linux with KVM, libvirt, and OVS installed
Scenario 1: Simple OVS Configuration
In this first scenario let’s look at a relatively simple OVS configuration, and examine how Linux host and guest domain traffic moves into or out of the network.
Let’s assume that our OVS configuration looks something like this (this is the output from ovs-vsctl show):
bc6b9e64-11d6-415f-a82b-5d8a61ed3fbd
Bridge "br0"
Port "br0"
Interface "br0"
type: internal
Port "eth0"
Interface "eth0"
Bridge "br1"
Port "br1"
Interface "br1"
type: internal
Port "eth1"
Interface "eth1"
ovs_version: "1.7.1"
This is a pretty simple configuration; there are two bridges, each with a single physical interface. Let’s further assume, for the purposes of this scenario, that eth2 has an IP address and is working properly to communicate with other hosts on the network. The eth3 interface is shutdown.
So, in this scenario, how does traffic move into or out of the host?
1. Traffic from a guest domain: Traffic from a guest domain will travel through the OVS bridge to which it is attached (you’d see an additional “vnet0″ port and interface appear on that bridge when you start the guest domain). So, a guest domain attached to br0 would communicate via eth0, and a guest domain attached to br1 would communicate via eth1. No real surprises here.
2. Traffic from the Linux host: Traffic from the Linux host itself will notcommunicate over any of the configured OVS bridges, but will instead use its native TCP/IP stack and any configured interfaces. Thus, since eth2 is configured and operational, all traffic to/from the Linux host itself will travel through eth2.
The interesting point (to me, at least) about #2 above is that this includes traffic from the OVS process itself. In other words, if the OVS process(es) need to communicate across the network, they won’t use the bridges—they’ll use whatever interfaces the Linux host uses to communicate. This is one thing that threw me off: because OVS is itself a Linux process, when OVS needs to communicate across the network it will use the Linux network stack to do so. In this scenario, then, OVS would not communicate over any configured bridge, but instead using eth2. (This makes perfect sense now, but I recall that it didn’t earlier. Maybe it’s just me.)
Scenario 2: Adding Bonding
In this second scenario, our OVS configuration changes only slightly:
bc6b9e64-11d6-415f-a82b-5d8a61ed3fbd
Bridge "br0"
Port "br0"
Interface "br0"
type: internal
Port "bond0"
Interface "eth0"
Interface "eth1"
ovs_version: "1.7.1"
In this case, we’re now leveraging a bond that contains two physical interfaces (eth0 and eth1). (By the way, I have a write-up on configuring OVS and bonds, if you need/want more information.) The eth2 interface still has an IP address assigned and is up and communicating properly. The physical eth3 interface is shutdown.
How does this affect the way in which traffic is handled? It doesn’t, really.Traffic from guest domains will still travel across br0 (since this is the only configured OVS bridge), and traffic from the Linux host—including traffic from OVS itself—will still use whatever interfaces are determined by the host’s TCP/IP stack. In this case, that would be eth2.
Scenario 3: The Isolated Bridge
Let’s look at another OVS configuration, the so-called “isolated bridge”. This is a configuration that is commonly found in implementations using NVP, OpenStack, and others, and it’s a configuration that I recently discussed in my post on GRE tunnels and OVS.
Here’s the configuration:
bc6b9e64-11d6-415f-a82b-5d8a61ed3fbd
Bridge "br0"
Port "br0"
Interface "br0"
type: internal
Port "bond0"
Interface "eth0"
Interface "eth1"
Bridge "br-int"
Port "br-int"
Interface "br-int"
type: internal
Port "gre0"
Interface "gre0"
type: gre
options: {remote_ip="192.168.1.100"}
ovs_version: "1.7.1"
As with previous configurations, we’ll assume that eth2 is up and operational, and eth3 is shutdown. So how does traffic get directed in this configuration?
1. Traffic from guest domains attached to br0: This is as before—traffic will go out one of the physical interfaces in the bond, according to the bonding configuration (active-standby, LACP, etc.). Nothing unusual here.
2. Traffic from the Linux host: As before, traffic from processes on the Linux host will travel out according to the host’s TCP/IP stack. There are no changes from previous configurations.
3. Traffic from guest domains attached to br-int: Now, this is where it gets interesting. Guest domains attached to br-int (named “br-int” because in this configuration the isolated bridge is often called the “integration bridge”) don’t have any physical interfaces they can use; they can only use the GRE tunnel. Here’s the “gotcha”, so to speak: the GRE tunnel is created and maintained by the OVS process, and therefore it uses the host’s TCP/IP stack to communicate across the network. Thus, traffic from guest domains attached to br-int would hit the GRE tunnel, which would travel through eth2.
I’ll give you a second to let that sink in.
Ready now? Good! The key to understanding #3 is, in my opinion, understanding that the tunnel (a GRE tunnel in this case, but the same would apply to a VXLAN or STT tunnel) is created and maintained by the OVS process.Thus, because it is created and maintained by a process on the Linux host (OVS itself), the traffic for the tunnel is directed according to the host’s TCP/IP stack and IP routing table(s). In this configuration, the tunnels don’t travel through any of the configured OVS bridges.
Scenario 4: Leveraging an OVS Internal Interface
Let’s keep ramping up the complexity. For this scenario, we’ll use an OVS configuration that is the same as in the previous scenario:
bc6b9e64-11d6-415f-a82b-5d8a61ed3fbd
Bridge "br0"
Port "br0"
Interface "br0"
type: internal
Port "bond0"
Interface "eth0"
Interface "eth1"
Bridge "br-int"
Port "br-int"
Interface "br-int"
type: internal
Port "gre0"
Interface "gre0"
type: gre
options: {remote_ip="192.168.1.100"}
ovs_version: "1.7.1"
The difference, this time, is that we’ll assume that eth2 and eth3 are both shutdown. Instead, we’ve assigned an IP address to the br0 interface on bridge br0. OVS internal interfaces, like br0, can appear as “physical” interfaces to the Linux host, and therefore can be assigned IP addresses and used for communication. This is the approach I used in describing how to run host management across OVS.
Here’s how this configuration affects traffic flow:
1. Traffic from guest domains attached to br0: No change here. Traffic from guest domains attached to br0 will continue to travel across the physical interfaces in the bond (eth0 and eth1, in this case).
2. Traffic from the Linux host: This time, the only interface that the Linux host has is the br0 internal interface. The br0 internal interface is attached to br0, so all traffic from the Linux host will travel across the physical interfaces attached to the bond (again, eth0 and eth1).
3. Traffic from guest domains attached to br-int: Because Linux host traffic is directed through br0 by virtue of using the br0 internal interface, this means that tunnel traffic is also directed through br0, as dictated by the Linux host’s TCP/IP stack and IP routing table(s).
As you can see, assigning an IP address to an OVS internal interface has a real impact on the way in which the Linux host directs traffic through OVS. This has both positive and negative impacts:
· One positive impact is that it allows for Linux host traffic (such as management or tunnel traffic) to take advantage of OVS bonds, thus gaining some level of NIC redundancy.
· A negative impact is that OVS is now “in band,” so upgrades to OVS will be disruptive to all traffic moving through OVS—which could potentially include host management traffic.
Let’s take a look at one final scenario.
Scenario 5: Using Multiple Bridges and Internal Interfaces
In this configuration, we’ll use an OVS configuration that is very similar to the configuration I showed in my post on GRE tunnels with OVS:
bc6b9e64-11d6-415f-a82b-5d8a61ed3fbd
Bridge "br0"
Port "br0"
Interface "br0"
type: internal
Port "mgmt0"
Interface "mgmt0"
type: internal
Port "bond0"
Interface "eth0"
Interface "eth1"
Bridge "br1"
Port "br1"
Interface "br1"
type: internal
Port "tep0"
Interface "tep0"
type: internal
Port "bond1"
Interface "eth2"
Interface "eth3"
Bridge "br-int"
Port "br-int"
Interface "br-int"
type: internal
Port "gre0"
Interface "gre0"
type: gre
options: {remote_ip="192.168.1.100"}
ovs_version: "1.7.1"
In this configuration, we have three bridges. br0 uses a bond that contains eth0 and eth1; br1 uses a bond that contains eth2 and eth3; and br-int is an isolated bridge with no physical interfaces. We have two “custom” internal interfaces, mgmt0 (on br0) and tep0 (on br1), to which IP addresses have been assigned and which are successfully communicating across the network. We’ll assume that mgmt0 and tep0 are on different subnets, and that tep0 is assigned to the 192.168.1.0/24 subnet.
How does traffic flow in this scenario?
1. Traffic from guest domains attached to br0: The behavior here is as it has been in previous configurations—guest domains attached to br0 will communicate across the physical interfaces in the bond.
2. Traffic from the Linux host: As it has been in previous scenarios, traffic from the Linux host is driven by the host’s TCP/IP stack and IP routing table(s). Because mgmt0 and tep0 are on different subnets, traffic from the Linux host will go out either br0 (for traffic moving through mgmt0) or br1 (for traffic moving through tep0), and thus will utilize the corresponding physical interfaces in the bonds on those bridges.
3. Traffic from guest domains attached to br-int: Because the GRE tunnel is on the 192.168.1.0/24 subnet, traffic for the GRE tunnel—which is created and maintained by the OVS process on the Linux host itself—will travel through tep0, which is attached to br1. Thus, the physical interfaces eth2 and eth3 would be leveraged for the GRE tunnel traffic.
Summary
The key takeaway from this post, in my mind, is understanding where traffic originates, and separating the idea of OVS as a switching mechanism (to handle guest domain traffic) as well as a Linux host process itself (to create and maintain tunnels between hosts).
Hopefully this information is helpful. I am, of course, completely open to your comments, questions, and corrections, so feel free to speak up in the comments below. Courteous comments are always welcome!
[转]Examining Open vSwitch Traffic Patterns的更多相关文章
- Examining Open vSwitch Traffic Patterns
In this post, I want to provide some additional insight on how the use of Open vSwitch (OVS) affects ...
- (转载)研究openvswitch的流量模式
最近又开始弄openvswitch,网上也有不少的资料,但是发觉都集中在openvswitch安装及简单使用或者一些原码分析,从心里来讲,感觉这些和心里得到的差距有点大啊,其实更希望能类似资料在ope ...
- Enhancing the Scalability of Memcached
原文地址: https://software.intel.com/en-us/articles/enhancing-the-scalability-of-memcached-0 1 Introduct ...
- 【译】在ASP.Net和IIS中删除不必要的HTTP响应头
引入 每次当浏览器向Web服务器发起一个请求的时,都会伴随着一些HTTP头的发送.而这些HTTP头是用于给Web服务器提供一些额外信息以便于处理请求.比如说吧.如果浏览器支持压缩功能,则浏览器会发送A ...
- 在ASP.Net和IIS中删除不必要的HTTP响应头
引入 每次当浏览器向Web服务器发起一个请求的时,都会伴随着一些HTTP头的发送.而这些HTTP头是用于给Web服务器提供一些额外信息以便于处理请求.比如说吧.如果浏览器支持压缩功能,则浏览器会发送A ...
- Optimal Logging
by Anthony Vallone How long does it take to find the root cause of a failure in your system? Five mi ...
- HDU 2722 Here We Go(relians) Again (spfa)
Here We Go(relians) Again Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/ ...
- Here We Go(relians) Again
Here We Go(relians) Again Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...
- Revisiting Network Support for RDMA
重新审视RDMA的网络支持 本文为SIGCOMM 2018会议论文. 笔者翻译了该论文.由于时间仓促,且笔者英文能力有限,错误之处在所难免:欢迎读者批评指正. 本文及翻译版本仅用于学习使用.如果有任何 ...
随机推荐
- STM32的命名规范
STM32F407VET6 STM32F407代表的是芯片的型号后面的字符表示芯片的信息 V这一项代表引脚数,其中T代表36脚,C代表48脚,R代表64脚,V代表100脚,Z代表144脚,I代表176 ...
- 百度地图缩小后marker点的图标移动
遇到的坑:使用百度地图,当地图缩小时,marker点的自定义图标会出现偏移的问题,marker点的信息窗口会出现闪烁问题. 原因:1.anchor是定位点距离图片左上角的偏移量.如果不给anchor的 ...
- 手工脱壳之AsPack压缩脱壳-随机基址
一.工具及壳介绍二.脱壳1.ESP定律脱壳2.单步跟踪脱壳3.基址重定位的修复 一.工具及壳介绍 使用工具:Ollydbg.PEID.ImportREC.LoadPE.010 Editor 查看待脱壳 ...
- ES6基本使用
var let 度可用于声明变量. 区别:1.let:只在let命令所在代码块内有效 2.let 不存在变量提升(内部影响不到外部) var b = []; ;j<;j++){ let d=j; ...
- 软工作业1—java实现wc.exe
github项目地址 https://github.com/liyizhu/wc.exe WC 项目要求 基本功能列表: wc.exe -c file.c //返回文件 file.c 的字符数 ...
- 解决Kettle与Kerberos集成问题
本文目的:记录Kerberos环境下,通过Kettle将MySQL数据清洗到HDFS过程解决的2个问题,希望对大家有所帮助. Kettle版本:pdi-ce-7.1.0.0-12 1.在Kerbero ...
- oo第四次博客总结
1.论述测试与正确性论证的效果差异,比较其优缺点 测试:通过大量测试样例覆盖测试代码,来检测代码功能的实现是否正确是否完善.测试一个程序的正常输入比较容易,但难点就在于大量的非法输入,测试只能发现bu ...
- MySQL语法大全_自己整理的学习笔记(MySQL语句 整理二)
select * from emp; #注释 #--------------------------- #----命令行连接MySql--------- #启动mysql服务器 net start m ...
- S系统的不好的实践
多个项目 多个分支放在一个SVN里边维护,导致多股力量并行开发时候的代码覆盖的风险可能性很大,, 好的实践是维护独立的SVN,彼此分离开来
- Java中如何创建一个新的对象的/Creating Objects/
The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't ...