On OpenStack Grizzly while in the process of setting up an external Quantum Provider Network so I could attach it to a Quantum Router as the default gateway, I needed a way to specify what IP address is brought up as the default gateway on the Quantum Router, but there is no obvious command line switch to do this.
Why did I need a way to specify what IP address is brought up as the default gateway on a Quantum Router?
By default, when you create an external Quantum Provider Network, whatever subnet you specify, the second usable IP address in the subnet (even if it is used elsewhere) is used as the IP address of the default gateway on the Quantum Router. So, if I used the commands below to create my external Quantum Provider Network, and assigned this external Quantum Provider Network as the default gateway on a Quantum Router, by running quantum router-gateway-set router1 external-network-1
, the IP address assigned would be 20.0.0.2.
quantum net-create external-network-1 --provider:network_type flat --provider:physical_network \
physnet1 --router:external True
quantum subnet-create external-network-1 20.0.0.0/24 --name external-subnet-1 --disable-dhcp \
--gateway 20.0.0.1
IP address 20.0.0.1 is skipped because this is almost always in use elsewhere on an external Quantum Provider Network, so that is why 20.0.0.2 is used. However, in my case, 20.0.0.2 was also in use elsewhere, but I had 14 unused, contiguous IP addresses within the /24 subnet from 20.0.0.17 to 20.0.0.30. I wanted to assign 20.0.0.17 as the default gateway on the Quantum Router, but how do I do that?
Oddly enough, this is where the --allocation-pool
command line switch comes into play. Now you may be wondering why is the allocation pool used when the --disable-dhcp
command line switch is set. I discovered that the --allocation-pool
command line switch has several uses.
First, it is used as the DHCP pool to serve IP addresses from when DHCP is enabled.
Second, if your situation is like mine, the first unused IP address within the allocation pool will be assigned as the default gateway on the Quantum Router.
Third, the allocation pool is also used when allocating Quantum Floating IP addresses.
This is a very peculiar way to explicitly set the default gateway IP address on a Quantum Router, but it does work. The following are the proper commands to use:
quantum net-create external-network-1 --provider:network_type flat --provider:physical_network \
physnet1 --router:external True
quantum subnet-create external-network-1 20.0.0.0/24 --name external-subnet-1 --disable-dhcp \
--allocation-pool start=20.0.0.17,end=20.0.0.30 --gateway 20.0.0.1
Now, once I run quantum router-gateway-set router1 external-network-1
, the IP address assigned as the default gateway on the Quantum Router will be 20.0.0.17.