Setting up network connectivity between Yandex BareMetal and Yandex Virtual Private Cloud subnets using Yandex Cloud Interconnect
Yandex Cloud Interconnect-based network connectivity in Yandex BareMetal enables access to CIDRs
In this tutorial, you will set up network connectivity between a BareMetal server located in a private Yandex BareMetal subnet and a Yandex Compute Cloud VM located in a subnet of a Yandex Virtual Private Cloud cloud network.
Similarly, you can set up network connectivity with your on-prem resources located in private subnets within your own network infrastructure.
You can use Yandex Cloud Interconnect free of charge as part of integration with Yandex BareMetal.
You can see the solution architecture in the diagram below:
To set up network connectivity between BareMetal and Virtual Private Cloud subnets using Cloud Interconnect:
- Get your cloud ready.
- Create a cloud infrastructure.
- Request a routing instance.
- Create a private connection.
- Check network connectivity.
If you no longer need the resources you created, delete them.
Getting started
Sign up for Yandex Cloud and create a billing account:
- Navigate to the management console
and log in to Yandex Cloud or create a new account. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVEorTRIAL_ACTIVEstatus. If you do not have a billing account, create one and link a cloud to it.
If you have an active billing account, you can navigate to the cloud page
Learn more about clouds and folders here.
Required paid resources
The cost of supporting an infrastructure for network connectivity between BareMetal and VPC subnets includes:
- Fee for using the VM public IP address (see Yandex Virtual Private Cloud pricing).
- Fee for VM computing resources and disks (see Yandex Compute Cloud pricing).
- BareMetal server lease fee (see Yandex BareMetal pricing).
Traffic transmitted via Yandex Cloud Interconnect between private Yandex BareMetal and Yandex Virtual Private Cloud addresses in either direction is not billable.
Create a cloud infrastructure
Create the Yandex Cloud infrastructure you will use to set up network connectivity.
To configure Cloud Interconnect in BareMetal, you will need a private routable subnet and a VRF segment in BareMetal, a cloud network with one or more Virtual Private Cloud subnets, as well as a routing instance with at least one announced VPC private subnet prefix.
To check network connectivity, you will need a BareMetal server and a Compute Cloud VM.
Create a VRF segment and a BareMetal private subnet
Create a virtual network segment (VRF) and a private subnet in the ru-central1-m3 server pool:
- In the management console
, select the folder where you are going to create your infrastructure. - In the list of services, select BareMetal.
- Create a virtual routing and forwarding segment:
- In the left-hand panel, select
VRF and click Create VRF. - In the Name field, name your VRF segment:
my-vrf. - Click Create VRF.
- In the left-hand panel, select
- Create a private subnet:
- In the left-hand panel, select
Private subnets and click Create subnet. - In the Pool field, select the
ru-central1-m3server pool. - In the Name field, enter a name for the subnet:
subnet-m3. - Enable IP addressing and routing.
- In the Virtual network segment (VRF) field, select the previously created segment,
my-vrf. - In the CIDR field, specify
192.168.1.0/24. - In the Default gateway field, keep the default value,
192.168.1.1. - Enable the Assigning IP addresses via DHCP option and in the IP address range field that appears, leave the default values,
192.168.1.1—192.168.1.254. - Click Create subnet.
- In the left-hand panel, select
Lease a BareMetal server
-
In the management console
, select the folder where you are deploying your infrastructure. -
In the list of services, select BareMetal and click Lease server.
-
Under Configuration, click the
Poolfilter and select theru-central1-m3server pool. -
Under Configuration, select the appropriate server configuration.
-
(Optional) Under Disk, configure disk partitioning:
-
Click Configure disk layout.
-
Specify the partitioning parameters. To create a new partition, click
Add partition.To build RAID arrays and configure disk partitions yourself, click Remove RAID.
-
Click Save.
-
-
Under Image, select an image, e.g.,
Ubuntu 24.04. -
In the Lease duration field, select a lease period:
1 day,1 month,3 months,6 months, or1 year.When this period expires, server lease will automatically be renewed for the same period. You cannot terminate the lease during the specified lease period, but you can refuse to extend the server lease further.
-
Under Private network, in the Private subnet field, select the
subnet-m3subnet you created earlier. -
Under Public network, select
No addressin the Public address field. -
Under Access:
-
In the Password field, select one of the following options to create a root password:
-
To generate a new root password, select
New passwordand click Generate.Warning
This option requires you to maintain password security. Save the password you generated in a secure location. Yandex Cloud does not store it, and you will not be able to retrieve it once the server is deployed.
-
To use the root password saved in a Yandex Lockbox secret, select
Lockbox secret.In the Name, Version, and Key fields, select the secret containing your password, its version, and its key, respectively.
If you do not have a Yandex Lockbox secret, click Create to create it.
Choose the
Customsecret type to specify a custom password orGeneratedto generate password automatically.
-
-
In the Public SSH key field, select the SSH key saved in your organization user profile.
If there are no SSH keys in your profile or you want to add a new key:
-
Click Add key.
-
Enter a name for the SSH key.
-
Select one of the following:
-
Enter manually: Paste the contents of the public SSH key. You need to create an SSH key pair on your own. -
Load from file: Upload the public part of the SSH key. You need to create an SSH key pair on your own. -
Generate key: Automatically create an SSH key pair.When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the
/home/<user_name>/.sshdirectory. In Windows, unpack the archive to theC:\Users\<user_name>/.sshdirectory. You do not need additionally enter the public key in the management console.
-
-
Click Add.
The system will add the SSH key to your organization user profile. If the organization has disabled the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.
-
-
-
Under Server information, in the Name field, enter the server name:
server-m3. -
Click Lease server.
Note
Server setup and OS installation may take up to 45 minutes. The server will have the Provisioning status during this time. After OS installation is complete, the server status will change to Ready.
Create a cloud network and subnet
Create a cloud network and subnet to connect the Compute Cloud VM to.
-
In the management console
, select the folder where you are deploying your infrastructure. -
In the list of services, select Virtual Private Cloud.
-
Create a cloud network:
-
At the top right, click Create network.
-
In the Name field, specify
sample-network. -
In the Advanced field, disable Create subnets.
-
Click Create network.
-
-
Create a subnet:
-
In the left-hand panel, select
Subnets. -
At the top right, click Create subnet.
-
In the Name field, specify
subnet-ru-central1-b. -
In the Availability zone field, select
ru-central1-b. -
In the Network field, select
sample-network. -
In the CIDR field, specify
192.168.11.0/24.Warning
To successfully configure network connectivity between BareMetal subnets and on-premise or VPC subnets, their CIDR address ranges must not match or overlap.
-
Click Create subnet.
-
Create a VM
-
In the management console
, select the folder to create the infrastructure in. -
In the list of services, select Compute Cloud.
-
In the left-hand panel, select
Virtual machines and click Create virtual machine. -
Under Boot disk image, select an appropriate VM image, e.g., Ubuntu 24.04.
-
Under Location, select the
ru-central1-bavailability zone. -
Under Network settings:
- In the Subnet field, select the
subnet-ru-central1-bsubnet you created earlier. - In the Public IP address field, select
Auto.
- In the Subnet field, select the
-
Under Access, select SSH key and specify the VM access credentials:
- In the Login field, enter the username:
yc-user. -
In the SSH key field, select the SSH key saved in your organization user profile.
If there are no SSH keys in your profile or you want to add a new key:
-
Click Add key.
-
Enter a name for the SSH key.
-
Select one of the following:
-
Enter manually: Paste the contents of the public SSH key. You need to create an SSH key pair on your own. -
Load from file: Upload the public part of the SSH key. You need to create an SSH key pair on your own. -
Generate key: Automatically create an SSH key pair.When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the
/home/<user_name>/.sshdirectory. In Windows, unpack the archive to theC:\Users\<user_name>/.sshdirectory. You do not need additionally enter the public key in the management console.
-
-
Click Add.
The system will add the SSH key to your organization user profile. If the organization has disabled the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.
-
- In the Login field, enter the username:
-
Under General information, specify the VM name:
sample-vm. -
Click Create VM.
Create a routing instance
To set up network connectivity between BareMetal subnets, Virtual Private Cloud subnets, and/or on-prem subnets, you need to create a Routing Instance resource. To create a Routing Instance, contact
If your folder already has Cloud Interconnect network connectivity (VPC-to-On-Prem) configured, you can either use the existing Routing Instance or request a new additional Routing Instance to be created for standalone network connectivity.
Make sure you have a routing instance in your folder
-
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the
yc config set folder-id <folder_ID>command. You can also set a different folder for any specific command using the--folder-nameor--folder-idparameter. -
Make sure you have a routing instance in your default folder:
CLIRun this command:
yc cloudrouter routing-instance listIf your folder already contains a routing instance, the command will output something like this:
+----------------------+-------------------------------------------+--------+-----------------------+ | ID | NAME | STATUS | PRIVATE CONNECTION ID | +----------------------+-------------------------------------------+--------+-----------------------+ | cf35oot8f0eu******** | ajeol2afu1js********-enpcfncr6uld******** | ACTIVE | cf395uf8dg7h******** | +----------------------+-------------------------------------------+--------+-----------------------+ -
If you already have a routing instance, you may skip the next step and proceed to creating a private connection.
If you do not have a routing instance or you want to build additional dedicated network connectivity, request a new routing instance.
Request a new routing instance
Contact
Fill out your request as follows:
Subject: [CIC for BareMetal] Creating a routing instance.
Request text:
Please create a routing instance in the specified cloud folder with the following parameters:
folder_id: <folder_ID>
vpc:
vpc_net_id: <network_ID>
vpc_subnets:
ru-central1-a: [CIDR_a1, CIDR_a2, ..., CIDR_an]
ru-central1-b: [CIDR_b1, CIDR_b2, ..., CIDR_bn]
ru-central1-d: [CIDR_d1, CIDR_d2, ..., CIDR_dn]
Where:
-
folder_id: Folder ID. -
vpc_net_id: Cloud network ID. -
vpc_subnets: List of announced address prefixes for each availability zone. For example, for the VPC subnet you created earlier, you will specifyru-central1-b: [192.168.11.0/24].You may announce aggregated address prefixes.
Note
It may take up to 24 hours for the support to create a routing instance. With that done, you will be able to get the ID of the new routing instance by running the yc cloudrouter routing-instance list Yandex Cloud CLI command.
Create a private connection
Once the routing instance has been created in your folder, create a private Cloud Interconnect connection in BareMetal:
-
In the management console
, select the folder where you want to create your private connection. -
In the list of services, select BareMetal.
-
In the left-hand panel, select
VRF and then select the virtual network segment you need. -
Under Private connection to cloud networks, click Configure connection, and in the window that opens:
-
In the Setup method field, select
Enter IDand paste theRouting Instanceprivate connection ID to the Connection ID field.You can also select the
Choose from folderoption. In this case, select theRouting Instanceyou need from the list that opens.As a result, you will see the CIDR blocks of Virtual Private Cloud subnets that will be advertised over Cloud Interconnect.
Warning
To successfully configure network connectivity between BareMetal subnets and on-premise or VPC subnets, their CIDR address ranges must not match or overlap.
-
To create a private connection for the specified CIDR subnets, click Save.
-
As a result, the VRF information page will display the newly created connection ID and its status under Private connection to cloud networks.
Note
Setting up a private connection may take up to two business days. During this period, the connection status will display as Creating. Once the connection is created, its status will change to Ready.
Private cloud netweork connections may show one of the following statuses:
CREATING: Connection creation in progress.READY: Connection is up and ready to use.ERROR: Connection failure. Contact support.DELETING: Connection deletion in progress.UPDATING: Connection settings update in progress.
Test network connectivity
As soon as the status of the new private connection changes to Ready, network connectivity between the BareMetal and VPC subnets will be established, and you can start checking it.
A network connectivity check assumes that:
- The process of setting up a private connection to cloud networks has been successfully completed (the connection status is
Ready). - The local firewall on the BareMetal server allows ICMP
traffic. - The routing table in the BareMetal server OS contains a route to the CIRD of the subnet the VM resides in.
- The security group assigned to the VM network interface allows ICMP traffic.
Test network connectivity between a private BareMetal subnet and a private VPC subnet
-
In the management console
, select the folder where you created the infrastructure. -
In the list of services, select BareMetal.
-
Next to
server-m3, click and select KVM console.The KVM console terminal window will open, showing a login prompt:
server-m3 login:If you do not see this prompt, try restarting the server.
-
In the KVM console terminal, specify
rootfor the username and press ENTER. -
Paste the password generated when leasing the server in the password input line and press ENTER. Note that when typing or pasting a password in Linux, the characters you enter will not appear on the screen.
Tip
To paste clipboard text to the KVM console, use the Paste text here field in the upper right corner.
Result:
Welcome to Ubuntu 24.04.2 LTS (GNU/Linux 6.8.0-53-generic x86_64) ... root@server-m3:~# _If you did not save the server administrator password, you can create a new password following this guide or reinstall the server OS.
-
In the KVM console terminal, run the
pingcommand to make sure you can accesssample-vmby its internal IP address:ping <VM_internal_IP_address> -c 5You can find the VM internal IP address in the management console
under Network interface on the VM information page.Result:
PING 192.168.11.2 (192.168.11.2) 56(84) bytes of data. 64 bytes from 192.168.11.2: icmp_seq=1 ttl=64 time=3.90 ms 64 bytes from 192.168.11.2: icmp_seq=2 ttl=64 time=0.235 ms 64 bytes from 192.168.11.2: icmp_seq=3 ttl=64 time=0.222 ms 64 bytes from 192.168.11.2: icmp_seq=4 ttl=64 time=0.231 ms 64 bytes from 192.168.11.2: icmp_seq=5 ttl=64 time=0.235 ms --- 192.168.11.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4086ms rtt min/avg/max/mdev = 0.222/0.964/3.899/1.467 msNetwork connectivity between the BareMetal server and the VM has been established with zero packet loss.
Test network connectivity between a private VPC subnet and a private BareMetal subnet
-
Connect to the virtual machine over SSH.
-
In the terminal, run the
pingcommand to make sure you can accessserver-m3by its private IP address:ping <server_private_IP_address> -c 5You can learn the BareMetal server's private IP address in the management console
under Network settings on the server information page.Result:
PING 192.168.1.3 (192.168.1.3) 56(84) bytes of data. 64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=0.271 ms 64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=0.215 ms 64 bytes from 192.168.1.3: icmp_seq=3 ttl=64 time=0.262 ms 64 bytes from 192.168.1.3: icmp_seq=4 ttl=64 time=0.223 ms 64 bytes from 192.168.1.3: icmp_seq=5 ttl=64 time=0.208 ms --- 192.168.1.3 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4106ms rtt min/avg/max/mdev = 0.208/0.235/0.271/0.025 msNetwork connectivity between the VM and the BareMetal server has been established with zero packet loss.
How to delete the resources you created
To stop paying for the resources you created:
-
Delete the VM.
-
You cannot delete a BareMetal server. Instead, cancel the server lease renewal.
-
Delete the private connection if you no longer need it:
Management console- In the management console
, select the folder where you created the infrastructure. - In the list of services, select BareMetal.
- In the left-hand panel, click
VRF and selectmy-vrf. - Under Private connection to cloud networks, click
and select Disable connection. - In the window that opens, confirm the deletion.
The connection status will change to
Deleting. Once all links are deleted, the connection will disappear from the list. - In the management console