Example: Creating network using OpenStack CLI (Hyper-V environment)
Review this example that uses OpenStack CLI to create a network for a Hyper-V environment.
It also shows other network management actions.
Note: The
steps are provided for example purposes only.
- Log in to the controller node.
- Create a Neutron network
that is named mynetwork.
[root@controller ˜]# neutron net-create mynetworkThe network is created.+---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | id | 2a75441c-9467-43bf-8afb-3b6821cade52 | | name | mynetwork | | provider:network_type | local | | provider:physical_network | | | provider:segmentation_id | | | router:external | False | | shared | False | | status | ACTIVE | | subnets | | | tenant_id | 51cc2d2aff6a4e7d812e2ff60ac9a47a | +---------------------------+--------------------------------------+ - Create a subnet that is associated with mynetwork,
and assign its Classless Inter-Domain Routing address.
[root@controller ˜]# neutron subnet-create mynetwork x.x.x.0/24The subnet is created.+-------------------+--------------------------------------------+ | Field | Value | +-------------------+--------------------------------------------+ | allocation_pools | {"start": "x.x.x.2", "end": "x.x.x.254"} | | cidr | x.x.x.0/24 | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | x.x.x.1 | | host_routes | | | id | edd8c644-2fbd-4bc6-b2c3-9d44061407a0 | | ip_version | 4 | | ipv6_address_mode | | | ipv6_ra_mode | | | name | | | network_id | 2a75441c-9467-43bf-8afb-3b6821cade52 | | tenant_id | 51cc2d2aff6a4e7d812e2ff60ac9a47a | +-------------------+--------------------------------------------+ - Update the subnet. For example, you can enable DHCP and assign
a new subnet name, such as mysubnet.
[root@controller ˜]# neutron subnet-update --enable-dhcp --name mysubnet edd8c644-2fbd-4bc6-b2c3-9d44061407a0 Updated subnet: edd8c644-2fbd-4bc6-b2c3-9d44061407a0 - Delete the subnet.
[root@controller ˜]# neutron subnet-delete mysubnet Deleted subnet: mysubnet - Delete the Neutron network.
[root@controller ˜]# neutron net-delete mynetwork Deleted network: mynetwork