Creating a Network for Instances with the CLI

Depending on the network configuration and workloads, you must create a network prior to launching an instance. The Cisco Managed Network and Cisco Managed Gateway enable you to add a private network for use with your instances.

When your cloud is delivered, it contains a public network named “PUBLIC EXTERNAL - DO NOT MODIFY”.

$ openstack network list
+--------------+---------------------------------+---------------------+
| ID           | Name                            | Subnets             |
+--------------+---------------------------------+---------------------+
| <network_id> | PUBLIC EXTERNAL - DO NOT MODIFY | <subnet_id>         |
+--------------+---------------------------------+---------------------+

When you want your instances to communicate outside of your project (tenant), such as for SSH connections to the instances, you must attach a router to the public network on an internal interface and set the gateway on the public network. You also need to logically subdivide the private network into subnets.

To create and prepare a private network for launching instances in Metacloud:

  1. Create a network.

    $ openstack network create <NETWORK_NAME>
     +---------------------------+-----------------------+
     | Field                     | Value                 |
     +---------------------------+-----------------------+
     | admin_state_up            | UP                    |
     | availability_zone_hints   | None                  |
     | availability_zones        | None                  |
     | created_at                | None                  |
     | description               | None                  |
     | dns_domain                | None                  |
     | id                        | <network_id>          |
     | ipv4_address_scope        | None                  |
     | ipv6_address_scope        | None                  |
     | is_default                | None                  |
     | is_vlan_transparent       | None                  |
     | mtu                       | 0                     |
     | name                      | <network_name>        |
     | port_security_enabled     | False                 |
     | project_id                | None                  |
     | provider:network_type     | None                  |
     | provider:physical_network | None                  |
     | provider:segmentation_id  | None                  |
     | qos_policy_id             | None                  |
     | revision_number           | None                  |
     | router:external           | Internal              |
     | segments                  | None                  |
     | shared                    | False                 |
     | status                    | ACTIVE                |
     | subnets                   |                       |
     | updated_at                | None                  |
     +---------------------------+-----------------------+
    
  2. Create a subnet associated with the private network.

    $ openstack subnet create <SUBNET_NAME> \
       --network <NETWORK_ID> \
       --subnet-range 10.0.0.1/24
    +------------------+------------------------------------------------+
    | Field            | Value                                          |
    +------------------+------------------------------------------------+
    | allocation_pools | {"start": "10.0.0.2", "end": 10.0.0.254"}      |
    | cidr             | 10.0.0.0/24                                    |
    | dns_nameservers  |                                                |
    | enable_dhcp      | True                                           |
    | gateway_ip       | 10.0.0.1                                       |
    | host_routes      |                                                |
    | id               | <subnet_id>                                    |
    | ip_version       | 4                                              |
    | name             | <network_name>-<subnet_name>                   |
    | network_id       | <network_id>                                   |
    | tenant_id        | <tenant_id>                                    |
    +------------------+------------------------------------------------+
    

    Note
    If you receive an Invalid input for operation: Only 1 subnet per internal network is allowed response, make sure your project does not have another subnet already created with an identical IP range.

  3. Create a router.

    $ openstack router create <ROUTER_NAME>
    

    Note

    • If you receive a conflict message, make sure the name is not identical to an existing router.
    • If you receive a Quota exceeded for resources: ['router'] response, contact your administrator for further assistance.
  4. Set the gateway for the router to access the public network.

    $ openstack router set <ROUTER_ID> --external-gateway <NETWORK_ID>
    
  5. Create an interface from the router to the private network.

    $ openstack router add subnet <ROUTER_ID> <SUBNET_ID>