Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Creating a Network

shoenisch edited this page Apr 18, 2017 · 4 revisions

Here's how you can use the photon subnet command to work with subnets, including virtualized subnets powered by VMware NSX, on the ESXi hosts in a Photon Controller cluster.

You can use either NSX virtualized networking or traditional networking; you cannot mix them. If you want to use NSX, you must set up an NSX network before you install Photon Controller. You cannot change the type of networking after you install Photon Controller. See Setting Up NSX. To take full advantage of the power of Photon Platform, it is recommended that you use Photon Controller with NSX.

To support provider networks, Photon lets you provide NAT subnets.

As a project user in Photon Controller, you can also do the following when you are using NSX virtualized networking:

  • Create additional NSX Tier-1 routers for your projects with the CLI, empowering your projects with flexibility.
  • Create multiple subnets under Tier-1 routers.
  • Associate workloads with each subnet; but Photon Controller supports only 1 subnet per workload.
  • Associate with a workload a floating IP address from a global IP address pool.
  • Disassociate a floating IP address from a workload and return it to the global pool.

With the Photon command-line utility on your workstation, you can view the options of the photon subnet command like this:

photon subnet -h
NAME:
   photon subnet - options for subnet
USAGE:
   photon subnet command [command options] [arguments...]
COMMANDS:
     create       Create a new subnet
     delete       Delete subnet with specified id
     list         List all subnets.
     show         Show subnet info with specified id
     update       Update subnet
     set-default  Set default subnet
OPTIONS:
   --help, -h  show help

Networks in the Context of Multitenancy

In Photon Controller, there can be multiple tenants. Each tenant can have multiple projects, and each project can have multiple VMs. A project can have multiple subnets, including a default subnet. A virtual machine can be associated with a subnet when you create the VM; otherwise, the VM is associated with the default subnet.

Checking the Default Subnet

With a typical installation of Photon Controller without NSX, there is one default subnet, usually VM Network. You can check for a default subnet by running the following command:

photon subnet list
ID                     Name        State  PortGroups    Descriptions         IsDefault
f858e2fd5437c42096940  vm-network  READY  [VM Network]  photon subnet list  true
Total: 1

And then you can view more information about it by citing its ID:

photon subnet show f858e2fd5437c42096940
Network ID: f858e2fd5437c42096940
  Name:        vm-network
  State:       READY
  Description: photon subnet list
  Port Groups: [VM Network]
  Is Default: true

For an installation of Photon Controller with NSX, you can define a default subnet per project under the default Tier-1 router.

Creating a New Subnet

Adding a new subnet and associating it with a Photon Controller project can set aside networking resources for the project's virtual machines and their users.

To create a subnet in the Photon Platform web interface, on the Cloud page, click Networks and then click New Network:

Adding a Network

You can also add a new subnet by running the photon subnet create command. It interactively prompts you to enter the name, description, and port groups of the subnet that you want to create. Photon Controller assigns an ID to the subnet.

Here is the usage information for the photon subnet create command:

photon subnet create --help
NAME:
   photon subnet create - Create a new subnet
USAGE:
   photon subnet create [command options]  
DESCRIPTION:
   Create a new subnet. 
   Examples: 
   Virtual Subnet: 
   photon subnet create -n subnet-1 -d test-subnet -i 192.168.0.0/16 -r 5f8cap789 
   Physical Subnet: 
   photon subnet create -n subnet-1 -d test-subnet -p port1,port2 
OPTIONS:
   --name value, -n value           Name of the subnet
   --description value, -d value    Description of the subnet
   --privateIpCidr value, -i value  The private IP range of subnet in CIDR format, 
                                    e.g.: 192.168.0.0/16
   --router value, -r value         The id of the router on which subnet is to be created
   --type value, -t value           Type of subnet to be created. 
                                    Types: NAT, NO_NAT or PROVIDER. Default: NAT
   --portgroups value, -p value     PortGroups associated with subnet 
                                    (only for physical subnet)

Setting the Default Subnet

Once a subnet is created, you can set it as your default by citing its ID; example:

photon subnet set-default f858e2fd5437c42096940
Are you sure [y/n]? y
SET_DEFAULT_NETWORK completed for 'subnet' entity f858e2fd5437c42096940
Clone this wiki locally