Troubleshooting in Compute Cloud
This section describes typical problems that may arise when using Compute Cloud and the relevant solutions.
You cannot connect to a new VM with multiple network interfaces over SSH
When creating a Linux VM with multiple network interfaces, the additional network interfaces may not work correctly in the OS. In some cases, this issue can hinder network connectivity and prevent you from connecting to the VM over SSH.
To fix the issue, delete the VM and create a new one by providing additional cloud-init
Expand the Metadata section and add the user-data
key with the following configuration:
For Ubuntu
In the write_files.content.network.ethernets
configuration section, specify the settings for the required number of network interfaces you want to create on this VM, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.
#cloud-config
datasource:
Ec2:
strict_id: false
ssh_pwauth: yes
users:
- name: <username>
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
ssh_authorized_keys:
- <public_SSH_key>
write_files:
- path: "/etc/netplan/01-netcfg.yaml"
permissions: "0644"
content: |
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
eth1:
dhcp4: yes
dhcp4-overrides:
use-dns: false
use-routes: false
dhcp6: no
eth2:
dhcp4: yes
dhcp4-overrides:
use-dns: false
use-routes: false
dhcp6: no
runcmd:
- sleep 1
- sudo -i
- netplan apply
For Debian
In the Primary network interface
and Other network interfaces
configuration sections, specify the settings for the required number of network interfaces you want to create on this VM, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.
#cloud-config
datasource:
Ec2:
strict_id: false
ssh_pwauth: yes
users:
- name: <username>
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
ssh_authorized_keys:
- <public_SSH_key>
write_files:
- path: "/etc/network/interfaces"
permissions: "0644"
content: |
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# Loopback network interface
auto lo
iface lo inet loopback
# Primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
# Other network interfaces
auto eth1
allow-hotplug eth1
iface eth1 inet dhcp
auto eth2
allow-hotplug eth2
iface eth2 inet dhcp
post-up ip route del default
runcmd:
- sleep 1
- sudo -i
- systemctl restart networking
Where:
name:
: Username for connecting to the VM over SSH.ssh_authorized_keys:
: List of public SSH keys to connect the user to the VM over SSH. You need to specify at least one public SSH key.
-
Create a file with the cloud-init configuration, e.g.,
vm-init.tpl
:For Ubuntu
In the
write_files.content.network.ethernets
configuration section, specify the settings for the required number of network interfaces you want to create on this VM, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.#cloud-config datasource: Ec2: strict_id: false ssh_pwauth: yes users: - name: <username> sudo: ALL=(ALL) NOPASSWD:ALL shell: /bin/bash ssh_authorized_keys: - <public_SSH_key> write_files: - path: "/etc/netplan/01-netcfg.yaml" permissions: "0644" content: | # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eth0: dhcp4: yes eth1: dhcp4: yes dhcp4-overrides: use-dns: false use-routes: false dhcp6: no eth2: dhcp4: yes dhcp4-overrides: use-dns: false use-routes: false dhcp6: no runcmd: - sleep 1 - sudo -i - netplan apply
For Debian
In the
Primary network interface
andOther network interfaces
configuration sections, specify the settings for the required number of network interfaces you want to create on this VM, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.#cloud-config datasource: Ec2: strict_id: false ssh_pwauth: yes users: - name: <username> sudo: ALL=(ALL) NOPASSWD:ALL shell: /bin/bash ssh_authorized_keys: - <public_SSH_key> write_files: - path: "/etc/network/interfaces" permissions: "0644" content: | # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # Loopback network interface auto lo iface lo inet loopback # Primary network interface allow-hotplug eth0 iface eth0 inet dhcp # Other network interfaces auto eth1 allow-hotplug eth1 iface eth1 inet dhcp auto eth2 allow-hotplug eth2 iface eth2 inet dhcp post-up ip route del default runcmd: - sleep 1 - sudo -i - systemctl restart networking
-
When creating a VM, provide the created configuration file to it in the
--metadata-from-file
parameter, e.g.:yc compute instance create --name=multi-net-vm --hostname=multi-net-vm \ --zone ru-central1-a \ --create-boot-disk image-folder-id=standard-images,image-id=fd8bi0vgcf8vco49q3bm \ --cores=2 --memory=4G --core-fraction=100 \ --network-interface subnet-name=subnet1,ipv4-address=auto,nat-ip-version=ipv4 \ --network-interface subnet-name=subnet2,ipv4-address=auto \ --network-interface subnet-name=subnet3,ipv4-address=auto \ --metadata-from-file user-data=vm-init.tpl
-
Create a file with the cloud-init configuration, e.g.,
vm-init.tpl
:For Ubuntu
In the
write_files.content.network.ethernets
configuration section, specify the settings for the required number of network interfaces you want to create on this VM, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.#cloud-config datasource: Ec2: strict_id: false ssh_pwauth: yes users: - name: <username> sudo: ALL=(ALL) NOPASSWD:ALL shell: /bin/bash ssh_authorized_keys: - <public_SSH_key> write_files: - path: "/etc/netplan/01-netcfg.yaml" permissions: "0644" content: | # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eth0: dhcp4: yes eth1: dhcp4: yes dhcp4-overrides: use-dns: false use-routes: false dhcp6: no eth2: dhcp4: yes dhcp4-overrides: use-dns: false use-routes: false dhcp6: no runcmd: - sleep 1 - sudo -i - netplan apply
For Debian
In the
Primary network interface
andOther network interfaces
configuration sections, specify the settings for the required number of network interfaces you want to create on this VM, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.#cloud-config datasource: Ec2: strict_id: false ssh_pwauth: yes users: - name: <username> sudo: ALL=(ALL) NOPASSWD:ALL shell: /bin/bash ssh_authorized_keys: - <public_SSH_key> write_files: - path: "/etc/network/interfaces" permissions: "0644" content: | # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # Loopback network interface auto lo iface lo inet loopback # Primary network interface allow-hotplug eth0 iface eth0 inet dhcp # Other network interfaces auto eth1 allow-hotplug eth1 iface eth1 inet dhcp auto eth2 allow-hotplug eth2 iface eth2 inet dhcp post-up ip route del default runcmd: - sleep 1 - sudo -i - systemctl restart networking
-
When creating a VM, provide the created metadata file to it in the
yandex_compute_instance.metadata
section, e.g.:resource "yandex_compute_instance" "multi-net-vm" { name = "multi-net-vm" platform_id = "standard-v2" zone = "ru-central1-a" resources { cores = "2" memory = "2" } boot_disk { initialize_params { image_id = "fd8bi0vgcf8vco49q3bm" } } network_interface { subnet_id = "e2lrucutusnd********" nat = true } network_interface { subnet_id = "e2lpp96bvvgp********" nat = false } network_interface { subnet_id = "e2lv9c6aek1d********" nat = false } metadata = { user-data = "${file("./vm-init.tpl")}" } }
Additional network interfaces do not work after you attach them to the existing VM
After you attach additional network interfaces to a Linux VM, they may fail to work correctly in the operating system. In some cases, this issue can hinder network connectivity and prevent you from connecting to the VM over SSH.
To fix this issue, try upgrading the VM's operating system to its latest version.
If upgrading the OS is not possible or does not help:
-
Connect to the VM over SSH.
If the SSH connection fails due to network connectivity issues, remove all the additional network interfaces and reboot the VM.
-
Update the OS network configuration:
UbuntuDebian-
Add the configuration of the new network interfaces to the
/etc/netplan/01-netcfg.yaml
file:sudo nano /etc/netplan/01-netcfg.yaml
In the
write_files.content.network.ethernets
configuration section, specify the settings for the required number of existing or new VM network interfaces, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.# This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: eth0: dhcp4: yes eth1: dhcp4: yes dhcp4-overrides: use-dns: false use-routes: false dhcp6: no eth2: dhcp4: yes dhcp4-overrides: use-dns: false use-routes: false dhcp6: no
-
Assign the required permissions to the
/etc/netplan/01-netcfg.yaml
file:sudo chmod 0644 /etc/netplan/01-netcfg.yaml
-
Apply the configuration changes:
sudo netplan apply
-
Add the configuration of the new network interfaces to the
/etc/network/interfaces
file:sudo nano /etc/network/interfaces
In the
Primary network interface
andOther network interfaces
configuration sections, specify the settings for the required number of existing or new VM network interfaces, as shown below. Interfaces are numbered starting from zero. This example shows how to set up three interfaces. You can add up to eight network interfaces to a single VM.# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # Loopback network interface auto lo iface lo inet loopback # Primary network interface allow-hotplug eth0 iface eth0 inet dhcp # Other network interfaces auto eth1 allow-hotplug eth1 iface eth1 inet dhcp auto eth2 allow-hotplug eth2 iface eth2 inet dhcp post-up ip route del default
-
Restart the network service:
sudo systemctl restart networking
-
-
If you previously had to remove additional network interfaces, attach them again.