VK Cloud logo

Cloud Network: create a virtual network and configure a security group

Cloud Network is a group of services for managing network connectivity in VK Cloud. These services enable data exchange between resources connected to a virtual network.

Similar to physical local networks, a virtual network has its own subnets — IP address ranges. When connecting to a virtual network, each cloud resource receives its own IP address and can exchange traffic both within its subnet and between different subnets of the same network.

Start working with Cloud Network in any convenient way:

  • Use the guide to create your own virtual network with several virtual machines and configure traffic rules.
  • Take the free training course to get familiar with the service capabilities.

Create and configure a virtual network with VMs

After completing all the steps of this guide, you will:

  1. Create a virtual network with and without internet access.
  2. Create virtual machines with different options for connecting to networks.
  3. Create a security group in which you will configure rules for managing traffic.
  4. Create a security group for VMs to allow traffic transmission.
  5. Check network connectivity between VMs.
  6. Check internet access.
  7. Check connection to VMs via SSH.

1. Create networks and subnets

  1. Go to your VK Cloud management console.

  2. Go to Virtual networks → Networks.

  3. Create a network with internet access:

    1. Click the Create button.
    2. Set the network name: test-network.
    3. Select SDN: Sprut (default). The setting is unavailable if only one SDN is connected to the project.
    4. Enable the Internet access option.
    5. From the Router list, select Create new.
    6. Click the Add network button.
  4. Create a network without internet access:

    1. Click the Create button.
    2. Set the network name: test-network-2.
    3. Select SDN: Sprut (default). The setting is unavailable if only one SDN is connected to the project.
    4. Disable the Internet access option.
    5. From the Router list, select Create new.
    6. Click the Add network button.

2. Create several virtual machines

Create one VM with internet access and three VMs without internet access.

  1. Go to your VK Cloud management console.

  2. Go to Cloud Computing → Virtual machines.

  3. Click the Add button.

  4. In the Configuration block, set the VM parameters that match your requirements.

  5. Fill in the General information block:

    • Virtual machine name: test-vm1.
    • Leave the other parameters unchanged.
  6. In the Disk size and speed block, select the appropriate disk type and specify its size.

  7. In the Network and firewall settings block, set the following parameters:

    • Network: External network (internet).
    • Virtual machine key: Create a new key.
    • Firewall settings: add the default, ssh security groups.
    • Leave the other settings unchanged.
  8. Click the Next step button.

  9. In the Backup block, disable backup.

  10. Click the Create button.

Creating the virtual machines may take some time, after which they will appear in the list. The SSH keys of the virtual machines will be downloaded to your computer.

3. Create a security group

  1. Go to your VK Cloud management console.

  2. Go to Virtual networks → Firewall settings.

  3. Click the Add button.

  4. Set the rule group name: test-icmp.

  5. Select SDN: Sprut (default). The setting is unavailable if only one SDN is connected to the project.

  6. Click the Create group button.

  7. In the Inbound traffic block, create rules to manage traffic:

    1. Click Add rule.
    2. Select type: ICMP.
    3. Select remote address: All IP addresses.
  8. Click the Save rule button.

  9. In the Outbound traffic block, create rules to manage traffic:

    1. Click Add rule.
    2. Select type: ICMP.
    3. Select remote address: All IP addresses.
  10. Click the Save rule button.

4. Assign the security group

To send and receive traffic, assign a security group to the VM. Apply the following settings to the previously created VMs:

  1. Go to your VK Cloud management console.
  2. Go to Cloud Computing → Virtual machines.
  3. Click  for the virtual machine and select Firewall settings.
  4. Find the previously created security group in the list.
  5. Click Apply in the row with the security group.
  6. Click the Confirm button.

5. Check network connectivity between VMs

  1. Go to your VK Cloud management console.

  2. Go to Cloud Computing → Virtual machines.

  3. For each VM in the internet and test-network networks, perform the following actions:

    1. Open the test-vm1 VM page by clicking its name in the list.
    2. Go to the Console tab.
    3. Log in to the VM.
    4. Run the ping <TEST_VM2_VM_IP_ADDRESS> command. Make sure that the packets arrive successfully.

6. Check internet access

  1. Go to your VK Cloud management console.

  2. Go to Cloud Computing → Virtual machines.

  3. Open the test-vm4 VM page by clicking its name in the list.

  4. Go to the Console tab.

  5. Log in to the VM.

  6. Ping an external resource on the internet using the command:

    ping cloud.vk.com

    There is no internet connection, so packet exchange does not occur.

  7. Go to Virtual networks → Routers.

  8. Find the router with the test-network-2 network and click its name.

  9. Click the Edit router button.

  10. In the window that opens, enable the External network connection option.

  11. Click the Save button.

  12. Return to the test-vm4 VM page.

  13. Go to Cloud Computing → Virtual machines.

  14. Click  for test-vm4 and select Reboot.

  15. Open the test-vm4 VM page by clicking its name in the list.

  16. Go to the Console tab.

  17. Log in to the VM.

  18. Ping an external resource on the internet using the command:

    ping cloud.vk.com

    The internet connection works correctly, so packet exchange occurs.

7. Connect to the VM via SSH

  1. Open the terminal.

  2. Go to the directory where the SSH keys for connecting to the created VMs were saved.

  3. Make the key accessible only to the current user:

    chmod 400 <PATH_TO_TEST_VM2_VM_KEY>
  4. Connect to the test-vm2 VM via the SSH protocol:

    ssh -i <PATH_TO_KEY> <USERNAME>@<FLOATING_IP>

    Make sure there are no connection errors.

Delete unused resources

Running VMs consume computing resources. If you no longer need them:

  • delete the created VMs;
  • delete the test-network and test-network-2 networks.

Training course

Take the free training course.

The theoretical part of the course explains how virtual networks, routers, and network access control systems work. In the practical part, you will create your own virtual network with a subnet, verify the resulting network topology in an interactive editor, and also get acquainted with routers and security groups in the VK Cloud management console.

FAQ

Was this article helpful?