Ping 到 openstack 实例中的第二个 ip 失败
Ping failed to second ip in openstack instance
我在一台机器上有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。 neutron 的配置是否存在限制,禁止同时对 Fedora
实例的两个 ip 执行 ping 操作。请帮忙
发生这种情况是因为 OpenStack 网络 (neutron) 完成了默认的防火墙设置——如果数据包的源地址与分配给端口的 IP 地址不匹配,它只会丢弃在端口上收到的任何数据包。
当cirros 实例向50.0.0.4 发送ping 数据包时,fedora 实例在IP 地址为50.0.0.4 的接口上收到它。但是,当它响应 cirros 的 IP 地址 50.0.0.5 时,您的 fedora 机器上的 linux 网络堆栈有两个接口可供选择以发送响应(因为这两个接口都连接到同一个网络) .在你的例子中,fedora 选择在 50.0.0.3 上响应。然而,数据包中的源 IP 地址仍然是 50.0.0.4,因此 OpenStack 网络层直接丢弃它。
一般建议不要在同一网络上有多个接口。如果你想为你的 VM 使用来自同一网络的多个 IP 地址,你可以在你的热模板中使用 "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 添加到您的接口(参见 http://www.unixwerk.eu/linux/redhat/ipalias.html):
ip addr add 50.0.0.3/24 brd + dev eth0 label eth0:0
我在一台机器上有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。 neutron 的配置是否存在限制,禁止同时对 Fedora
实例的两个 ip 执行 ping 操作。请帮忙
发生这种情况是因为 OpenStack 网络 (neutron) 完成了默认的防火墙设置——如果数据包的源地址与分配给端口的 IP 地址不匹配,它只会丢弃在端口上收到的任何数据包。
当cirros 实例向50.0.0.4 发送ping 数据包时,fedora 实例在IP 地址为50.0.0.4 的接口上收到它。但是,当它响应 cirros 的 IP 地址 50.0.0.5 时,您的 fedora 机器上的 linux 网络堆栈有两个接口可供选择以发送响应(因为这两个接口都连接到同一个网络) .在你的例子中,fedora 选择在 50.0.0.3 上响应。然而,数据包中的源 IP 地址仍然是 50.0.0.4,因此 OpenStack 网络层直接丢弃它。
一般建议不要在同一网络上有多个接口。如果你想为你的 VM 使用来自同一网络的多个 IP 地址,你可以在你的热模板中使用 "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 添加到您的接口(参见 http://www.unixwerk.eu/linux/redhat/ipalias.html):
ip addr add 50.0.0.3/24 brd + dev eth0 label eth0:0