command syntax: openstack network <action/operation> <--flags values> <network-name>

action/operation: list, create, set, delete...

flags: help, long, project, provider-physical-network, provider-network-type, external...

#to view the list of the available networks

cumulus@server01:~$ openstack network list
+--------------------------------------+----------+--------------------------------------
+
| ID | Name | Subnets
|
+--------------------------------------+----------+--------------------------------------
+
| dc005f68-35c6-4151-ad18-ac21523ed4e5 | provider | c679c440-8286-4eeb-8025-19e0c0895aef
|
+--------------------------------------+----------+--------------------------------------
+

#for a detailed list, and to see which project owns this network

cumulus@server01:~$ openstack network list --long
+--------------------------------------+----------+--------+----------------------------------+-------+--------+--------------------------------------+--------------+-------------+--------------------+------+
| ID | Name | Status | Project
| State | Shared | Subnets | Network Type | Router Type
| Availability Zones | Tags |
+--------------------------------------+----------+--------+----------------------------------+-------+--------+--------------------------------------+--------------+-------------+--------------------+------+
| dc005f68-35c6-4151-ad18-ac21523ed4e5 | provider | ACTIVE | 6d9cb60806744bbc9618963e77bd
a3cd | UP | True | c679c440-8286-4eeb-8025-19e0c0895aef | flat | External
| nova | |
+--------------------------------------+----------+--------+----------------------------------+-------+--------+--------------------------------------+--------------+-------------+--------------------+------+

cumulus@server01:~$ openstack project list | grep 6d9cb60806744bbc9618963e77bd
| 6d9cb60806744bbc9618963e77bda3cd | admin |
cumulus@server01:~$

#let's create a new network

cumulus@server01:~$ openstack network create --project firstProject firstNetwork

+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2018-07-10T04:55:47Z |
| description | |
| dns_domain | None |
| id | dfb787e9-25e6-4e0d-996f-4619ba3b360d |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | False |
| is_vlan_transparent | None |
| mtu | 1450 |
| name | firstNetwork |
| port_security_enabled | True |
| project_id | e79e5fbcf2be47aa9c1d3600ddfd7a81 |
| provider:network_type | vxlan |
| provider:physical_network | None |
| provider:segmentation_id | 36 |
| qos_policy_id | None |
| revision_number | 2 |
| router:external | Internal |
| segments | None |
| shared | False |
| status | ACTIVE |
| subnets | |
| tags | |
| updated_at | 2018-07-10T04:55:47Z |
+---------------------------+--------------------------------------+
cumulus@server01:~$

#to verify

cumulus@server01:~$ openstack network list
+--------------------------------------+--------------+--------------------------------------+
| ID | Name | Subnets
|
+--------------------------------------+--------------+--------------------------------------+
| dc005f68-35c6-4151-ad18-ac21523ed4e5 | provider | c679c440-8286-4eeb-8025-19e0c0895
aef |
| dfb787e9-25e6-4e0d-996f-4619ba3b360d | firstNetwork |
|
+--------------------------------------+--------------+--------------------------------------+

#let's create another network, for connecting to the external networks

cumulus@server01:~$ openstack network create firstProviderNetwork
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2018-07-10T05:45:40Z |
| description | |
| dns_domain | None |
| id | 1a135cc1-f5c6-489d-9378-353424bbb4fc |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | False |
| is_vlan_transparent | None |
| mtu | 1450 |
| name | firstProviderNetwork |
| port_security_enabled | True |
| project_id | 6d9cb60806744bbc9618963e77bda3cd |
| provider:network_type | vxlan |
| provider:physical_network | None |
| provider:segmentation_id | 61 |
| qos_policy_id | None |
| revision_number | 2 |
| router:external | Internal |
| segments | None |
| shared | False |
| status | ACTIVE |
| subnets | |
| tags | |
| updated_at | 2018-07-10T05:45:40Z |
+---------------------------+--------------------------------------+
#let's set this subnet to external type

cumulus@server01:~$ openstack network set --external firstProviderNetwork
cumulus@server01:~$ openstack network show firstProviderNetwork | grep external
| router:external | External |
cumulus@server01:~$

#to associate the instance 'firstServer' with the network 'firstNetwork'

cumulus@server01:~$ openstack server create --image firstImage --flavor firstFlavor --nic netid=firstNetwork firstServer

cumulus@server01:~$

--end-of-post--