How do you share a subnet across 2 routers?

asked 2019-08-06 12:04:15 -0500

DaazKu gravatar image

Hi,

I have the following setup:

Openstack version -> Stein

Project1 [PrivateNetwork1 -> PrivateSubnet1 <- PrivateRouter1]

Project2 [PrivateNetwork2 -> PrivateSubnet2 <- PrivateRouter2]

I want VMs from Project2 to be able to reach VMs from Project1. I was told that I should be adding PrivateSubnet1 to PrivateRouter2 but I can't seem to be able to.

Here is what I tried so far: I made sure that my PrivateNetwork1 was set as "SHARED". From there I went into Horizon and tried to assign a new interface to PrivateRouter2. I have 2 fields: 1- Subnet 2- IP Address (optional)

The PrivateSubnet1 show in the list of subnet but if try to assign it without specifying an IP I get the following error:

Error: Failed to add interface: Bad router request: Cannot add interface to router because subnet 2c54b052-d666-4c8c-be3b-f3758ceb3dcd is not owned by project making the request. Neutron server returns request_ids: ['req-92d18bea-b383-46c8-9dad-65a2279a9c09']

If I try to specify an IP (that is free in that subnect) I get the following error:

Error: Failed to add interface: (rule:create_port and rule:create_port:fixed_ips) is disallowed by policy Neutron server returns request_ids: ['req-b62e91b0-39f4-4f21-a58e-3259c00a5e70']

I turned myself to the CLI instead but when I try to assign the subnet to the router I get:

➜  ~ neutron router-interface-add f0a7d569-0b0d-40a8-b1ea-e5027f8c52ee 2c54b052-d666-4c8c-be3b-f3758ceb3dcd

neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. IP address 10.232.0.1 already allocated in subnet 2c54b052-d666-4c8c-be3b-f3758ceb3dcd

If I try with openstack instead:

➜  ~ openstack router add subnet f0a7d569-0b0d-40a8-b1ea-e5027f8c52ee 2c54b052-d666-4c8c-be3b-f3758ceb3dcd
# that's it

It doesn't do any error but the subnet is not added:

➜  ~ openstack router show f0a7d569-0b0d-40a8-b1ea-e5027f8c52ee | grep 2c54b052-d666-4c8c-be3b-f3758ceb3dcd
# nothing

I've read somewhere that you need to specific the IP you want to assign since the default gateway is already assigned but there is nothing that allows me to do that:

➜  ~ openstack router add subnet --help
usage: openstack router add subnet [-h] <router> <subnet>

Add a subnet to a router

positional arguments:
  <router>    Router to which subnet will be added (name or ID)
  <subnet>    Subnet to be added (name or ID)

optional arguments:
  -h, --help  show this help message and exit

I'm lost here! Any help would be appreciated.

edit retag flag offensive close merge delete