/
/
/
How to add an IP address to a VM?
The article contains instructions on how to manually add an IP address to servers with different operating systems.
To add an IP address, you will need to edit the network interfaces file. You can do this using standard OS editors. For example, in the Linux OS family, you can use the vi, nano, etc.
Example command to edit /etc/network/interfaces
vi /etc/network/interfaces
IPv6 settings
To add an IPv6 address, you will need information about the network parameters. This information is available in the VM card: go to Virtual Machines → click on the VM name → IP addresses tab → IPv6 tab → Network parameters button.
Example parameters
AlmaLinux
To assign an IP address:
- Connect to the server via SSH with superuser permissions.
-
To assign an IPv4 address
To assign an IPv6 address
-
Restart the NetworkManager software:
systemctl restart NetworkManager
-
Reconnect the network interface:
nmcli device disconnect <interface> && nmcli device connect <interface>
Comments to the command
CentOS
To assign an IP address:
- Connect to the server via SSH with superuser permissions.
-
To assign an IPv4 address
To assign an IPv6 address
-
Restart the network service:
systemctl restart network
Debian, Ubuntu
To assign an IP address:
- Connect to the server via SSH with superuser permissions.
-
Specify the network settings in /etc/network/interfaces:
To assign an IPv4 address
To assign an IPv6 address
-
Restart the networking service:
systemctl restart networking
Assigning an IPv6 address in Windows
- Connect to the virtual machine via VNC or SPICE. To do so, in VMmanager go to Virtual machines → click on the VM name→ VNC (SPICE).
-
Press Win + R and execute the command:
ncpa.cpl
- Right click on the network connection → Properties.
- Check thatIPv6 (TCP/IPv6) is enabled. Select it and click on Properties.
- Enable the option Use the nextIPv6 address.
- Enter any IPv6 address from the subnet that VMmanager allocated for the server.
- Specify the Subnet prefix lengththat VMmanager allocated for the server.
- Specify the Main gateway of the physical network.
- Click onOK to save the settings.
- IPv6 settings
- AlmaLinux
- CentOS
- Debian, Ubuntu
- Assigning an IPv6 address in Windows