Ping未能在openstack实例中创建第二个ip

Ping未能在openstack实例中创建第二个ip,openstack,openstack-neutron,rdo,Openstack,Openstack Neutron,Rdo,我有RDO openstack环境在一台机器上进行测试。RDO是使用packstack--allinone命令安装的。我使用HOT创建了两个实例。一个带有cirros图像,另一个带有Fedora。Fedora实例有两个接口连接到同一网络,而cirros只有一个接口连接到同一网络。模板如下所示- heat_template_version: 2015-10-15 description: Simple template to deploy two compute instances resour

我有RDO openstack环境在一台机器上进行测试。RDO是使用
packstack--allinone
命令安装的。我使用HOT创建了两个实例。一个带有
cirros
图像,另一个带有
Fedora
Fedora
实例有两个接口连接到同一网络,而
cirros
只有一个接口连接到同一网络。模板如下所示-

heat_template_version: 2015-10-15
description: Simple template to deploy two compute instances

resources:

   local_net:
     type: OS::Neutron::Net

   local_signalling_subnet:
     type: OS::Neutron::Subnet
     properties:
       network_id: { get_resource: local_net }
       cidr: "50.0.0.0/24"
       ip_version: 4

   fed:
     type: OS::Nova::Server
     properties:
     image: fedora
     flavor: m1.small
     key_name: heat_key
     networks:
        - network: local_net
     networks:
        - port: { get_resource: fed_port1 }
        - port: { get_resource: fed_port2 }

   fed_port1:
     type: OS::Neutron::Port
     properties:
      network_id: { get_resource: local_net }

  fed_port2:
    type: OS::Neutron::Port
    properties:
      network_id: { get_resource: local_net }

  cirr:
    type: OS::Nova::Server
    properties:
       image: cirros
       flavor: m1.tiny
       key_name: heat_key
    networks:
       - network: local_net
    networks:
       - port: { get_resource: cirr_port }

 cirr_port:
    type: OS::Neutron::Port
    properties:
      network_id: { get_resource: local_net }

Fedora实例获得了两个IP(50.0.0.3和50.0.0.4)。Cirros的ip为50.0.0.5。我可以从
cirros
实例ping 50.0.0.3,但不能从ip 50.0.0.4。如果我在
Fedora
实例中手动关闭ip 50.0.0.3接口,那么只有我可以从
cirros
实例ping 50.0.0.4。中子配置中是否存在禁止同时ping到
Fedora
实例的两个IP的限制。请提供帮助。

发生这种情况是因为OpenStack networking(中子)完成了默认的防火墙屏蔽——如果数据包的源地址与分配给端口的IP地址不匹配,它只会丢弃端口上接收到的任何数据包

当cirros实例向50.0.0.4发送ping数据包时,fedora实例在IP地址为50.0.0.4的接口上接收到ping数据包。但是,当它响应cirros的IP地址50.0.0.5时,fedora机器上的linux网络堆栈有两个接口可供选择以发送响应(因为这两个接口都连接到同一网络)。在您的情况下,fedora选择在50.0.0.3上回复。然而,数据包中的源IP地址仍然是50.0.0.4,因此OpenStack网络层将其删除

一般建议在同一网络上不要有多个接口。如果您想为您的虚拟机使用同一网络中的多个IP地址,您可以在heat模板中使用“fixed_ips”选项:

fed_port1:
  type: OS::Neutron::Port
  properties:
    network_id: { get_resource: local_net }
    fixed_ips:
    - ip_address: "50.0.0.4"
    - ip_address: "50.0.0.3"
由于DHCP服务器只提供IP地址,fedora将只配置一个IP地址。您可以使用“IP addr add”命令将另一个IP添加到接口(请参阅):


根据您的建议,我尝试在
fedora
实例中添加两个固定IP。但是,即使这样做,
ip addr
命令在
fedora
中只显示一个ip,并且从
cirros
执行ping操作也只对一个ip成功。在每个接口上,DHCP服务器在neutron中只提供一个ip,因此默认情况下只配置一个ip。您可以使用“ip addr add”命令在fedora中向您的接口添加另一个ip地址。请参阅:
ip addr add 50.0.0.4/24 brd+dev eth0 label eth0:0
对于延迟的响应表示抱歉。你的解决方案很有魅力。谢谢
ip addr add 50.0.0.3/24 brd + dev eth0 label eth0:0