[openstack-dev] Setting host routes in a subnet on Neutron

Robert Collins robertc at robertcollins.net
Fri Oct 18 09:29:06 UTC 2013


On 18 October 2013 22:18, Dionysis Grigoropoulos <dgrig at grnet.gr> wrote:
> Hello all,
>
> I've started implementing the Neutron API in Python for Synnefo [1], but I've
> hit a bump. Specifically, I'm troubled by the way Neutron seems to handle host
> routes in subnet definitions.
>
> I'm experimenting with the implementation of the API in Neutron from Grizzly,
> with a PackStack-based installation.
>
> For starters, when creating a subnet and setting host routes, it's possible to
> set the nexthop as an IP address outside of the subnet CIDR.
>
> For example, when defining a subnet, I pass the following JSON to Neutron:
>
> {
>     "cidr": "192.168.28.0/24",
>     "host_routes": [
>         {
>             "destination": "100.100.100.0/24",
>             "nexthop": "8.8.8.8"
>         }
>     ],
>     "ip_version": 4,
>     "network_id": "f52b51b6-3749-4306-bc76-97802fb3f48e"
> }
>
> I can set "8.8.8.8" as the gateway for network "100.100.100.0/24",
> although 8.8.8.8 does not belong in the range of the subnet's CIDR
> 192.168.28.0/24.
>
> Is there an obvious usecase for allowing this, that I'm missing at the moment?

It seems unusual but not invalid.

Consider that I could supply two host routes.
One to 8.8.8.8 on something in the host's subnet.
One to another network via 8.8.8.8.

So that should work. Note then that the route to 8.8.8.8 might be
delivered via a dynamic protocol (IS-IS or whatever) and it seems
fairly clear neutron shouldn't reject the route via 8.8.8.8.

-Rob

> Moreover, it's possible to set the destination CIDR for a host route to
> 0.0.0.0/0. If I understand correctly, this would set a host route for
> 0.0.0.0, effectively changing the default gateway for the system.
> However, a default gateway is *already* defined for the subnet, via the
> "gateway" field. Shouldn't there be some sort of verification that these
> two values coincide, or just disallow setting host routes for 0.0.0.0/0
> anyway?


I've no particular opinion on the 0.0.0.0 question.

-Rob


-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud



More information about the OpenStack-dev mailing list