深入理解 Neutron -- OpenStack 网络实现(3):VXLAN 模式
2015-07-22 09:42
639 查看
问题导读
1.VXLAN模式下,网络的架构跟GRE模式类似,他们的不同点在什么地方?
2.网络节点的作用是什么?
3.tap-xxx、qr-xxx是指什么?
接上篇:深入理解Neutron--OpenStack网络实现(2):VLAN模式
[align=left]VXLAN模式下,网络的架构跟GRE模式类似,所不同的是,不同节点之间通过VXLAN隧道互通,即虚拟化层是采用的VXLAN协议。[/align]
[align=left]基本结构如下图所示。[/align]
<ignore_js_op>
[align=left]其中,节点网络配置如下所示,注意数据网络接口需要IP地址,因为是隧道协议需要底下的三层转发支持。[/align]
[align=left]控制节点[/align]
eth0:9.186.100.77/24作为管理网络(同时也是公共网络)。
eth1:10.0.100.77/24作为数据网络接口。
[align=left]计算节点[/align]
eth0:9.186.100.88/24作为管理网络(同时也是公共网络)。
eth1:10.0.100.88/24作为数据网络接口。
计算节点
[align=left]计算节点上运行着虚拟机。如果不启用DVR特性,则所有的网络相关的服务,都在网络节点上进行。即计算节点上的网络只需要实现二层转发即可。[/align]
br-int
[align=left]集成网桥br-int规则比较简单,作为一个正常的二层交换机使用。无论下面虚拟化层是哪种技术实现,集成网桥是看不到的,只知道根据vlan和mac进行转发。[/align]
[align=left]所连接接口除了从安全网桥过来的qvo-xxx(每个虚拟机会有一个),就是一个往外的patch-tun接口,连接到br-tun网桥。[/align]
[align=left]其中,qvo-xxx接口上会为每个网络分配一个内部vlan号,比如这里是同一个网络启动了两台虚机,所以tag都为1。[/align]
[Bashshell]纯文本查看复制代码
转发规则表0中是对所有包进行NORMAL,表23中是所有包直接丢弃(是否后面将安全组规则在这里实现?)。
[Bashshell]纯文本查看复制代码
br-tun
[align=left]br-tun作为虚拟化层网桥,规则就要复杂一些。要将内部过来的网包进行合理甄别,内部带着正确vlantag过来的,从正确的tunnel扔出去;外面带着正确tunnel号过来的,要改到对应的内部vlantag扔到里面。[/align]
[Bashshell]纯文本查看复制代码
[align=left]其中,端口br-tun是内部端口,vxlan-0a00644d这样的端口是向其它节点发包时候的VXLAN隧道端点,patch-int端口通过一条管道连接到br-int上的patch-tun端口。[/align]
[align=left]正常情况下,虚拟机的流量经过br-int转发,经过patch-tun端口,抵达patch-int端口,从而到达br-tun网桥,该网桥根据自身规则将合适的网包经过VXLAN隧道送出去。[/align]
[Bashshell]纯文本查看复制代码
[align=left]这些规则组成如下图所示的转发逻辑。[/align]
<ignore_js_op>
表0
[align=left]先看table0中的规则[/align]
[Bashshell]纯文本查看复制代码
[align=left]从1端口(patch-int)进来的网包,扔给表2处理,从2端口(vxlan-0a00644d)进来的网包,扔给表4处理。即一个处理来自内部vm的,一个处理来自外面的vxlan隧道的。[/align]
表2
[align=left]对于内部包,表2中规则为[/align]
[Bashshell]纯文本查看复制代码
[align=left]即里面过来的单播包,扔给表20处理;多播和广播包,扔给表22处理。[/align]
表3
[align=left]丢弃所有包。[/align]
[Bashshell]纯文本查看复制代码
表4
[align=left]对于外部来的数据,表4中规则为[/align]
[Bashshell]纯文本查看复制代码
[align=left]匹配给定的tunnel号,添加对应的vlan号,扔给表10去学习一下后扔到br-int网桥。[/align]
表10
[Bashshell]纯文本查看复制代码
[align=left]主要作用是学习外部(从tunnel)进来的包,往表20中添加对返程包的正常转发规则,并且从patch-int扔给br-int。[/align]
[align=left]使用了openvswitch的learn动作。该动作能根据处理的流来动态修改其它表中的规则。[/align]
[align=left]具体来看learn规则。[/align]
table=20说明是修改表20中的规则,后面是添加的规则内容;
NXM_OF_VLAN_TCI[0..11],匹配跟当前流同样的VLAN头,其中NXM是NiciraExtensibleMatch的缩写;
NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],包的目的mac跟当前流的源mac匹配;
load:0->NXM_OF_VLAN_TCI[],将vlan号改为0;
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],将tunnel号修改为当前的tunnel号;
output:NXM_OF_IN_PORT[],从当前入口发出。
表20
[Bashshell]纯文本查看复制代码
[align=left]其中,第一条规则就是表10学习来的结果。对于vlan号为1,目标mac是fa:16:3e:83:95:fa(之前,我们从虚拟机内ping10.0.0.1,这个mac作为源mac从tunnel来过)的网包,去掉vlan号,添加当时的vxlan号,并从tunnel发出。[/align]
[align=left]对于没学习到规则的网包,则扔给表22处理。[/align]
表22
[Bashshell]纯文本查看复制代码
表22检查如果vlan号正确,则去掉vlan头后从tunnel扔出去。
网络节点
[align=left]网络节点担负着进行网络服务的任务,包括DHCP、路由和高级网络服务等。一般包括三个网桥:br-tun、br-int和br-ex。[/align]
[Bashshell]纯文本查看复制代码
br-tun
[align=left]跟计算节点类似,br-tun作为虚拟化层网桥。要将内部过来的网包进行合理甄别,内部带着正确vlantag过来的,从正确的tunnel扔出去;外面带着正确tunnel号过来的,要改到对应的内部vlantag扔到里面。[/align]
[align=left]包括两个接口,跟其它接点形成tunnel的vxlan-xxx端口,以及跟br-int互连的patch-int端口。[/align]
[Bashshell]纯文本查看复制代码
[align=left]其中,端口br-tun是内部端口,vxlan-0a00644d这样的端口是向其它节点发包时候的VXLAN隧道端点,patch-int端口通过一条管道连接到br-int上的patch-tun端口。[/align]
[align=left]查看br-tun上的转发规则。[/align]
[Bashshell]纯文本查看复制代码
[align=left]这些规则跟计算节点上的br-tun网桥规则类似,组成如下图所示的转发逻辑。[/align]
<ignore_js_op>
表0
[align=left]先看table0中的规则[/align]
[Bashshell]纯文本查看复制代码
[align=left]从1端口(patch-int)进来的网包,扔给表2处理,从2端口(vxlan-0a00644d)进来的网包,扔给表4处理。即一个处理来自内部br-int的(这上面挂载着所有的网络服务,包括路由、DHCP等),一个处理来自外面的VXLAN隧道的。[/align]
表2
[align=left]对于内部包,表2中规则为[/align]
[Bashshell]纯文本查看复制代码
[align=left]即里面过来的单播包,扔给表20处理;多播和广播包,扔给表22处理。[/align]
表3
[align=left]丢弃所有包。[/align]
[Bashshell]纯文本查看复制代码
表4
[align=left]对于外部来的数据,表4中规则为[/align]
[Bashshell]纯文本查看复制代码
[align=left]匹配给定的tunnel号,添加对应的vlan号,扔给表10去学习一下后扔到br-int网桥。[/align]
表10
[Bashshell]纯文本查看复制代码
[align=left]主要作用是学习外部(从tunnel)进来的包,往表20中添加对返程包的正常转发规则,并且从patch-int扔给br-int。[/align]
[align=left]使用了openvswitch的learn动作。该动作能根据处理的流来动态修改其它表中的规则。[/align]
[align=left]具体来看learn规则。[/align]
table=20说明是修改表20中的规则,后面是添加的规则内容;
NXM_OF_VLAN_TCI[0..11],匹配跟当前流同样的VLAN头,其中NXM是NiciraExtensibleMatch的缩写;
NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],包的目的mac跟当前流的源mac匹配;
load:0->NXM_OF_VLAN_TCI[],将vlan号改为0;
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],将tunnel号修改为当前的tunnel号;
output:NXM_OF_IN_PORT[],从当前入口发出。
表20
[Bashshell]纯文本查看复制代码
[align=left]其中,第一条规则就是表10学习来的结果。对于vlan号为1,目标mac是fa:16:3e:83:95:fa(之前,我们从虚拟机内ping10.0.0.1,这个mac作为源mac从tunnel来过)的网包,去掉vlan号,添加当时的vxlan号,并从tunnel发出。[/align]
[align=left]对于没学习到规则的网包,则扔给表22处理。[/align]
表22
[Bashshell]纯文本查看复制代码
表22检查如果vlan号正确,则去掉vlan头后从tunnel扔出去。
br-int
[align=left]集成网桥br-int规则比较简单,作为一个正常的二层交换机使用。无论下面虚拟化层是哪种技术实现,集成网桥是看不到的,只知道根据vlan和mac进行转发。[/align]
[align=left]所连接接口包括:[/align]
tap-xxx,连接到网络DHCP服务的命名空间;
qr-xxx,连接到路由服务的命名空间;
往外的patch-tun接口,连接到br-tun网桥。
[align=left]其中网络服务接口上会绑定内部vlan号,每个号对应一个网络。[/align]
[Bashshell]纯文本查看复制代码
转发规则表0中是对所有包进行NORMAL,表23中是所有包直接丢弃(是否后面将安全组规则在这里实现?)。
[Bashshell]纯文本查看复制代码
br-ex
[align=left]核心接口有两个。[/align]
[align=left]一个是挂载的物理接口上,如eth0,网包将从这个接口发送到外部网络上。[/align]
[align=left]另外一个是qg-xxx这样的接口,是连接到router服务的网络名字空间中,里面绑定一个路由器的外部IP,作为nAT时候的地址,另外,网络中的floatingIP也放在这个网络名字空间中。[/align]
[Bashshell]纯文本查看复制代码
网桥的规则也很简单,作为一个正常的二层转发设备即可。
[Bashshell]纯文本查看复制代码
原文http://www.aboutyun.com/thread-13027-1-1.html
1.VXLAN模式下,网络的架构跟GRE模式类似,他们的不同点在什么地方?
2.网络节点的作用是什么?
3.tap-xxx、qr-xxx是指什么?
接上篇:
[align=left]VXLAN模式下,网络的架构跟GRE模式类似,所不同的是,不同节点之间通过VXLAN隧道互通,即虚拟化层是采用的VXLAN协议。[/align]
[align=left]基本结构如下图所示。[/align]
<ignore_js_op>
[align=left]其中,节点网络配置如下所示,注意数据网络接口需要IP地址,因为是隧道协议需要底下的三层转发支持。[/align]
[align=left]控制节点[/align]
eth0:9.186.100.77/24作为管理网络(同时也是公共网络)。
eth1:10.0.100.77/24作为数据网络接口。
[align=left]计算节点[/align]
eth0:9.186.100.88/24作为管理网络(同时也是公共网络)。
eth1:10.0.100.88/24作为数据网络接口。
计算节点
[align=left]计算节点上运行着虚拟机。如果不启用DVR特性,则所有的网络相关的服务,都在网络节点上进行。即计算节点上的网络只需要实现二层转发即可。[/align]
br-int
[align=left]集成网桥br-int规则比较简单,作为一个正常的二层交换机使用。无论下面虚拟化层是哪种技术实现,集成网桥是看不到的,只知道根据vlan和mac进行转发。[/align]
[align=left]所连接接口除了从安全网桥过来的qvo-xxx(每个虚拟机会有一个),就是一个往外的patch-tun接口,连接到br-tun网桥。[/align]
[align=left]其中,qvo-xxx接口上会为每个网络分配一个内部vlan号,比如这里是同一个网络启动了两台虚机,所以tag都为1。[/align]
[Bashshell]纯文本查看复制代码
01 | Bridgebr-int |
02 | fail_mode:secure |
03 | Portbr-int |
04 | Interfacebr-int |
05 | type :internal |
06 | Port "qvoc4493802-43" |
07 | tag:1 |
08 | Interface "qvoc4493802-43" |
09 | Portpatch-tun |
10 | Interfacepatch-tun |
11 | type :patch |
12 | options:{peer=patch-int} |
13 | Port "qvof47c62b0-db" |
14 | tag:1 |
15 | Interface "qvof47c62b0-db" |
[Bashshell]纯文本查看复制代码
01 | $ sudo ovs-ofctldump-flowsbr-int |
02 | NXST_FLOWreply(xid=0x4): |
03 | cookie=0x0,duration=52889.682s,table=0,n_packets=161,n_bytes=39290,idle_age=13,priority=1actions=NORMAL |
04 | cookie=0x0,duration=52889.451s,table=23,n_packets=0,n_bytes=0,idle_age=52889,priority=0actions=drop |
[align=left]br-tun作为虚拟化层网桥,规则就要复杂一些。要将内部过来的网包进行合理甄别,内部带着正确vlantag过来的,从正确的tunnel扔出去;外面带着正确tunnel号过来的,要改到对应的内部vlantag扔到里面。[/align]
[Bashshell]纯文本查看复制代码
01 | Bridgebr-tun |
02 | fail_mode:secure |
03 | Port "vxlan-0a00644d" |
04 | Interface "vxlan-0a00644d" |
05 | type :vxlan |
06 | options:{df_default= "true" ,in_key=flow,local_ip= "10.0.100.88" ,out_key=flow,remote_ip= "10.0.100.77" } |
07 | Portpatch-int |
08 | Interfacepatch-int |
09 | type :patch |
10 | options:{peer=patch-tun} |
11 | Portbr-tun |
12 | Interfacebr-tun |
13 | type :internal |
[align=left]正常情况下,虚拟机的流量经过br-int转发,经过patch-tun端口,抵达patch-int端口,从而到达br-tun网桥,该网桥根据自身规则将合适的网包经过VXLAN隧道送出去。[/align]
[Bashshell]纯文本查看复制代码
01 | $ sudo ovs-ofctldump-flowsbr-tun |
02 | NXST_FLOWreply(xid=0x4): |
03 | cookie=0x0,duration=329.194s,table=0,n_packets=31,n_bytes=2906,idle_age=29,priority=1,in_port=1actions=resubmit(,2) |
04 | cookie=0x0,duration=325.847s,table=0,n_packets=14,n_bytes=1591,idle_age=33,priority=1,in_port=2actions=resubmit(,4) |
05 | cookie=0x0,duration=328.954s,table=0,n_packets=6,n_bytes=480,idle_age=321,priority=0actions=drop |
06 | cookie=0x0,duration=328.712s,table=2,n_packets=9,n_bytes=694,idle_age=33,priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,20) |
07 | cookie=0x0,duration=328.465s,table=2,n_packets=22,n_bytes=2212,idle_age=29,priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,22) |
08 | cookie=0x0,duration=328.223s,table=3,n_packets=0,n_bytes=0,idle_age=328,priority=0actions=drop |
09 | cookie=0x0,duration=50.703s,table=4,n_packets=12,n_bytes=1451,idle_age=33,priority=1,tun_id=0x3e9actions=mod_vlan_vid:1,resubmit(,10) |
10 | cookie=0x0,duration=327.979s,table=4,n_packets=2,n_bytes=140,idle_age=94,priority=0actions=drop |
11 | cookie=0x0,duration=327.742s,table=10,n_packets=12,n_bytes=1451,idle_age=33,priority=1actions=learn(table=20,hard_timeout=300,priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:0->NXM_OF_VLAN_TCI[],load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],output:NXM_OF_IN_PORT[]),output:1 |
12 | cookie=0x0,duration=38.551s,table=20,n_packets=9,n_bytes=694,hard_timeout=300,idle_age=33,hard_age=33,priority=1,vlan_tci=0x0001/0x0fff,dl_dst=fa:16:3e:83:95:faactions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 |
13 | cookie=0x0,duration=327.504s,table=20,n_packets=0,n_bytes=0,idle_age=327,priority=0actions=resubmit(,22) |
14 | cookie=0x0,duration=50.94s,table=22,n_packets=11,n_bytes=1334,idle_age=29,dl_vlan=1actions=strip_vlan,set_tunnel:0x3e9,output:2 |
15 | cookie=0x0,duration=327.261s,table=22,n_packets=10,n_bytes=808,idle_age=51,priority=0actions=drop |
<ignore_js_op>
表0
[align=left]先看table0中的规则[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=329.194s,table=0,n_packets=31,n_bytes=2906,idle_age=29,priority=1,in_port=1actions=resubmit(,2) |
02 | cookie=0x0,duration=325.847s,table=0,n_packets=14,n_bytes=1591,idle_age=33,priority=1,in_port=2actions=resubmit(,4) |
03 | cookie=0x0,duration=328.954s,table=0,n_packets=6,n_bytes=480,idle_age=321,priority=0actions=drop |
表2
[align=left]对于内部包,表2中规则为[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=53316.397s,table=2,n_packets=0,n_bytes=0,idle_age=53316,priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,20) |
02 | cookie=0x0,duration=53316.162s,table=2,n_packets=161,n_bytes=39562,idle_age=422,priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,22) |
表3
[align=left]丢弃所有包。[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=328.223s,table=3,n_packets=0,n_bytes=0,idle_age=328,priority=0actions=drop |
[align=left]对于外部来的数据,表4中规则为[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=50.703s,table=4,n_packets=12,n_bytes=1451,idle_age=33,priority=1,tun_id=0x3e9actions=mod_vlan_vid:1,resubmit(,10) |
02 | cookie=0x0,duration=327.979s,table=4,n_packets=2,n_bytes=140,idle_age=94,priority=0actions=drop |
表10
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=327.742s,table=10,n_packets=12,n_bytes=1451,idle_age=33,priority=1actions=learn(table=20,hard_timeout=300,priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:0->NXM_OF_VLAN_TCI[],load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],output:NXM_OF_IN_PORT[]),output:1 |
[align=left]使用了openvswitch的learn动作。该动作能根据处理的流来动态修改其它表中的规则。[/align]
[align=left]具体来看learn规则。[/align]
table=20说明是修改表20中的规则,后面是添加的规则内容;
NXM_OF_VLAN_TCI[0..11],匹配跟当前流同样的VLAN头,其中NXM是NiciraExtensibleMatch的缩写;
NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],包的目的mac跟当前流的源mac匹配;
load:0->NXM_OF_VLAN_TCI[],将vlan号改为0;
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],将tunnel号修改为当前的tunnel号;
output:NXM_OF_IN_PORT[],从当前入口发出。
表20
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=38.551s,table=20,n_packets=9,n_bytes=694,hard_timeout=300,idle_age=33,hard_age=33,priority=1,vlan_tci=0x0001/0x0fff,dl_dst=fa:16:3e:83:95:faactions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 |
02 | cookie=0x0,duration=327.504s,table=20,n_packets=0,n_bytes=0,idle_age=327,priority=0actions=resubmit(,22) |
[align=left]对于没学习到规则的网包,则扔给表22处理。[/align]
表22
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=50.94s,table=22,n_packets=11,n_bytes=1334,idle_age=29,dl_vlan=1actions=strip_vlan,set_tunnel:0x3e9,output:2 |
02 | cookie=0x0,duration=327.261s,table=22,n_packets=10,n_bytes=808,idle_age=51,priority=0actions=drop |
网络节点
[align=left]网络节点担负着进行网络服务的任务,包括DHCP、路由和高级网络服务等。一般包括三个网桥:br-tun、br-int和br-ex。[/align]
[Bashshell]纯文本查看复制代码
01 | $ sudo ovs-vsctlshow |
02 | 49761e8e-031f-4a60-b838-28bb82aac7b7 |
03 | Bridgebr-int |
04 | fail_mode:secure |
05 | Portbr-int |
06 | Interfacebr-int |
07 | type :internal |
08 | Port "qr-694450d6-f6" |
09 | tag:1 |
10 | Interface "qr-694450d6-f6" |
11 | type :internal |
12 | Port "tap13685e28-b0" |
13 | tag:1 |
14 | Interface "tap13685e28-b0" |
15 | type :internal |
16 | Portpatch-tun |
17 | Interfacepatch-tun |
18 | type :patch |
19 | options:{peer=patch-int} |
20 | Bridgebr-ex |
21 | Portbr-ex |
22 | Interfacebr-ex |
23 | type :internal |
24 | Port "qg-e76de35e-90" |
25 | Interface "qg-e76de35e-90" |
26 | type :internal |
27 | Bridgebr-tun |
28 | fail_mode:secure |
29 | Portbr-tun |
30 | Interfacebr-tun |
31 | type :internal |
32 | Port "vxlan-0a006458" |
33 | Interface "vxlan-0a006458" |
34 | type :vxlan |
35 | options:{df_default= "true" ,in_key=flow,local_ip= "10.0.100.77" ,out_key=flow,remote_ip= "10.0.100.88" } |
36 | Portpatch-int |
37 | Interfacepatch-int |
38 | type :patch |
39 | options:{peer=patch-tun} |
40 | ovs_version: "2.0.2" |
[align=left]跟计算节点类似,br-tun作为虚拟化层网桥。要将内部过来的网包进行合理甄别,内部带着正确vlantag过来的,从正确的tunnel扔出去;外面带着正确tunnel号过来的,要改到对应的内部vlantag扔到里面。[/align]
[align=left]包括两个接口,跟其它接点形成tunnel的vxlan-xxx端口,以及跟br-int互连的patch-int端口。[/align]
[Bashshell]纯文本查看复制代码
01 | Bridgebr-tun |
02 | fail_mode:secure |
03 | Portbr-tun |
04 | Interfacebr-tun |
05 | type :internal |
06 | Port "vxlan-0a006458" |
07 | Interface "vxlan-0a006458" |
08 | type :vxlan |
09 | options:{df_default= "true" ,in_key=flow,local_ip= "10.0.100.77" ,out_key=flow,remote_ip= "10.0.100.88" } |
10 | Portpatch-int |
11 | Interfacepatch-int |
12 | type :patch |
13 | options:{peer=patch-tun} |
[align=left]查看br-tun上的转发规则。[/align]
[Bashshell]纯文本查看复制代码
01 | $ sudo ovs-ofctldump-flowsbr-tun |
02 | NXST_FLOWreply(xid=0x4): |
03 | cookie=0x0,duration=422.153s,table=0,n_packets=1073,n_bytes=107845,idle_age=96,priority=1,in_port=1actions=resubmit(,2) |
04 | cookie=0x0,duration=185.009s,table=0,n_packets=1076,n_bytes=102922,idle_age=96,priority=1,in_port=2actions=resubmit(,4) |
05 | cookie=0x0,duration=421.853s,table=0,n_packets=6,n_bytes=480,idle_age=62414,priority=0actions=drop |
06 | cookie=0x0,duration=421.552s,table=2,n_packets=1047,n_bytes=105725,idle_age=96,priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,20) |
07 | cookie=0x0,duration=421.252s,table=2,n_packets=26,n_bytes=2120,idle_age=61953,priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,22) |
08 | cookie=0x0,duration=420.939s,table=3,n_packets=0,n_bytes=0,idle_age=62420,priority=0actions=drop |
09 | cookie=0x0,duration=394.249s,table=4,n_packets=1076,n_bytes=102922,idle_age=96,priority=1,tun_id=0x3e9actions=mod_vlan_vid:1,resubmit(,10) |
10 | cookie=0x0,duration=420.628s,table=4,n_packets=0,n_bytes=0,idle_age=62420,priority=0actions=drop |
11 | cookie=0x0,duration=420.304s,table=10,n_packets=1076,n_bytes=102922,idle_age=96,priority=1actions=learn(table=20,hard_timeout=300,priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:0->NXM_OF_VLAN_TCI[],load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],output:NXM_OF_IN_PORT[]),output:1 |
12 | cookie=0x0,duration=1314.149s,table=20,n_packets=1006,n_bytes=101338,hard_timeout=300,idle_age=96,hard_age=95,priority=1,vlan_tci=0x0001/0x0fff,dl_dst=fa:16:3e:52:7a:f2actions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 |
13 | cookie=0x0,duration=419.977s,table=20,n_packets=0,n_bytes=0,idle_age=62419,priority=0actions=resubmit(,22) |
14 | cookie=0x0,duration=184.683s,table=22,n_packets=3,n_bytes=230,idle_age=61953,dl_vlan=1actions=strip_vlan,set_tunnel:0x3e9,output:2 |
15 | cookie=0x0,duration=419.668s,table=22,n_packets=23,n_bytes=1890,idle_age=61961,priority=0actions=drop |
<ignore_js_op>
表0
[align=left]先看table0中的规则[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=422.153s,table=0,n_packets=1073,n_bytes=107845,idle_age=96,priority=1,in_port=1actions=resubmit(,2) |
02 | cookie=0x0,duration=185.009s,table=0,n_packets=1076,n_bytes=102922,idle_age=96,priority=1,in_port=2actions=resubmit(,4) |
03 | cookie=0x0,duration=421.853s,table=0,n_packets=6,n_bytes=480,idle_age=62414,priority=0actions=drop |
表2
[align=left]对于内部包,表2中规则为[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=421.552s,table=2,n_packets=1047,n_bytes=105725,idle_age=96,priority=0,dl_dst=00:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,20) |
02 | cookie=0x0,duration=421.252s,table=2,n_packets=26,n_bytes=2120,idle_age=61953,priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00actions=resubmit(,22) |
表3
[align=left]丢弃所有包。[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=420.939s,table=3,n_packets=0,n_bytes=0,idle_age=62420,priority=0actions=drop |
[align=left]对于外部来的数据,表4中规则为[/align]
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=394.249s,table=4,n_packets=1076,n_bytes=102922,idle_age=96,priority=1,tun_id=0x3e9actions=mod_vlan_vid:1,resubmit(,10) |
02 | cookie=0x0,duration=420.628s,table=4,n_packets=0,n_bytes=0,idle_age=62420,priority=0actions=drop |
表10
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=420.304s,table=10,n_packets=1076,n_bytes=102922,idle_age=96,priority=1actions=learn(table=20,hard_timeout=300,priority=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:0->NXM_OF_VLAN_TCI[],load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],output:NXM_OF_IN_PORT[]),output:1 |
[align=left]使用了openvswitch的learn动作。该动作能根据处理的流来动态修改其它表中的规则。[/align]
[align=left]具体来看learn规则。[/align]
table=20说明是修改表20中的规则,后面是添加的规则内容;
NXM_OF_VLAN_TCI[0..11],匹配跟当前流同样的VLAN头,其中NXM是NiciraExtensibleMatch的缩写;
NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],包的目的mac跟当前流的源mac匹配;
load:0->NXM_OF_VLAN_TCI[],将vlan号改为0;
load:NXM_NX_TUN_ID[]->NXM_NX_TUN_ID[],将tunnel号修改为当前的tunnel号;
output:NXM_OF_IN_PORT[],从当前入口发出。
表20
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=1314.149s,table=20,n_packets=1006,n_bytes=101338,hard_timeout=300,idle_age=96,hard_age=95,priority=1,vlan_tci=0x0001/0x0fff,dl_dst=fa:16:3e:52:7a:f2actions=load:0->NXM_OF_VLAN_TCI[],load:0x3e9->NXM_NX_TUN_ID[],output:2 |
02 | cookie=0x0,duration=419.977s,table=20,n_packets=0,n_bytes=0,idle_age=62419,priority=0actions=resubmit(,22) |
[align=left]对于没学习到规则的网包,则扔给表22处理。[/align]
表22
[Bashshell]纯文本查看复制代码
01 | cookie=0x0,duration=184.683s,table=22,n_packets=3,n_bytes=230,idle_age=61953,dl_vlan=1actions=strip_vlan,set_tunnel:0x3e9,output:2 |
02 | cookie=0x0,duration=419.668s,table=22,n_packets=23,n_bytes=1890,idle_age=61961,priority=0actions=drop |
br-int
[align=left]集成网桥br-int规则比较简单,作为一个正常的二层交换机使用。无论下面虚拟化层是哪种技术实现,集成网桥是看不到的,只知道根据vlan和mac进行转发。[/align]
[align=left]所连接接口包括:[/align]
tap-xxx,连接到网络DHCP服务的命名空间;
qr-xxx,连接到路由服务的命名空间;
往外的patch-tun接口,连接到br-tun网桥。
[align=left]其中网络服务接口上会绑定内部vlan号,每个号对应一个网络。[/align]
[Bashshell]纯文本查看复制代码
01 | Bridgebr-int |
02 | fail_mode:secure |
03 | Portbr-int |
04 | Interfacebr-int |
05 | type :internal |
06 | Port "qr-694450d6-f6" |
07 | tag:1 |
08 | Interface "qr-694450d6-f6" |
09 | type :internal |
10 | Port "tap13685e28-b0" |
11 | tag:1 |
12 | Interface "tap13685e28-b0" |
13 | type :internal |
14 | Portpatch-tun |
15 | Interfacepatch-tun |
16 | type :patch |
17 | options:{peer=patch-int} |
[Bashshell]纯文本查看复制代码
01 | $ sudo ovs-ofctldump-flowsbr-int |
02 | NXST_FLOWreply(xid=0x4): |
03 | cookie=0x0,duration=52889.682s,table=0,n_packets=161,n_bytes=39290,idle_age=13,priority=1actions=NORMAL |
04 | cookie=0x0,duration=52889.451s,table=23,n_packets=0,n_bytes=0,idle_age=52889,priority=0actions=drop |
[align=left]核心接口有两个。[/align]
[align=left]一个是挂载的物理接口上,如eth0,网包将从这个接口发送到外部网络上。[/align]
[align=left]另外一个是qg-xxx这样的接口,是连接到router服务的网络名字空间中,里面绑定一个路由器的外部IP,作为nAT时候的地址,另外,网络中的floatingIP也放在这个网络名字空间中。[/align]
[Bashshell]纯文本查看复制代码
01 | Bridgebr-ex |
02 | Port "eth0" |
03 | Interface "eth0" |
04 | Portbr-ex |
05 | Interfacebr-ex |
06 | type :internal |
07 | Port "qg-e76de35e-90" |
08 | Interface "qg-e76de35e-90" |
09 | type :internal |
[Bashshell]纯文本查看复制代码
01 | $ sudo ovs-ofctldump-flowsbr-ex |
02 | NXST_FLOWreply(xid=0x4): |
03 | cookie=0x0,duration=75072.257s,table=0,n_packets=352212,n_bytes=85641148,idle_age=0,hard_age=65534,priority=0actions=NORMAL |
相关文章推荐
- HTTP协议详解(真的很经典)
- 深入理解 Neutron -- OpenStack 网络实现(2):VLAN 模式
- 深入理解 Neutron -- OpenStack 网络实现(1):GRE 模式
- 广东移动:各地主城区4G网络提速至220Mbps---OFweek通信网讯
- HDU 3549 Flow Problem(网络流模板题)
- 判断当前网络是否是wifi
- 【图论】[Tyvj 1153]间谍网络
- 大文件/数据网络传输方法总结(转载)
- 源泉书签,助您管理海量收藏。今日更新【里程碑】支持书签导出功能了,从此不怕网络书签丢失了,随时随地备份您的书签。
- 游戏引擎网络开发者的 64 做与不做 | Part 1 | 客户端方面
- 【算法笔记】总结 - 网络流 Edmonds-Karp 算法和 dinic 算法
- 安装OpenStack前CentOS7网络基本配置
- GO语言练习:实现最简单的http helloword 服务器
- 在Lighttpd服务器中运行Django应用的方法
- 网络工程师30个经典的电脑使用技巧
- 解决IISASP调用XmlHTTP出现msxml3.dll (0x80070005) 拒绝访问的错误
- 解决IISASP调用XmlHTTP出现msxml3.dll (0x80070005) 拒绝访问的错误
- 如何使用谷歌的网页删除请求工具?
- 今天实在忍不住,把极速星空的密码给破了
- 准备开发一个PSP专用的网站http://www.mypsp.com.cn