Networking OpenStack如何路由同一网络的2个子网
我对Openstack比较陌生,我找不到如何路由同一网络的2个子网 我的拓扑图如下: 1.1网络, 2.网络中有2个子网。sub1(192.168.10.0/24)和sub2(192.168.20.0/24) 第一个子集中的实例无法看到子集中的另一个实例 问题1:这正常吗?为什么默认情况下不路由子网 我尝试添加路由器,但路由器只能在内部网络和公共网络之间使用,而不能在子网之间使用 问题2:那么,在同一网络的两个子网中的两个实例之间进行通信的最佳解决方案是什么Networking OpenStack如何路由同一网络的2个子网,networking,routing,openstack-neutron,Networking,Routing,Openstack Neutron,我对Openstack比较陌生,我找不到如何路由同一网络的2个子网 我的拓扑图如下: 1.1网络, 2.网络中有2个子网。sub1(192.168.10.0/24)和sub2(192.168.20.0/24) 第一个子集中的实例无法看到子集中的另一个实例 问题1:这正常吗?为什么默认情况下不路由子网 我尝试添加路由器,但路由器只能在内部网络和公共网络之间使用,而不能在子网之间使用 问题2:那么,在同一网络的两个子网中的两个实例之间进行通信的最佳解决方案是什么 很多感谢都是事先准备好的。要让一个网
很多感谢都是事先准备好的。要让一个网络与另一个网络通话,你需要一个路由器。我不知道你是怎么想到路由器只在公共和私有网络之间路由的;对于路由器来说,它们只是两个不同的网络
您有两个网络:
192.168.10.0/24
和192.168.20.0/24
。要使任一网络与另一个网络通信,它们之间至少需要一个路由器,单个路由器是最简单的,因为它不涉及路由协议或静态定义的路由。好的,经过一些尝试,我终于找到了一个解决方案,我想与您分享
首先,正如上面罗恩所说,路由器不一定是通往公共网络的网关
精确地说,我只希望有一个带有子网的网络,而不是两个网络
解决方案是在每个子网上都有一个路由器,该路由器在每个子网上都有一个接口,使用“主机路由”功能在每个子网上添加路由信息
执行此操作的热堆如下所示:
subnet_public:
type: OS::Neutron::Subnet
properties:
name: PublicSubnet
cidr: 192.168.11.0/24
network: { get_resource: network_public }
allocation_pools: [ { "start" : '192.168.11.1', "end" : '192.168.11.253'}]
dns_nameservers: [ 'xx.xx.xx.xx', ...]
enable_dhcp: True
gateway_ip: 192.168.11.254
host_routes: [ { 'destination' : '192.168.12.0/24', 'nexthop' : '192.168.11.254'}, { 'destination' : '192.168.13.0/24', 'nexthop' : '192.168.11.254'}]
ip_version: 4
# tenant_id: { get_param: tenantId }
subnet_appli:
type: OS::Neutron::Subnet
properties:
name: ApplicationSubnet
cidr: 192.168.12.0/24
network: { get_resource: network_public }
allocation_pools: [ { "start" : '192.168.12.1', "end" : '192.168.12.253'}]
dns_nameservers: [ 'xx.xx.xx.xx', ...]
enable_dhcp: True
gateway_ip: 192.168.12.254
host_routes: [ { 'destination' : '192.168.11.0/24', 'nexthop' : '192.168.12.254'}, { 'destination' : '192.168.13.0/24', 'nexthop' : '192.168.12.254'}]
ip_version: 4
# tenant_id: { get_param: tenantId }
subnet_database:
type: OS::Neutron::Subnet
properties:
name: DatabaseSubnet
cidr: 192.168.13.0/24
network: { get_resource: network_public }
allocation_pools: [ { "start" : '192.168.13.1', "end" : '192.168.13.253'}]
dns_nameservers: [ 'xx.xx.xx.xx', ...]
enable_dhcp: True
gateway_ip: 192.168.13.254
host_routes: [ { 'destination' : '192.168.11.0/24', 'nexthop' : '192.168.13.254'}, { 'destination' : '192.168.12.0/24', 'nexthop' : '192.168.13.254'}]
ip_version: 4
# tenant_id: { get_param: tenantId }
#
# Router
router_nat:
type: OS::Neutron::Router
properties:
name: routerNat
admin_state_up: True
external_gateway_info: { "network": 'ext-net' }
gateway_itf:
type: OS::Neutron::RouterInterface
depends_on: [ network_public, subnet_public, router_nat ]
properties:
router_id: { get_resource: router_nat }
subnet: { get_resource: subnet_public }
router_appli_itf:
type: OS::Neutron::RouterInterface
depends_on: [ network_public, subnet_appli, router_nat ]
properties:
router_id: { get_resource: router_nat }
subnet: { get_resource: subnet_appli }
router_database_itf:
type: OS::Neutron::RouterInterface
depends_on: [ network_public, subnet_database, router_nat ]
properties:
router_id: { get_resource: router_nat }
subnet: { get_resource: subnet_database }
谢谢您的回答,但我想在1个网络的2个子网之间路由(而不是在2个网络的2个子网之间路由)。顺便说一句,你是对的,路由器不仅用于使用公共子网进行路由,而且是添加主机路由的解决方案。参考上面的完整答案。这里有一个更明确的文件: