Difference between revisions of "Networks"

From CAC Documentation wiki
Jump to navigation Jump to search
(Reorganized content, minor edits)
m
 
Line 1: Line 1:
 
[[OpenStack]] provides two kinds of networks, "public" and "private":
 
[[OpenStack]] provides two kinds of networks, "public" and "private":
:* [[#Public Network|Public Networks]] provide public (but possibly restricted) access from the internet but are not guaranteed to use the same IP addresses for [[OpenStack#Instances|instances]] have been shelved and then unshelved.
+
:* [[#Public Network|Public Networks]] provide public (but possibly restricted) access from the internet but are not guaranteed to use the same IP addresses for [[OpenStack#Instances|instances]] that have been shelved and then unshelved.
 
:* [[#Private Networks|Private Networks]], somewhat counter-intuitively, also provide public access from the internet but additionally maintain stable IP addresses for instances.  You can also use a private network to prevent some or all of the instances on the private network from being directly accessible from the internet.
 
:* [[#Private Networks|Private Networks]], somewhat counter-intuitively, also provide public access from the internet but additionally maintain stable IP addresses for instances.  You can also use a private network to prevent some or all of the instances on the private network from being directly accessible from the internet.
  

Latest revision as of 11:10, 27 February 2019

OpenStack provides two kinds of networks, "public" and "private":

  • Public Networks provide public (but possibly restricted) access from the internet but are not guaranteed to use the same IP addresses for instances that have been shelved and then unshelved.
  • Private Networks, somewhat counter-intuitively, also provide public access from the internet but additionally maintain stable IP addresses for instances. You can also use a private network to prevent some or all of the instances on the private network from being directly accessible from the internet.

Each project initially has one default public network, and private networks must be created. A list of the current project's networks can be viewed in the OpenStack Web Interface on the "Networks" tab.

Public Network

  • No action is needed to use this, other than selecting it.
  • This should be acceptable for many uses, e.g. compute instances.
  • IP address will be stable through reboots, but not necessarily through hard shutdowns (e.g. shelving).
  • You cannot assign a floating IP address to an instance via its membership in a public network. Please do not allocate floating IP addresses on a public network.

Private Networks

It is a best practice to create any necessary private networks before creating the instances that will use them. While an instance that was initially attached to a public network can later be attached to a private network, this can lead to problems. If you would like to move an instance from a public to a private network, you should take a snapshot of it and create a new instance from the snapshot and attach the new instance to the private network when launching it.

Set up your own private network by doing the following:

  • ssh into linuxlogin.cac.cornell.edu. This can be done using your CU netid and CAC password: ssh netid@linuxlogin.cac.cornell.edu.
  • Set some environment variables that are required for accessing Red Cloud by sourcing the /opt/openstack/login-redcloud.sh file and responding to its prompts, like this:
 -bash-4.2$ source /opt/openstack/login-redcloud.sh 
 Please enter your CAC project: Enter CAC project name
 Please enter your user name for your CAC project <Your CAC project name>: Enter CAC user name
 Please enter your password for project <Your CAC project name> as user <Your CAC user name>: Enter CAC password
  • Run the network creation script with a single argument (network name), e.g.: /opt/openstack/create-private-net.sh my-net-name

Note that network names are not unique, but network IDs are. Networks and subnets can both be renamed through the Horizon web UI. A network can be renamed without renaming its subnet, which can be renamed separately.

Networks and routers can't be deleted if there are any active connections on them. For the cleanest results, network deletions should be performed using the 'delete network' script rather than through the Horizon web UI: /opt/openstack/delete-private-net.sh

Floating IP Addresses

Each instance on a private network can be assigned a "floating" IP address (called an elastic IP address in AWS). Having an assigned floating IP address makes it more convenient to access an instance and is highly recommended if you plan to have a registered domain name pointing to the instance.

The steps below can be used to create and assign a new floating IP address to an instance that is attached to a private network. As noted before, if you have an instance attached to a public network and want to assign an IP address to it, you will need to move the instance to a private network. See the Private Networks section above.

Steps for creating and assigning a floating (stable) IP address:

  • See the prerequisite steps above for "Creating a private network"
  • In Horizon, under the Networks tab, select "Floating IPs", which should send you here.
  • Click "Allocate IP to Project"
  • The only pool will be "public"; click "allocate".
  • From the list of floating IPs, click "Associate"; make sure you pick a "port" that is an instance's interface on a previously created private network, NOT a public network.
  • Once you no longer need the floating IP, please release it back to the pool by selecting the "Release Floating IP" from the Actions dropdown menu.
  • When changing the associated floating IPs of an instance, security groups may be dropped, so you may need to edit the security groups after the fact from the instance dropdown menu.