Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
OpenStack Networking Cookbook

You're reading from   OpenStack Networking Cookbook Harness the power of OpenStack Networking for public and private clouds using 90 hands-on recipes

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781785286100
Length 282 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Sriram Subramanian Sriram Subramanian
Author Profile Icon Sriram Subramanian
Sriram Subramanian
Chandan Dutta Chandan Dutta
Author Profile Icon Chandan Dutta
Chandan Dutta
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Started with OpenStack Networking FREE CHAPTER 2. Using Open vSwitch for VLAN-Based Networks 3. Exploring Other Network Types in Neutron 4. Exploring Overlay Networks with Neutron 5. Managing IP Addresses in Neutron 6. Using Routing Services in Neutron 7. Using Neutron Security and Firewall Services 8. Using HAProxy for Load Balancing 9. Monitoring OpenStack Networks 10. Writing Your Own Neutron ML2 Mechanism Driver 11. Troubleshooting Tips for Neutron 12. Advanced Topics Index

Creating a Network using OpenStack CLI

We have seen how to use the Horizon dashboard to create a Network. Let's now do the same with OpenStack CLI. Several CLI commands offer additional capabilities when compared to the dashboard. So it is good to develop a sound knowledge of the CLI commands.

Getting ready

You will need the following information to create a Network using CLI:

  • The login credentials for SSH to a node where the Neutron client packages are installed (usually the controller node)
  • A shell RC file that initializes the environment variables for CLI

How to do it…

The next set of steps will show you how to use the Neutron CLI commands to create a Network:

  1. Using the appropriate credentials, SSH into the OpenStack node where the Neutron client software packages are installed.
  2. Source the shell RC file to initialize the environment variables required for the CLI commands:
    openstack@controller:~$ source author_openrc.sh
    
  3. The contents of a typical shell RC file are as follows:
    openstack@controller:~$ cat author_openrc.sh
    export OS_TENANT_NAME=cookbook
    export OS_USERNAME=author
    export OS_PASSWORD=password
    export OS_AUTH_URL=http://controller:35357/v2.0
    openstack@controller:~$ openstack
    
  4. The command to create a Network is neutron net-create, and in the simplest form, the only argument required is the Network name:
    How to do it…
  5. You can view all the Networks created using the neutron net-list command:
    How to do it…
  6. One of the interesting command-line options for the neutron net-create command is the --tenant-id option. This option allows users with an administrative role to create a Network for another tenant. The following screenshot shows you how an administrative user (for an administrative project or tenant) creates a Network for a cookbook tenant:
    How to do it…
  7. The tenant ID argument works only when the user specifies the unique tenant ID. However, sometimes it is convenient to use the tenant name. The following command automates the conversion from the tenant to the tenant ID. The keyword, cookbook, is the tenant name used for this command:
    How to do it…

How it works…

When the user executes the neutron net-create command, the user name and tenant name attributes are taken from the shell environment variables that were initialized at the beginning. Neutron creates the Network with this user and tenant (or project). However, once the --tenant-id option is used, the Network is created on behalf of the tenant whose ID is specified.

There's more…

Users can specify several other arguments while creating Networks. These options are provider:network_type, --provider:segmentation_id, and router:external. While we will be taking a closer look at these parameters in the subsequent chapters, it is important to note that some of these options are available only if users have the administrative privilege.

To view the details of a specific Network, you can use the neutron net-show command.

You have been reading a chapter from
OpenStack Networking Cookbook
Published in: Oct 2015
Publisher:
ISBN-13: 9781785286100
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime