玩转Openvswitch第八站:Interface和Tunnel(下)

以下内容已屏蔽图片优化访问速度
IPSec顾名思义,安全隧道,意味着下面三个方面:
信息完整性——认证
信息的私密性——加密
信息不会被Replay


[IMG]
所以IPSec有一套协议来保证这三点。



[IMG]


IPSec隧道的连接也有两端,两端之间多通过对称加密来保证私密性。


所以两端都要建立Security Association,保存两边约定好的加密协议,对称秘钥,对方的IP地址等,对阵的秘钥要通过协议互换Exchange。


双方建立了连接之后,就可以对原始的包进行认证和加密了。



[IMG]


在原始的包之外,加入一个ESP的包头做加密。在外层的proto处的协议指定为ESP。


[IMG]


IPSec隧道常用于两个VPC之间的打通。


或者用于公有云和私有云之间的打通。如AWS里面:
[IMG]


配置这个VPN,需要配置下面三种东西。



[IMG]


一个是IKE,就是秘钥交换。


[IMG]


一个是IPSec


[IMG]


一个是Tunnel


[IMG]
GRE和IPSec一起使用,则包结构如下。

[IMG]


又到了做实验的时候了。



[IMG]


创建网桥如下:


[IMG]


在虚拟机Instance01上


ovs-vsctl add-br testbr
ifconfig testbr 10.0.0.1/24
ovs-vsctl add-port testbr gre0 -- set Interface gre0 type=gre options:local_ip=192.168.100.100 options:remote_ip=192.168.100.101
ovs-vsctl add-port testbr vxlan0 -- set Interface vxlan0 type=vxlan options:local_ip=192.168.100.100 options:remote_ip=192.168.100.102


在虚拟机Instance02上


ovs-vsctl add-br testbr
ifconfig testbr 10.0.0.2/24
ovs-vsctl add-port testbr gre0 -- set Interface gre0 type=gre options:local_ip=192.168.100.101 options:remote_ip=192.168.100.100
ovs-vsctl add-port testbr ipsec0 -- set Interface ipsec0 type=ipsec_gre options:local_ip=192.168.100.101 options:remote_ip=192.168.100.102 options:psk=password


在虚拟机Instance03上


ovs-vsctl add-br testbr
ifconfig testbr 10.0.0.3/24
ovs-vsctl add-port testbr vxlan0 -- set Interface vxlan0 type=vxlan options:local_ip=192.168.100.102 options:remote_ip=192.168.100.100
ovs-vsctl add-port testbr ipsec0 -- set Interface ipsec0 type=ipsec_gre options:local_ip=192.168.100.102 options:remote_ip=192.168.100.101 options:psk=password


不好,出现了环,没关系enable STP


ovs-vsctl set Bridge testbr stp_enable=true


监听Instance01的eth0: tcpdump -n -e -i eth0


[IMG]


监听Instance02的eth0: tcpdump -n -e -i eth0


[IMG]


监听Instance03的eth0: tcpdump -n -e -i eth0


[IMG]


最后说一下STP,全称Spanning Tree Protocol,即通过协议,将一个有环的二层网络变成一颗树。
号称了解mesos双层调度的你,先来回答下面这五个问题! 互联网人回乡求生指南(再改是狗版) 一个快被中国制造搞死的“世纪大骗局”… 半个故宫都是他捐献的,可我总觉得国家对不起他 椰树椰汁是“丰胸神器”?当地工商部门开始查了……
好看吗?
总执行时间0.0129241943359375,文章查询时间0.001932382583618164,分类查询时间0.010066032409667969,其他脚本8.678436279296875e-05,模板渲染0.0008389949798583984