Interestingly, routers are not part of the core concepts of Neutron,
they are implemented as so called extensions.
You have already created and connected a router via the GUI.
Of course it can also be done on the commandline.
Here we have two networks, the one on the right is external.
This means that it represents the actual network to which this cloud is connected.
Only a cloud administrator can create an external network.
The left network is a tenant network. It's entirely virtual and was
created by a user working inside a project.
The old term tenant for project has stuck here.
We need a router to connect demonet to public.
When you click on the router in the GUI, you find that you can add
interfaces, these are router connections to tenant networks.
On the other hand, a router's connection to an external network is
named a gateway.
How do we manage routers on the commandline?
Like other resources, you can create them, list them,
display their details, and delete them. To connect a router to an
external network, use neutron router-gateway-set.
Only one gateway is possible, you can't connect two or more external
networks together with a router. When you don't need the gateway
anymore, use router-gateway-clear. I mentioned already that in the
Newton release, not quite all commands are implemented with the
OpenStack client, and this is an example.
These two router-gateway commands have not been implemented in the
OpenStack client yet, and we have to use the Neutron client instead.
Interfaces to tenant networks are created with router add subnet.
More than one interface can be created this way.
Of course, you can also remove an interface from the router.
You can list the interfaces of a router with port list.
The gateway is not listed, but you'll find gateway details in the
output of the router show command.