[英]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 ping通。 如果我在Fedora
实例中使用ip 50.0.0.3手动关闭接口,那么只有我可以从cirros
实例ping 50.0.0.4。 中子的配置是否有限制,禁止同时对Fedora
实例的两个ip进行ping操作。 请帮忙。
发生这种情况是由于OpenStack网络(neutron)进行了默认的防火墙保护-如果数据包的源地址与分配给该端口的IP地址不匹配,它只会丢弃端口上接收到的所有数据包。
当cirros实例将ping数据包发送到50.0.0.4时,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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.