How to Build an OpenStack Network using the Neutron CLI
Within this article we will provide the steps required to build a simple Neutron network. The network will consist of,
- Provider network (NET_EXTERNAL)
- Tenant network (NET_INTERNAL)
- L3 Router (NEUTRON-ROUTER)
- Floating IPs (172.16.100.30-172.16.100.70)
Below is a diagram on how the topology looks,
First we create the provider network. This is a layer2 network that maps to a physical network, allowing us to use a physical device as the gateway. Below traffic is sent out tagged on VLAN100.
We then assign a subnet to the network. This contains the floating IPs as well as the default gateway.
neutron net-create --provider:physical_network=physnet1 \ --provider:network_type=vlan \ --provider:segmentation_id=100 \ --shared --router:external NET_EXTERNAL neutron subnet-create NET_EXTERNAL 172.16.100.0/24 \
--name SUBNET_EXTERNAL \ --enable_dhcp=False \ --allocation_pool start=172.16.100.30,end=172.16.100.70 \ --gateway 172.16.100.1
The tenant network is then created. We assign the DNS servers and IP pool (fixed IPs) that will be assigned to the instances by DHCP on creation.
neutron net-create NET_INTERNAL neutron subnet-create NET_INTERNAL 10.1.1.0/24 \
--name SUBNET_INTERNAL \ --dns-nameservers list=true 188.8.131.52 184.108.40.206
Finally we create the L3 router. We assign the gateway network (i.e provider) and then the tenant network.
neutron router-create NEUTRON-ROUTER neutron router-gateway-set NEUTRON-ROUTER NET_EXTERNAL neutron router-interface-add NEUTRON-ROUTER SUBNET_INTERNAL
|neutron net-list||List networks|
|neutron net-show <network>||Show network|
|neutron subnet-ist||List subnets|
|neutron subnet-show <subnet>||Show subnet|
|neutron floatingip-list||List floating IPs|
|neutron floatingip-show <floating_ip>||Show floating IP|
|neutron router-list||List routers|
|neutron router-show <router>||Show router|
Installation Scripts - https://github.com/busterswt/openstack_installer