Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying OpenStack Networking Cookbook
  • Table Of Contents Toc
OpenStack Networking Cookbook

OpenStack Networking Cookbook

By : Sriram Subramanian
5 (4)
close
close
OpenStack Networking Cookbook

OpenStack Networking Cookbook

5 (4)
By: Sriram Subramanian

Overview of this book

Networking in OpenStack has evolved from Nova Network to Neutron. This has resulted in a rich suite of networking services available to OpenStack users and administrators. Advanced services such as routers, firewall, and load balancers use building blocks such as network and subnets. Recent improvements support powerful customization using plugins. The evolution of Neutron continues as it integrates with tools like Ceilometer and Heat. This book will explore the built-in capabilities of Neutron to effectively deploy cloud solutions. You will begin with the most fundamental constructs of OpenStack Networking for switching and routing. You will then learn how to provide your tenants with services like firewalls and load-balancers. The step-by-step recipes will help you configure and troubleshoot networking problems in your cloud. This book will also introduce you to advanced topics like Ceilometer, Heat, and other upcoming tools in OpenStack
Table of Contents (14 chapters)
close
close
13
Index

Associating a Port to an instance using OpenStack CLI

The previous recipe showed you how to create a Port using CLI. The next recipe shows you how we can use an existing Port as part of the instance creation command.

Getting ready

For this recipe, you will have to identify the Port that you want to associate with an instance. For the instance creation itself, the software image needs to be identified.

How to do it…

The next set of steps will show you how to use the Nova and Neutron CLI commands to create an instance that uses an existing Port:

  1. Using the appropriate credentials, SSH into the OpenStack node where the Neutron and Nova client software packages are installed.
  2. Source the shell RC file to initialize the environment variables required for the CLI commands as seen in the earlier recipes.
  3. Execute the neutron port-list command and identify the ID of the Port that you want to use to create an instance. Make a note of the MAC and IP addresses assigned to the Port:
    How to do it…
  4. The CLI command to create an instance is nova boot. This command supports an argument called --nic that allows us to specify a Port ID that we want to associate with the instance:
    openstack@controller:~$ nova boot --flavor m1.tiny --image cirros-0.3.3-x86_64 --nic port-id=ee6f30a1-6851-435a-89cd-a8e7390325a4 CLIPortVM
    
  5. Note that the virtual machine name used in the command is CLIPortVM. If we execute the nova show command now, we can see the details about the instance:
    How to do it…
  6. In the preceding output, you can see that the IP address of the Port created using CLI has been assigned to the instance.
  7. Log in to the Horizon dashboard and navigate to Network Topology, as discussed in the Viewing the details of a Network using Horizon recipe. In Network Topology, move the mouse pointer over the icon representing the instance and click on Open Console as shown here:
    How to do it…
  8. In the resulting window, log in to the instance. In our example, we will be using the CirrOS default username and password for the login.

    At the shell prompt of the instance, type ifconfig eth0. This command will show the virtual interface for this instance. The command output shows the MAC and IP addresses that are assigned to the virtual interface:

    How to do it…

This recipe demonstrated how to associate a Port to an instance. At the end of the recipe, we can see that the MAC and IP addresses for this virtual interface (eth0) match those of the Port that we used in the nova boot command.

How it works…

We have seen that Neutron assigns an IP address and MAC address to a Port during their creation. When users execute the nova boot command with the --nic option, then Nova takes the IP and MAC addresses of the Port and uses this information to configure the virtual interface of the instance.

There's more…

This technique of creating a Port prior to the instance creation is helpful if a specific IP address needs to be assigned to an instance or virtual machine. While we will cover this in another recipe later in the book, it is important to note that this capability is not available using the Horizon dashboard.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
OpenStack Networking Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon