After creating the router, you configure the external network next. Through the external network's gateway, users in the cloud's internal networks can connect to the Internet.
The following figure shows how a single router supports network communications of the cloud projects.
Figure 4 Provider Router with Private Networks Model
The figure shows the following:
Two projects (Tenant A and Tenant B)
Four VMs (VM1, VM2, VM3, and VM4)
Four subnets (HR, ENG, IT, and ACCT)
Router
External network
When you provide an internal network access to the external network, the VM's IP address is mapped to one of the floating addresses that you assign to the external network.
This procedure shows how to create a virtual network that represents an external network. This virtual network does not use DHCP. Instead, floating IP addresses are created and assigned to projects and used by Nova VM instances under those projects. These steps create a VLAN type of network, but the procedure applies for creating other network types, such as a flat network.
You can create the external network independently of creating internal networks.
Before You Begin
Complete the configuration of the elastic virtual switch. For more information, see How to Install and Configure Neutron, particularly the steps for configuring EVS.
controller# export OS_USERNAME=neutron controller# export OS_PASSWORD=service-password controller# export OS_TENANT_NAME=service controller# export OS_AUTH_URL=http://$CONTROLLER_ADMIN_NODE:5000/v2.0
controller# evsadm show-controlprop -p vlan-range
controller# neutron net-create --provider:network_type=vlan \ --provider:segmentation_id=VLAN-nbr \ --router:external=true network-name
where the value for segmentation_id is typically 1, the first number of the VLAN range you defined during the EVS configuration.
The allocation pool consists of a range of floating IP addresses that is assigned to the subnet.
controller# neutron subnet-create --name subnet-name --disable-dhcp \ --allocation-pool start=start-IP,end=end-IP \ network-name subnet-IP
controller# neutron router-gateway-set router-name ext-network-id
controller# neutron router-show router-name
This example shows how to create the external network to prepare it for use by internal networks in the cloud.
To create a flat network, see also the example provided in Section 2 of https://blogs.oracle.com/openstack/tags/juno.
controller# export OS_USERNAME=neutron
controller# export OS_PASSWORD=service-password
controller# export OS_TENANT_NAME=service
controller# export OS_AUTH_URL=http://$CONTROLLER_ADMIN_NODE:5000/v2.0
controller# evsadm show-controlprop -p vlan-range
PROPERTY PERM VALUE DEFAULT HOST
vlan-range rw 1,200-300 -- --
controller# neutron net-create --router:external=True \
--provider:network_type=vlan --provider:segmentation_id=1 ext-network
Created a new network:
+--------------------------+--------------------------------------+
| Field | Value |
+--------------------------+--------------------------------------+
| admin_state_up | True |
| id | 08cf49c8-f28f-49c1-933d-bdb1017e0294 |
| name | ext-network |
| provider:network_type | vlan |
| provider:segmentation_id | 1 |
| router:external | True |
| shared | False |
| status | ACTIVE |
| subnets | |
| tenant_id | 7d1caf0854b24becb28df5c5cabf72cc |
+--------------------------+--------------------------------------+
controller# neutron subnet-create --name ext-subnet --disable-dhcp \
--allocation-pool start=10.134.13.8,end=10.134.13.254 \
ext_network 10.134.13.0/24
Created a new subnet:
+-------------------+---------------------------------------------------+
| Field | Value |
+-------------------+---------------------------------------------------+
| allocation_pools | {"start": "10.134.13.8", "end": "10.134.13.254"} |
| cidr | 10.134.13.0/24 |
| dns_nameservers | |
| enable_dhcp | False |
| gateway_ip | 10.134.13.1 |
| host_routes | |
| id | fce503ff-f483-4024-b122-f2524e3edae1 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | ext-subnet |
| network_id | 08cf49c8-f28f-49c1-933d-bdb1017e0294 |
| tenant_id | 7d1caf0854b24becb28df5c5cabf72cc |
+-------------------+---------------------------------------------------+
controller# neutron router-gateway-set ext-router 08cf49c8-f28f-49c1-933d-bdb1017e0294
Set gateway for router ext-router
controller# neutron router-show ext-router
+-----------------------+-------------------------------------------------------+
| Field | Value |
+-----------------------+-------------------------------------------------------+
| admin_state_up | True |
| external_gateway_info | {"network_id": "08cf49c8-f28f-49c1-933d-bdb1017e0294",|
| | "enable_snat": true, |
| | "external_fixed_ips": |
| |[{"subnet_id": "fce503ff-f483-4024-b122-f2524e3edae1", |
| |"ip_address": "10.134.13.8"}]} | |
| id | f89b24ed-42dd-48b0-8f4b-fd41887a3370 |
| name | ext-router |
| status | ACTIVE |
| tenant_id | 7d1caf0854b24becb28df5c5cabf72cc |
+-----------------------+-------------------------------------------------------+
See also