Network on a VM
When creating a VM, you need to specify settings for the network interface connected to it: select the subnet to connect the VM to, and configure its internal and public IP addresses. This allows the VM to interact with other services on the intranet and internet.
After the network interface is connected, the VM will be assigned the internal IP address in the subnet and FQDN. The public IP address will only be assigned if this was set when creating the VM.
The network interface can only be configured when creating VMs. For example, you can't connect a VM to a different subnet after you created it.
You can find out the IP addresses, FQDN and other information in the management console (go to the Network section on the virtual machine's page). This data can be used to connect to the VM.
On VMs created from public Linux images, the IP address and hostname (FQDN) are not automatically written to the
/etc/hosts file. This can affect the execution of the
Internal IP address
You can specify the internal IP address at which the VM will be accessible after being created. If no internal IP address is specified, it will be assigned automatically.
Only IPv4 addresses are currently supported. Yandex Compute Cloud VMs and DB hosts provide access to and from the internet via public IP addresses only.
The internal IP address can be used to access a VM from another VM. You can use the internal IP address only to connect to the VMs that belong to the same cloud network.
The internal IP address cannot be changed.
Public IP address
You can get a public IP address to access a VM from the internet.
A public IP address is assigned automatically and cannot be chosen. The address is allocated from the pool of Yandex.Cloud addresses.
When a VM is stopped, its public IP address is released, and the next time the VM is started, it gets a new public IP address. When the VM is restarted, its public IP address is saved.
You can make a public IP address static. For more information, see Making a VM's public IP address static.
For more information about IP address pricing, see the section Public IP addresses in the Virtual Private Cloud service documentation.
The VM's public IP address is mapped to its internal IP address via NAT. Therefore, all requests to the VM from the external IP address are sent to the internal IP address. For more information about NAT, see RFC 3022.
Hostname and FQDN
When creating a VM, it is assigned a hostname and FQDN. You can use the FQDN to access a VM from another VM within the same cloud network.
You can specify a VM's hostname when creating it. Based on the hostname and region, the fully qualified domain name (FQDN) will be generated in the following format:
For example, if you specified the hostname
myinstance, the FQDN will be like this:
The VM name is used one time only when creating a VM, to generate the FQDN. If the FQDN is important to you, choose an appropriate name for the virtual machine at the creation stage. For more information about generating FQDN names, see Hostname and FQDN.
If no hostname is specified, the VM's ID will be used as its hostname. In this case, the region is omitted, since the VM's ID is unique within the entire Yandex.Cloud.
After the network interface is connected to a VM, it will be assigned the MAC address of the device.
You can find out the MAC address from inside the VM or in the resource information via the Yandex.Cloud API.