OpenStack Liberty on Ubuntu 14.04 – Create virtual networks

0
OpenStack Liberty on Ubuntu 14.04 - Create virtual networks
OpenStack Liberty on Ubuntu 14.04 – Create virtual networks

This is the third part of configuring neutron (Networking) on Ubuntu 14.04, you can go through previous article on Configure Neutron #1 and Configure Neutron #2, in which we have installed and configured Networking components on Controller and Compute node.

Here, we will be creating initial network, this must be created before launching  a VM instance/s.

The above diagram uses example IP address ranges. You must adjust them for your particular environment.

Since we are using Self-service networks, we must create both public and private virtual networks.

Creating Public Provider Network:

Instance uses a public provider virtual network that connects to the physical network infrastructure via bridging/switching. This network includes a DHCP server that provides network resources (ip address, subnet, gateway and others) to instances.

Load credentials on the controller node.

# source admin-openrc.sh

create the network.

#  neutron net-create public --shared --provider:physical_network public --provider:network_type flat

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 25109c9a-0d9c-498f-8a8a-9004219ee85a |
| mtu                       | 0                                    |
| name                      | public                               |
| port_security_enabled     | True                                 |
| provider:network_type     | flat                                 |
| provider:physical_network | public                               |
| provider:segmentation_id  |                                      |
| router:external           | False                                |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | fe858f6a43f84c26b994f0be74c928e6     |
+---------------------------+--------------------------------------+

Create a subnet on the public network.

For example, using 192.168.0.0/24 with floating IP address range 192.168.0.200 to 192.168.0.250 with the physical gateway 192.168.0.1 with 8.8.4.4 as a primary DNS server. This gateway should be associated physical network

# neutron subnet-create public 192.168.0.0/24 --name public --allocation-pool start=192.168.0.200,end=192.168.0.250 --dns-nameserver 8.8.4.4 --gateway 192.168.0.1
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field             | Value                                              |
+-------------------+----------------------------------------------------+
| allocation_pools  | {"start": "192.168.0.200", "end": "192.168.0.250"} |
| cidr              | 192.168.0.0/24                                     |
| dns_nameservers   | 8.8.4.4                                            |
| enable_dhcp       | True                                               |
| gateway_ip        | 192.168.0.1                                        |
| host_routes       |                                                    |
| id                | 3cee40a7-e241-4f9e-8033-cdc03fc58d76               |
| ip_version        | 4                                                  |
| ipv6_address_mode |                                                    |
| ipv6_ra_mode      |                                                    |
| name              | public                                             |
| network_id        | 25109c9a-0d9c-498f-8a8a-9004219ee85a               |
| subnetpool_id     |                                                    |
| tenant_id         | fe858f6a43f84c26b994f0be74c928e6                   |
+-------------------+----------------------------------------------------+

Creating Private Project network:

Create a private project virtual network to connect the physical network infrastructure via layer-3 (routing) and NAT. This private project network includes a DHCP server that provides IP addresses to instances. An instance on this network can have an access to the Internet. However, access to an instance on this network from Internet requires a floating IP address.

Create the private network (private).

# neutron net-create private
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 1b03eacd-e737-473b-8c0d-a16052f6505b |
| mtu                       | 0                                    |
| name                      | private                              |
| port_security_enabled     | True                                 |
| provider:network_type     | vxlan                                |
| provider:physical_network |                                      |
| provider:segmentation_id  | 65                                   |
| router:external           | False                                |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | fe858f6a43f84c26b994f0be74c928e6     |
+---------------------------+--------------------------------------+

Create a subnet on the internal network. For example, using 192.168.100.0/24 network with the virtual gateway 192.168.0.1 with 8.84.4. as a primary DNS server. A DHCP server assigns each instance an IP address from 192.168.100.2 to 192.168.100.254

#  neutron subnet-create private 192.168.100.0/24 --name private --dns-nameserver 8.8.4.4 --gateway 192.168.100.1
Created a new subnet:
+-------------------+------------------------------------------------------+
| Field             | Value                                                |
+-------------------+------------------------------------------------------+
| allocation_pools  | {"start": "192.168.100.2", "end": "192.168.100.254"} |
| cidr              | 192.168.100.0/24                                     |
| dns_nameservers   | 8.8.4.4                                              |
| enable_dhcp       | True                                                 |
| gateway_ip        | 192.168.100.1                                        |
| host_routes       |                                                      |
| id                | 5b986d39-7f60-4c14-ad68-9aa797fc2487                 |
| ip_version        | 4                                                    |
| ipv6_address_mode |                                                      |
| ipv6_ra_mode      |                                                      |
| name              | private                                              |
| network_id        | 1b03eacd-e737-473b-8c0d-a16052f6505b                 |
| subnetpool_id     |                                                      |
| tenant_id         | fe858f6a43f84c26b994f0be74c928e6                     |
+-------------------+------------------------------------------------------+

Create the virtual router.

Private project networks connect to public provider networks using a virtual router, it passes network traffic between two or more virtual network ( to or from private / public).  In our case, we need to create a router and attach private and public networks to it.

# neutron router-create router
Created a new router:
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| admin_state_up        | True                                 |
| external_gateway_info |                                      |
| id                    | e217d03c-ad34-4d64-bce8-0190e0eef6ca |
| name                  | router                               |
| routes                |                                      |
| status                | ACTIVE                               |
| tenant_id             | b558b39292b247b7a346678b80ed71e0     |
+-----------------------+--------------------------------------+

Add the router:external option to the public provider network.

# neutron net-update public --router:external
Updated network: public

Attach the router to the private subnet.

# neutron router-interface-add router private
Added interface 74748304-cbfb-4c53-bc6e-d12271bbcdd1 to router router.

Attach the router to the public network by setting it as the gateway.

# neutron router-gateway-set router public
Set gateway for router router

Verify:

List down the network namespaces, output should have one qrouter and two qdhcp namespaces.

# ip netns
qrouter-e217d03c-ad34-4d64-bce8-0190e0eef6ca
qdhcp-1b03eacd-e737-473b-8c0d-a16052f6505b
qdhcp-25109c9a-0d9c-498f-8a8a-9004219ee85a

You can verify the connectivity by pinging 192.168.0.200 from the external physical network. This is because we used subnet 192.168.0.0/24, floating ip ranges from 192.168.0.200 – 250, tenant router gateway should occupy the lowest IP address in the floating IP address range ie 192.168.0.200

C:\>ping 192.168.0.200

Pinging 192.168.0.200 with 32 bytes of data:
Reply from 192.168.0.200: bytes=32 time=1ms TTL=64
Reply from 192.168.0.200: bytes=32 time=2ms TTL=64
Reply from 192.168.0.200: bytes=32 time=1ms TTL=64
Reply from 192.168.0.200: bytes=32 time=1ms TTL=64

Ping statistics for 192.168.0.200:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 2ms, Average = 1ms

That’s All!!!, you have successfully created initial networks for launching an instance.

Reference: OpenStack Guide.

You might also like