Ubuntu Build OpenStack Platform (Kilo) (six. Instantiate a network, create an instance)

Source: Internet
Author: User

Instantiate a network

Reference Document: Http://www.aboutyun.com/thread-13187-1-1.html
Http://www.aboutyun.com/thread-14639-1-1.html
Http://docs.openstack.org/mitaka/install-guide-ubuntu/launch-instance.html#create-virtual-networks
I. Creating an external network

    • Load Environment
source admin-openrc.sh
    • Create a network
Neutron net-create ext-net--shared--Router:External--provider:Physical_network External--provider:Network_type FlatCreatedA newNetwork:+---------------------------+--------------------------------------+|Field|Value|+---------------------------+--------------------------------------+| admin_state_up | True|| id | 0e62efcd-8cee- $C7-B163-D8DF05C3C5AD || mtu |  the|| name | provider || port_security_enabled | True||provider:Network_type| flat ||provider:Physical_network| provider ||provider:segmentation_id | ||Router:External |False|| shared | True|| status | ACTIVE|| subnets ||| tenant_id | d84313397390425c8ed50b2f6e18d092 |+---------------------------+--------------------------------------+

Two. Create a subnet on the external network

Neutron subnet-createExt-netExternal_network_cidr--Name ext-subnet   --Allocation-poolStart=Floating_ip_start,end=Floating_ip_end--Disable-dhcp --Gateway External_network_gateway#EXTERNAL_NETWORK_CIDRFor available Internet IP segment (**Must be able to surf the internet**), such as203.0. 113. 0/ -, Floating_ip_start,end=Floating_ip_end refers to the starting IP and terminating IP of the floating IP, as203.0. 113. 203.0. 113. 156, External_network_gateway is a gateway, typically the first IP of a network segment such as203.0. 113. 1

For example:

Neutron subnet-create ext-net203.0. 113. 0/ ---name ext-subnet--allocation-pool start=203.0. 113., end=203.0. 113. 156--disable-dhcp--gateway203.0. 113. 1CreatedA newSubnet:+-------------------+----------------------------------------------------+|Field|Value|+-------------------+----------------------------------------------------+| allocation_pools |{"Start":"203.0.113.101","End":"203.0.113.250"} || cidr | 203.0. 113. 0/ -|| dns_nameservers | 8.8. 4. 4|| enable_dhcp | True|| gateway_ip | 203.0. 113. 1|| host_routes ||| id | 5cc70da8-4ee7-4565-be53-b9c011fca011 || ip_version | 4|| ipv6_address_mode ||| ipv6_ra_mode ||| name | provider || network_id | 0e62efcd-8cee- $C7-B163-D8DF05C3C5AD || subnetpool_id ||| tenant_id | d84313397390425c8ed50b2f6e18d092 |+-------------------+----------------------------------------------------+

Three. Create a Tenant (project) network

    • Load environment ( especially important )
source demo-openrc.sh
    • Create a Tenant (project) network
net-create demo-net
    • Create a Tenant (project) network subnet
neutron subnet-create demo-net TENANT_NETWORK_CIDR  --name demo-subnet--gateway TENANT_NETWORK_GATEWAY#TENANT_NETWORK_CIDR为租户(project)网络,一般用192.168.**,**/24,TENANT_NETWORK_GATEWAY为网管一般为192.168.**.1,可以根据自己的需求设置。

For example:

Neutron subnet-create demo-net 192.168.1.0/24--name demo-subnet--gateway 192.168.1.1Created a new subnet:+-------------------+------------------------------------------------+| Field | Value |+-------------------+------------------------------------------------+| Allocation_pools | {"Start": "172.16.1.2", "End": "172.16.1.254"} | | CIDR | 192.168.1.0/24 | | Dns_nameservers | || Enable_dhcp | True | | Gateway_IP | 192.168.1.1 | | Host_routes | || ID | 3482f524-8bff-4871-80d4-5774c2730728 | | Ip_Version | 4 | | IPv6_address_mode | || IPv6_ra_mode | || name | demo-subnet | | Network_id | 7c6f9b37-76b4-463e-98d8-27e5686ed083 | | tenant_ID | f5b2ccaa75ac413591f12fcaa096aa5c |+-------------------+------------------------------------------------+

Four. Create tenant routes and attach extranet and tenant networks to routes

    • Create a tenant route
neutron router-create demo-router
    • Connecting a router to a tenant network
neutron router-interface-addinterface bff6605d-824c-41f9-b744-21to router demo-router.
    • Connect the router to the external network by setting the gateway
neutron router-gateway-set demo-router ext-net

Five. Verification (self-successful 2 times, failed 3 times, no words)

    • Control node Ping 203.0.113.100 (can ping pass)
ping4203.0.113.100
Create an instance

(In fact, long forgotten, has been created with the Web page, the temperature is a bit)
I. Environment

    • Load Environment
source admin-openrc.sh
    • Generate and add a key pair
nova keypair-add demo-key

Two. Create an instance

    • List flavors, mirroring with network, security group
nova flavor-listnova image-listneutron net-listnova secgroup-list
    • Create an instance (demo_net_id is the ID of the Demo-net network listed above)
Nova Boot --Flavor M1.Tiny --Image Cirros-0.3.4-x86_64 --Nic Net-id=demo_net_id --Security-Group default --Key-name Demo-Key test1
    • Listing instances
nova list+------------------------------------+---------------+--------+------------+-------------+----------------------+|ID                                  |Name           | Status | Task State | Power State | Networks             |+-------------------------------------+--------------+--------+------------+-------------+----------------------+|02caa2ca-d6e6-46fd-b4a9-e432bcde2e6a|test1          | ACTIVE | -          | Running     | demo-net=192.168.1.3 |+------------------------------------+---------------+--------+------------+-------------+----------------------+
    • Access the instance through the browser (load the URL into the browser for viewing)
nova get-vnc-console test1 novnc+-------+---------------------------------------------------------------------------------+| Field | Value                                                                           |+-------+---------------------------------------------------------------------------------+| type  | novnc                                                                           || url   | http://controller:6080/vnc_auto.html?token=5eeccb47-525c-4918-ac2a-3ad1e9f1f493 |+-------+---------------------------------------------------------------------------------+
    • Instance user name: Cirros, Password: cubswin:), no problem, in the console ping Baidu and other external network can be ping through

      Note: Previously built, can run, if there are some questions written above, thank you for pointing out.

Ubuntu Build OpenStack Platform (Kilo) (six. Instantiate a network, create an instance)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.