VM跨主机通信ovs配置

如果位于不同物理主机上的两个VM需要通信,那么底层的虚拟交换机ovs需要配置tunnel端口。
OVS中支持添加隧道(Tunnel)端口,常见隧道技术有两种gre或vxlan。隧道技术是在现有的物理网络之上构建一层虚拟网络,上层应用只与虚拟网络相关,以此实现的虚拟网络比物理网络配置更加灵活,并能够实现跨主机的L2通信以及必要的租户隔离。不同隧道技术其大体思路均是将以太网报文使用隧道协议封装,然后使用底层IP网络转发封装后的数据包,其差异性在于选择和构造隧道的协议不同。Tunnel在OpenStack中用作实现大二层网络以及租户隔离,以应对公有云大规模,多租户的复杂网络环境。

OpenStack是多节点结构,同一子网的虚拟机可能被调度到不同计算节点上,因此需要有隧道技术来保证这些同子网不同节点上的虚拟机能够二层互通,就像他们连接在同一个交换机上,同时也要保证能与其它子网隔离。

OVS在计算和网络节点上建立隧道Port来连接各节点上的网桥br-int(br-int是举例的网桥名),这样所有网络和计算节点上的br-int互联形成了一个大的虚拟的跨所有节点的逻辑网桥(内部靠tunnel id或VNI隔离不同子网),这个逻辑网桥对虚拟机和qrouter是透明的,它们觉得自己连接到了一个大的br-int上。从某个计算节点虚拟机发出的数据包会被封装进隧道通过底层网络传输到目的主机然后解封装。

下面是在两台主机(192.168.7.21和192.168.7.23)测试创建vxlan隧道的配置

主机192.168.7.21上
ovs-vsctl add-br br-vxlan
#主机192.168.7.23上
ovs-vsctl add-br br-vxlan
#主机192.168.7.21上添加连接到7.23的Tunnel Port
ovs-vsctl add-port br-vxlan tun0 -- set Interface tun0 type=vxlan options:remote_ip=192.168.7.23
#主机192.168.7.23上添加连接到7.21的Tunnel Port
ovs-vsctl add-port br-vxlan tun0 -- set Interface tun0 type=vxlan options:remote_ip=192.168.7.21

然后,两个主机上桥接到br-vxlan的虚拟机就像连接到同一个交换机一样,可以实现跨主机的L2连接,同时又完全与物理网络隔离。

ovs的其他概念参考:https://opengers.github.io/openstack/openstack-base-use-openvswitch/

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OpenStack is an open-source cloud computing platform that provides infrastructure as a service (IaaS) for creating, deploying, and managing virtual machines and other resources. Open vSwitch (OVS) is a virtual switch used in OpenStack to provide network connectivity to virtual machines. Here's a general outline of the steps to configure OVS in OpenStack: 1. Install OpenStack: Follow the official installation guide for the OpenStack release you are using. 2. Install OVS: On each node in the OpenStack environment, install OVS. You can use a package manager such as apt-get or yum to install OVS. 3. Configure OVS: OVS needs to be configured on each node. You can use the following command to configure OVS to use the Open vSwitch database management system (OVSDB): ``` sudo ovs-vsctl set-manager tcp:<controller-IP>:6640 ``` 4. Create networks: In OpenStack, you can create virtual networks using Neutron, the OpenStack networking service. To create a virtual network, you need to create a network, a subnet, and a router. You can use the OpenStack CLI or the Horizon web interface to create these components. 5. Connect instances to the network: Once you have created a virtual network, you can launch instances and connect them to the network. You can do this by creating a network port and attaching it to an instance. 6. Configure security groups: OpenStack provides security groups to control access to instances. You can configure security groups to allow or deny access to instances based on IP addresses, protocols, and ports. Note that this is just a general outline of the steps to configure OVS in OpenStack, and the exact steps may vary depending on the version of OpenStack you are using and the configuration of your environment. For more information and detailed instructions, refer to the OpenStack documentation.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值