Set up a development machine

In this example, a user wants to spin up a machine to use as a Linux development environment. This user has a straightforward use-case: they want a GUI and SSH access, but relatively little else.

This user is provisioned with a single OpenStack user and single OpenStack tenant. Neutron will automatically provision them with a single security group, default, that contains the following rules:

  • allow all inbound traffic from machines in the default security group
  • allow all outbound traffic to anywhere

Per the instructions in IP addressing and connectivity, this user cannot create Neutron networks or subnets, but they do have access to the networks created by the administrator: external and internal.

Because the user wants to be able to reach the machine from their own laptop, they need the machine to be reachable from outside the data center. In vanilla Neutron, this would mean provisioning it with a floating IP, but in Calico they instead want to make sure the VM is attached to the external network. To add themselves to this network, the user needs to find out the UUID for it.

  1. neutron net-list

This should return something like the following.

  1. +--------------------------------------+----------+----------------------------------------------------------+
  2. | id | name | subnets |
  3. +--------------------------------------+----------+----------------------------------------------------------+
  4. | 8d5dec25-a6aa-4e18-8706-a51637a428c2 | external | 54db559c-5e1d-4bdc-83b0-c479ef2a0ead 172.18.208.0/24 |
  5. | | | cf6ceea0-dde0-4018-ab9a-f8f68935622b 2001:db8:a41:2::/64 |
  6. | fa52b704-7b3c-4c83-8698-244807352711 | internal | 301b3e63-5324-4d62-8e22-ed8dddd50689 10.65.0.0/16 |
  7. | | | bf94ccb1-c57c-4c9a-a873-c20cbfa4ecaf 2001:db8:a41:3::/64 |
  8. +--------------------------------------+----------+----------------------------------------------------------+

In the example above, the external network has the UUID 8d5dec25-a6aa-4e18-8706-a51637a428c2. Thus, the machine can be created with the following nova boot command.

  1. nova boot --flavor m1.medium \
  2. --image debian-wheezy-amd64 \
  3. --security-groups default \
  4. --nic "netid=8d5dec25-a6aa-4e18-8706-a51637a428c2" \
  5. development-server

This places the VM with a single NIC in the external network. The VM starts to boot, and Neutron allocates it an IP address in the external network: in this case, both an IPv4 and IPv6 address, as you can see below:

  1. +--------------------------------------+-----------------------------------------------------------+
  2. | Property | Value |
  3. +--------------------------------------+-----------------------------------------------------------+
  4. | external network | 2001:db8:a41:2::1c, 172.18.208.85 |
  5. | flavor | m1.medium (3) |
  6. | hostId | b80247c27400fc9048ca569c8635f00801654bf676a00d8f08887215 |
  7. | id | e36f4e62-0efa-4188-87b8-8c96dc6e6028 |
  8. | name | development-server |
  9. | security_groups | default |
  10. +--------------------------------------+-----------------------------------------------------------+

While the machine boots, the security group can be configured. It needs four extra rules: one for SSH and three for VNC. In this example, developer’s personal machine has the IPv4 address 191.64.52.12, and that’s the only machine they’d like to be able to access their machine. For that reason, they add the four security group rules as follows.

To add the SSH ingress rule:

  1. neutron security-group-rule-create --protocol tcp \
  2. --port-range-min 22 \
  3. --port-range-max 22 \
  4. --direction ingress \
  5. --remote-ip-prefix 191.64.52.12/32 \
  6. --ethertype IPv4 \
  7. default

To add the first VNC rule:

  1. neutron security-group-rule-create --protocol tcp \
  2. --port-range-min 5800 \
  3. --port-range-max 5801 \
  4. --direction ingress \
  5. --remote-ip-prefix 191.64.52.12/32 \
  6. --ethertype IPv4 \
  7. default

To add the second VNC rule:

  1. neutron security-group-rule-create --protocol tcp \
  2. --port-range-min 5900 \
  3. --port-range-max 5901 \
  4. --direction ingress \
  5. --remote-ip-prefix 191.64.52.12/32 \
  6. --ethertype IPv4 \
  7. default

To add the third VNC rule:

  1. neutron security-group-rule-create --protocol tcp \
  2. --port-range-min 6000 \
  3. --port-range-max 6001 \
  4. --direction ingress \
  5. --remote-ip-prefix 191.64.52.12/32 \
  6. --ethertype IPv4 \
  7. default

At this stage, the developer’s machine is up and running. It can be reached on its public IP (172.18.208.85), and the developer confirms this by SSHing into their box. They’re now ready to go.