Skip to content

Create a virtual machine on a private network

This guide provides an example of how to create a virtual machine (VM) instance on a private network.

Create a virtual machine on a public network provides an example for creating a virtual machine instance and connecting it directly to the PublicEphemeral network (a shared public network resource).

In this guide, you'll learn how to connect a virtual machine (running Ubuntu-22.04) to a private network. Creating a virtual machine on a private network lets you isolate your cloud resources from external networks and control ingress and egress to specific components such as the virtual machine.

You'll use the PublicStatic external network to connect the private network to the internet. Since PublicStatic does not allow the direct attachment of virtual machines, the network will connect using a router.

You'll learn how to:

  • Create a network and subnet
  • Create a router
  • Create a security group
  • Create a virtual machine instance using an Ubuntu image
  • Add a floating IP address
  • Access the virtual machine
  • Tear down the setup

This guide assumes that:

  • You're signed into Rumble Cloud
  • You've created or uploaded an SSH key pair

If you haven't created a key pair, follow the instructions in Add an SSH Key Pair.

Create a network and subnet

  1. In the Rumble Cloud console, go to Network > Networks > Create Network.
  2. Give the network a name (for example, howtoprivate). You can optionally add a description.
  3. Select the option to create a subnet. A subnet is used to attach the virtual machine to the network.
  4. Give the subnet a name (for example, howtosubnet).
  5. Select ipv4 for IP version.
  6. CIDR is a method for allocating IP addresses. Since this example is creating a private network, it will use a well-known set of IP addresses that are only used privately (that is, not exposed to the internet or external networks). The default value suggested in the user interface (198.168.0.0/24) is part of range of well-known private addresses. For this example, use the value 198.168.200.0/24.
  7. For DNS, use the valid public DNS server. For example, you can use 1.1.1.1, which is Cloudflare's DNS resolver, or 8.8.8.8, which is a DNS server available from Google.
  8. Select OK to create the network.
  9. You'll see the new network in the Networks dashboard under the Current Project Networks tab. Select the new network to view network details. From here you can see the subnet that was created (under the Subnets tab).
  10. You'll also see that a new port was created (under the Ports tab).

Create a router

  1. Go to Network > Routers > Create Router.
  2. Provide a name (for example, howtorouter).
  3. Make sure Attach to Public Network is enabled.
  4. The router will be attached to the PublicStatic network, which enables access to the public internet.
  5. You'll see the new router listed in the Routers dashboard. Select More > Connect Subnet.
  6. Under the Current Project Networks tab, select the new network and the associated subnet. Select OK to connect the router to the subnet.

Create a security group

  1. Go to Network > Security Groups > Create Security Group. This security group will define ingress rules for port 22 on the virtual machine.
  2. You'll see the new security group in the dashboard. Select More > Create Rule.
  3. Provide the following values for the rule definitions. In this example, select SSH to enable SSH connection on port 22. All traffic will be allowed.
    • Protocol: SSH
    • Direction: Ingress
    • Ether Type: IPv4
    • Source: All Traffic -- this sets the remote IP prefix to 0.0.0.0 and allows all traffic

Create a virtual machine instance

  1. Select Compute > Instances.
  2. Select Create Instance.
  3. Select "us-east-1a" for the availability zone.
  4. Select "c2a.large" for the specification.
  5. Select "Ubuntu-22.0" for the operating system.
  6. Select "Flash_Premium" for the system disk type. Note that for the Ubuntu operating system, you’ll need at least 2.20 GiB for the image size. Select 10 GiB for Size. Adding the additional size will give you some extra space to make sure everything works.
  7. Check Deleted with the instance. The system disk is a storage volume that is attached to the instance at the time of creation. This value specifies that the storage volume is deleted when you delete the instance.
  8. Click Next: Network Config.
  9. Select the new network list under the Current Project Networks tab.
  10. For subnets, select the option Automatically Assigned Address for the network.
  11. For security group, select the default and the new security group (you can stack groups; default is always available).
  12. Select Next: System Config.
  13. For login, select Keypair and confirm your choice. Add your key pair for authentication.
  14. Select Next: Confirm Config. You'll see a review of your virtual machine configuration. Select Confirm to create the virtual machine.
  15. You'll see the new VM in the Instances dashboard.

Add a floating IP address (FIP)

  1. Adjacent to the new virtual machine, select More > Related Resources > Associate Floating IP.
  2. For the instance IP, select the IP address listed with the new network.
  3. Select an allocated floating IP address. If there are no IP addresses available, select + Allocate IP.
  4. Select OK. You'll see the floating IP address listed in the Instances dashboard adjacent to the new virtual machine.

Use SSH to access the virtual machine

  1. From the Instances dashboard, copy the Floating IP address for the new instance.
  2. Open the Terminal application. Type the following command, using the floating IP address you copied:

    Bash
    ssh ubuntu@<FLOATING_IP_ADDRESS_FROM_INSTANCE>
    

  3. You’ll see a message about continuing. Type "yes". The command line prompt should now read:

    Bash
    ubuntu@<VM_NAME>
    

  4. Type logout to close the session.

Tear down the virtual machine instance and network

When removing cloud components from your project, you'll typically reverse the order of component creation. For this example, follow these steps.

  1. Delete the virtual machine.
  2. Release (de-allocate) the floating IP address.
  3. Disconnect the router from the subnet.
  4. Detach the router from the public network.
  5. Delete the router.
  6. Delete the network.

See also